AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   [HUD] Level & Exp (https://forums.alliedmods.net/showthread.php?t=253420)

ZiZox 12-21-2014 18:07

[HUD] Level & Exp
 
2 Attachment(s)
[HUD] Level & Exp


-[ Description ]-
This Plugin Shows Your Class,Level & Exp On Hud. :)
And When Up a Level It Makes a Fade Screen and Play a Sound.
Aslo You Can Change It With Another Mod (bb,zm,...)

Code :

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fun>
#include <cstrike>
#include <fakemeta_util>

#define PLUGIN "XP/LEVEL"
#define VERSION "4.0"
#define AUTHOR "ZiZox/hisoka"

new g_level[32], g_level_datag_frags_levelg_ScreenFade,SymbolsName
new g_level_maxg_level_numg_levels[32
new 
level_exp[32]
new 
g_level_exp[32], g_exp_datag_Playersnameid[32]
new 
g_trime[32], g_MsgSync
new sound_level_up[] = { "misc/level_up.wav"}
const 
PEV_SPEC_TARGET pev_iuser2
new SaveSystem

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
SaveSystem register_cvar("fr_SaveSystem","1")
    
    
    
g_frags_level =         register_cvar("fr_level_frags""10")
    
g_level_max  =         register_cvar("fr_level_max""150")
    
g_level_num =         register_cvar("fr_level_number""1")
        
    
g_level_data nvault_open("fr_Leveling_Save")
    
g_exp_data nvault_open("fr_Exp_Save")
                
    
SymbolsName register_cvar("fr_name_symbols""`")
    
    
register_forward(FM_ClientUserInfoChanged"ChangeName")
                    
    
register_event("StatusValue","show_status","be","1=2","2!0");
    
register_event("StatusValue","show_statusx","be","1=2","2!0");
    
register_event("HLTV""Round_Start""a""1=0""2=0")
    
register_event("DeathMsg""Frags_Manager""a""1>0")    
    
set_task(2.0,"System_Save",_,_,_,"b")
    
    
g_ScreenFade get_user_msgid"ScreenFade" )
    
g_Players =get_maxplayers()    
    
g_MsgSync CreateHudSyncObj()
}

 



//------| Change Name |------//
public ChangeName(idbuffer) {
    if(!
is_user_connected(id))
    return 
FMRES_IGNORED;

    static 
Name[32], Val[32];
    
get_user_name(idNamesizeof Name 1);
    
engfunc(EngFunc_InfoKeyValuebuffer"name"Valsizeof Val 1);
    
    if(
equal(ValName))
    return 
FMRES_IGNORED;
    
    
set_task(0.2"client_connect"id);
    return 
FMRES_SUPERCEDE;
    }
    

public 
client_putinserver(id)
{

    if(
get_pcvar_num(SaveSystem))
    
System_Load(id)
    
g_level_exp[id] = get_pcvar_num(g_frags_level)
    new 
name[32]
    
g_trime[id] = false;
    
nameid[id] = get_user_name(idnamesizeof name 1)
    if(
is_user_alive(id))
    {
        
g_trime[id] = false;
        new 
1;
        while( 
!= g_level[id] )
        {
            
1;
        }
    }
    if( 
g_level[id] == 0g_level[id] = 1;
    if( 
level_exp[id] == g_level[id] ) level_exp[id] = 0;
    if(
g_level[id] < get_pcvar_num(g_level_num))
        
g_levels[id] = get_pcvar_num(g_level_num);
    else
    {
        if(
g_level[id] != g_levels[id])
        {
            new 
1;
            while( 
g_level[id] > ( get_pcvar_num(g_level_num)) )
            {
                
1;
                
g_levels[id] = get_pcvar_num(g_level_num);
            }
        }
    }
    new 
1;
    while( 
g_level[id] != )
    {
        
1;
        
g_level_exp[id] = get_pcvar_num(g_frags_level);
    }
}

public 
client_connected(id) {
    
System_Load(id)
    }
public 
client_authorized(id) {
    
System_Load(id)
    }    
public 
client_disconnect(id){
    
    
System_Save(id)
    
remove_task(id)    
    new 
name[32], player_nick[32]
    
player_nick[id] = get_user_name(idnamesizeof name 1)
    if(
player_nick[id] == nameid[id])
    
g_trime[id] = false;

    static 
sName[32];
    
get_user_name(idsNamesizeof sName 1);
    static 
sChars[32];
    
get_pcvar_string(SymbolsNamesCharssizeof sChars 1);    
    for(new 
strlen(sName) ; i++) {
    for(new 
strlen(sChars) ; j++) {
    if(
sName[i] == sChars[j]) {
    
server_cmd("kick #%d ^"Numele tau contine caractere nepermise.^""get_user_userid(id));
    break;
    }
    }
    }
}

// Save System When Pausing The Plugin
public plugin_pause()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum)
    for(new 
ii<iNumi++)
        
System_Save(iPlayers[i])
}

// Load System After Unpause The Plugin
public plugin_unpause()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum)
    for(new 
ii<iNumi++)
        
System_Load(iPlayers[i])
}
public 
System_Save(id){
    new 
key[64], data[256], data_exp[256], key_exp[64]
    new 
name[33]
    
get_user_name(id,name,32)
    
    
format(key63"%s-/"name)
    
format(data255"%i#"g_level[id])
    
    
format(key_exp63"%s-/"name)
    
format(data_exp255"%i#"level_exp[id])            
    
    
nvault_set(g_level_datakeydata)
    
nvault_set(g_exp_datakey_expdata_exp)
    
    return 
PLUGIN_CONTINUE;

}

public 
System_Load(id)
{

    new 
key[64], data[256], data_exp[256], key_exp[64]
    new 
name[33]
    
get_user_name(id,name,32)
    
    
format(key63"%s-/"name)
    
format(data255"%i#"g_level[id])
    
    
format(key_exp63"%s-/"name)
    
format(data_exp255"%i#"level_exp[id])
        
    
nvault_get(g_level_datakeydata255)
    
nvault_get(g_exp_datakey_expdata_exp255)
    
    
replace_all(data255"#"" ")
    
replace_all(data_exp255"#"" ")
    
    new 
givelevel[32], give_exp[32]
    
parse(datagivelevel31)
    
parse(data_expgive_exp31)

    
g_level[id] = str_to_num(givelevel)
    
level_exp[id] = str_to_num(give_exp)
        
    
set_task(1.0 ,"level_status"id__"b")
    return 
PLUGIN_CONTINUE;    
}
/*------------------------------------- Level System ---------------------------------------------------------*/
public Round_Start()
{
for(new 
id=1;id<=g_Players;id++)
    
set_task(3.0"Level"id)
    
}

public 
Level(id)
{
    if(
is_user_alive(id) )
    {
        
g_trime[id] = false;
        new 
1;
        while( 
g_level[id] )
        {
            
1
        
}
    }
}

public 
Frags_Manager()
{
    new 
aname[32], attackerattacker read_data(1)
    new 
y1;
    
get_user_name(attackeranamesizeof aname 1)
    if( ( 
level_exp[attacker] >= (g_level_exp[attacker] - 1) ) && (g_level[attacker] <= get_pcvar_num(g_level_max)) && is_user_alive(attacker) )
    {
        
g_level[attacker] = g_level[attacker] + 1;
        
level_exp[attacker] = 0;
        while( 
g_level[attacker] != )
        {
            
1;
            
g_level_exp[attacker] = get_pcvar_num(g_frags_level);
        }
        
message_begin(MSG_ONE_UNRELIABLEg_ScreenFade_attacker)
        
write_short(1<<12// duration
        
write_short(1// hold time
        
write_short(0x0000// fade type
        
write_byte(1// red
        
write_byte(200// green
        
write_byte(0// blue
        
write_byte(205// alpha
        
message_end()
        
emit_sound(attackerCHAN_STREAMsound_level_up1.0ATTN_NORM0PITCH_HIGH )
        
set_hudmessage(020000.650.500.03.02.01.0, -1)
        
show_hudmessage(0"%s has cut down %i level"anameg_level[attacker])
        
System_Save(attacker);
    }
    else
    {        
        if(
g_level[attacker] == get_pcvar_num(g_level_max))
        
Chat9olor(attacker"^x04you have reached a maximum level: ^4%i"g_level[attacker] )
        
level_exp[attacker] = level_exp[attacker] + 1;
        if(
get_pcvar_num(SaveSystem))
        
System_Save(attacker);
    }
}

/*-----------------------------------------Hud Message----------------------------------------------------------*/

public level_status(id)
{
    new 
Spec
    Spec 
pev(idPEV_SPEC_TARGET)
    new 
PlayerName[32]
    
get_user_name(SpecPlayerName31)
     
    if(
is_user_alive(id))
    {
        
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
    
set_hudmessage(1018010, -1.00.8706.01.1)
    
ShowSyncHudMsg(idg_MsgSync"[ Class : Counter-Terrorist ]^n [ Level : %d ] - [ Exp %d/%d ]",g_level[id],level_exp[id],g_level_exp[id])
    }
    
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
    
set_hudmessage(1018010, -1.00.8706.01.1)
    
ShowSyncHudMsg(idg_MsgSync"[ Class : Terrorist ]^n [ Level : %d ] - [ Exp %d/%d ]",g_level[id],level_exp[id],g_level_exp[id])
    }    
    
    }
    
    else 
    
    if(
is_user_alive(Spec))
    {
        
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {        
    
set_hudmessage(20030200, -1.00.7906.01.1)
    
ShowSyncHudMsg(idg_MsgSync"Spectating: %s ^n [ Class : Counter-Terrorist ]^n [ Level : %d ] - [ Exp %d/%d ]",PlayerName,g_level[Spec],level_exp[Spec],g_level_exp[Spec])
    }
    
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {        
    
set_hudmessage(20030200, -1.00.7906.01.1)
    
ShowSyncHudMsg(idg_MsgSync"Spectating: %s ^n [ Class : Terrorist ]^n [ Level : %d ] - [ Exp %d/%d ]",PlayerName,g_level[Spec],level_exp[Spec],g_level_exp[Spec])
    }
    
    }
}
public 
show_status(id)
{
        new 
name[32],pid read_data(2)
        
get_user_name(pid,name,31)
    new 
idAimingiBodyPart
    get_user_aiming
(ididAimingiBodyPart)
    
    if(
is_user_alive(idAiming) && is_user_alive(id)) 
    {
        if(
cs_get_user_team(id) == CS_TEAM_CT && cs_get_user_team(idAiming) == CS_TEAM_CT)
        {
            
set_hudmessage(238,201,0,-1.0,0.60,10.013.00.010.01, -1)
            
show_hudmessage(id"%s ^n [ Health: %d - Class: Counter-Terrorist - Armor: %d - Money: %d ]^n Level : %i - Exp : %i/%i"name,get_user_health(pid),get_user_armor(pid),cs_get_user_money(pid),g_level[pid],level_exp[pid],g_level_exp[pid])
        }
        else 
        if(
cs_get_user_team(id) == CS_TEAM_T && cs_get_user_team(idAiming) == CS_TEAM_T)
        {
            
set_hudmessage(255,0,0,-1.0,0.60,10.013.00.010.01, -1)
            
show_hudmessage(id"%s ^n [ Health: %d - Class: Terrorist - Armor: %d - Money: %d ]^n Level : %i - Exp : %i/%i"name,get_user_health(pid),get_user_armor(pid),cs_get_user_money(pid),g_level[pid],level_exp[pid],g_level_exp[pid])
        }
    }
}
public 
show_statusx(id)
{
        new 
name[32],pid read_data(2)
        
get_user_name(pid,name,31)
    new 
idAimingiBodyPart
    get_user_aiming
(ididAimingiBodyPart)
    
    if(
is_user_alive(idAiming) && is_user_alive(id)) 
    {
        if(
cs_get_user_team(id) == CS_TEAM_T && cs_get_user_team(idAiming) == CS_TEAM_CT)
        {
            
set_hudmessage(2382010,-1.0,0.60,10.013.00.010.01, -1)
            
show_hudmessage(id"%s ^n [ Health: %d - Class: Counter-Terrorist - Armor: %d - Money: %d ]^n Level : %i - Exp : %i/%i"name,get_user_health(pid),get_user_armor(pid),cs_get_user_money(pid),g_level[pid],level_exp[pid],g_level_exp[pid])
        }
    }
}
stock Chat9olor(const id, const input[], any:...)
{
    new 
count 1players32 ]
    static 
msg191 ]
    
vformatmsg190input)    
    
replace_allmsg190"!g""^4" )
    
replace_allmsg190"!y""^1" )
    
replace_allmsg190"!t""^3" )    
    if(
idplayers] = id; else get_playersplayerscount"ch" )
    {
    for(new 
0counti++)
    {
        if( 
is_user_connectedplayers] ) )
        {
            
message_beginMSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players] )  
            
write_byteplayers] )
            
write_stringmsg )
            
message_end( )
        }
    }
}


-[ Cvars ]-
fr_level_frags - Set Level Frags
fr_level_max - Max Levels
fr_level_number - Number Of Level When Connecting


Credit :
Linkin Hisoka

-[ Screenshots ]-
http://imageshack.com/a/img673/4258/3l5wyP.png
http://imageshack.com/a/img540/5571/NpbNjE.png

YamiKaitou 12-21-2014 18:13

Re: [HUD] Level & Exp
 
AMXX file removed, do not upload it again

ZiZox 12-21-2014 18:18

Re: [HUD] Level & Exp
 
Quote:

Originally Posted by YamiKaitou
AMXX file removed, do not upload it again

Ok :3

Linkin Hisoka 12-21-2014 18:23

Re: [HUD] Level & Exp
 
hahaha Zizox+Hisoka = <3 :D i love you friend

nice time in coding :')

YamiKaitou 12-21-2014 18:25

Re: [HUD] Level & Exp
 
So what is the point of this plugin? Do the levels even do anything?

ZiZox 12-21-2014 18:26

Re: [HUD] Level & Exp
 
hah :v ! :D

ZiZox 12-21-2014 18:30

Re: [HUD] Level & Exp
 
Quote:

Originally Posted by YamiKaitou
So what is the point of this plugin? Do the levels even do anything?

The Plugin Shows Your class , level,exp
exp = frags , server will save your frags , so when you killed someone you will get 1 exp, and when you complete exp/10 you will commence with a new level exp/20 ..max levels is 150.

Linkin Hisoka 12-21-2014 18:38

Re: [HUD] Level & Exp
 
that is nice plugin Kill = 1 xp
10 xp = cut 1 level .... :D

Jhob94 12-21-2014 18:59

Re: [HUD] Level & Exp
 
Only post things things in english. What's the difference between this plugin and others xp plugins?
You should never submit a copy/pasted plugin unless you actually understand the code. Wich i doubt any of you understand the entire plugin.

ZiZox 12-21-2014 22:48

Re: [HUD] Level & Exp
 
Quote:

Originally Posted by Jhob94
Only post things things in english. What's the difference between this plugin and others xp plugins?
You should never submit a copy/pasted plugin unless you actually understand the code. Wich i doubt any of you understand the entire plugin.

I Created The Plugin with Linkin Hisoka , There No Copy/PAST ! :down:


All times are GMT -4. The time now is 20:42.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.