Raised This Month: $170 Target: $400
 42% 

[solved] nvault : when i change name problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-02-2014 , 10:49   [solved] nvault : when i change name problem
Reply With Quote #1

I have my XP mod, everytime when i change name i have a problem :

Example if i have level 30 on this name : "ABD"

if i change name to TEST [ and TEST have level 0 ], then TEST will have my level [ 30 ]

The only solution i finded is to block change name but i dont wont to ( this is require my fakemeta ) and i wanna remove it [ because i use only for block name .. ]

Other ideas ?

Anywhey heres the code, but i dont think will help you.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <nvault>
#include <cstrike>
#include <fakemeta>



/*    ()        Leve Mod ConfiG        ()        */


/*    Who have flag "t" have vip !    */
#define VIP_ACCES    ADMIN_LEVEL_H

/*    Who have acces to amx_xp       !        */
#define ADMIN_ACCES    ADMIN_MENU

/*    Who have acces to amx_showxp       !        */
#define ADMIN_ACCES_INFO    ADMIN_KICK




/*    ()        ----------------------        ()    */




//     Plugin Info !

new const PLUGIN_NAME[] = "Level Mod";
new const 
AUTHOR[] = "swapped";
new const 
hnsxp_version[] = "6.5.5";

new 
levels[51] = {
    
10,        /*    Level 1        */ 
    
50,        /*    Level 2        */
    
100,        /*    Level 3        */
    
400,        /*    Level 4        */
    
800,        /*    Level 5        */
    
1000,        /*    Level 6        */
    
1800,        /*    Level 7        */
    
2400,        /*    Level 8        */
    
3000,        /*    Level 9        */
    
4000,        /*    Level 10    */
    
4800,        /*    Level 11    */
    
5500,        /*    Level 12    */
    
8000,        /*    Level 13    */
    
10000,        /*    Level 14    */
    
12000,        /*    Level 15    */
    
14000,        /*    Level 16    */
    
16000,        /*    Level 17    */
    
18000,        /*    Level 18    */
    
20000,        /*    Level 19    */
    
22050,        /*    Level 20    */
    
23079,        /*    Level 21    */
    
26000,        /*    Level 22    */
    
28070,        /*    Level 23    */
    
29000,        /*    Level 24    */
    
30050,        /*    Level 25    */
    
35000,        /*    Level 26    */
    
40050,        /*    Level 27    */
    
50000,        /*    Level 28    */
    
60050,        /*    Level 29    */
    
70000,        /*    Level 30    */
    
80550,        /*    Level 31    */
    
94000,        /*    Level 32    */
    
95200,        /*    Level 33    */
    
100050,        /*    Level 34    */
    
110000,        /*    Level 35    */
    
140200,        /*    Level 36    */
    
150200,        /*    Level 37    */
    
180200,        /*    Level 38    */
    
190200,        /*    Level 39    */
    
202042,     /*    Level 40    */
    
300000,        /*    Level 41    */
    
450000,        /*    Level 42    */
    
600000,        /*    Level 43    */
    
780000,        /*    Level 44    */
    
850000,        /*    Level 45    */
    
900000,        /*    Level 46    */
    
1000000,    /*    Level 47    */
    
1200000,    /*    Level 48    */
    
1500000,    /*    Level 49    */
    
1999999,    /*    Level 50    */
    
999999999     /*    Solver The Error  */
};
    
    



#define is_user_vip(%1)        ( get_user_flags(%1) & VIP_ACCES )

#define IsPlayer(%1) ( 1 <= %1 <=  g_iMaxPlayers )

#define TEAM_T 1
#define TEAM_CT 2

new g_iMaxPlayers;
new 
hnsxp_playerxp[33];
new 
hnsxp_playerlevel[33];
new 
g_hnsxp_vault;
new 
wxp;
new 
xlevel;
new 
dcr_fwd;
new 
xp_kill_cvar;
new 
xp_hs_cvar;
new 
xp_vip_cvar;
new 
xp_win_cvar;
new 
time_item_cvar;
new 
g_iDamage_xp;
new 
speed_per_level;
new 
money_per_level;
new 
health_per_level;
new 
gravity_per_level;
new 
levelmod_prefix;
new 
g_item
new Array:Item_Name;
new Array:
Item_Cost;
new Array:
Item_Desc;
new Array:
Item_Team
new g_selected_forward
new g_damage_per_level;
new 
g_armor_per_level;

enum Color
{
    
NORMAL 1// clients scr_concolor cvar color
    
YELLOW 1// NORMAL alias
    
GREEN// Green Color
    
TEAM_COLOR// Red, grey, blue
    
GREY// grey
    
RED// Red
    
BLUE// Blue
}
 
new 
TeamName[][] =
{
    
"",
    
"TERRORIST",
    
"CT",    
    
"SPECTATOR"
}


public 
plugin_init()
{
        
register_plugin(PLUGIN_NAMEhnsxp_versionAUTHOR);

    
register_event("DeathMsg""hnsxp_playerdie""a");
    
register_event("Damage""give_bonus_dmh""b""2!0""3=0""4!0");
    
register_event("CurWeapon""Ham_CheckSpeed_Bonus""be""1=1");
        
register_event("SendAudio""t_win""a""2&%!MRAD_terwin")

    
xp_kill_cvar register_cvar("levelmod_kill","10")
    
xp_hs_cvar register_cvar("levelmod_hs","25")
    
xp_vip_cvar register_cvar("levelmod_vip_xp","50")
    
xp_win_cvar register_cvar("levelmod_tero_win","15")
    
time_item_cvar  register_cvar("levelmod_time_item","15.0");
    
g_iDamage_xp register_cvar("levelmod_damage_xp","5");
    
speed_per_level register_cvar("levelmod_speed_per_level","3");
    
health_per_level register_cvar("levelmod_health_per_level","5");
    
money_per_level register_cvar("levelmod_money_per_level","1");
    
gravity_per_level register_cvar("levelmod_gravity_per_level","3");
    
levelmod_prefix register_cvar("levelmod_tag","LEVEL MOD");
    
g_damage_per_level register_cvar("levelmod_damage_per_level","10");
    
g_armor_per_level register_cvar("levelmod_armor_per_level""5");

           
register_clcmd("say /level","plvl");
        
register_clcmd("say /xp","plvl");
        
register_clcmd("say /lvl","plvl");
        
register_clcmd("say /levels","plvl");
    
register_clcmd("say /levelmodmenu""_open_menu");
    
register_clcmd("say /lvlmenu""_open_menu");
    
register_clcmd("say /levelmenu""_open_menu");
        
register_clcmd("say_team /levels","plvl");
        
register_clcmd("say_team /level","plvl");
        
register_clcmd("say_team /xp","plvl");
        
register_clcmd("say_team /lvl","plvl");
    
register_clcmd("say_team /levelmodmenu""_open_menu");
    
register_clcmd("say_team /lvlmenu""_open_menu");
    
register_clcmd("say_team /levelmenu""_open_menu");

        
g_hnsxp_vault nvault_open("levelmod_xp_vault");

    
register_concmd("amx_xp","cmd_xp",ADMIN_ACCES,"<NUME> <XP>");
    
register_concmd("amx_showxp","cmd_xp_info",ADMIN_ACCES_INFO,"Retrive player xp,level information.");

        
xlevel CreateMultiForward("levelmod_client_make_next_level"ET_IGNOREFP_CELL);
        
wxp CreateMultiForward("levelmod_client_hook_xp"ET_IGNOREFP_CELL);
    
g_selected_forward CreateMultiForward("levelmod_selected_item"ET_IGNOREFP_CELLFP_CELL)    
    
dcr_fwd CreateMultiForward("levelmod_client_lost_level"ET_IGNOREFP_CELL);
    
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged"
    
    
g_iMaxPlayers get_maxplayers ( )
    
RegisterHam Ham_TakeDamage"player""Player_TakeDamage");
        
RegisterHam(Ham_Spawn"player""hnsxp_spawn"1);
}

public 
give_bonus_dmh(id)
{
    static 
valuevalue read_data);
    static 
attackerattacker get_user_attacker(id)
    new 
szName[33]; get_user_name(idszName32);
    new 
TAG[60];
    
get_pcvar_stringlevelmod_prefixTAGcharsmaxTAG ) - );

    if(!
is_user_alive(attacker) || !attacker || !id || id == attacker)
        return 
PLUGIN_HANDLED;

    
    
GiveExpattackerget_pcvar_numg_iDamage_xp ) );
    
ColorChat(attackerTEAM_COLOR"^1[ ^3%s^1 ] You received ^4%iXP^1 because you give ^4%i^1 damage on ^4%s^1 !",TAG,get_pcvar_num(g_iDamage_xp),value,szName);    
    
UpdateLevel(attacker);
    return 
PLUGIN_CONTINUE;
    
}

public 
_open_menuid )
{
    new 
TAG[60];
    
get_pcvar_stringlevelmod_prefixTAGcharsmaxTAG ) - );

    if(!
is_user_alive(id))
    {
        
ColorChat(idTEAM_COLOR"^1[ ^3%s^1 ] You can buy when you are dead !",TAG)
        return 
PLUGIN_HANDLED
    
}
    
    if(
g_item == 0)
    {
        
ColorChat(idTEAM_COLOR"^1[ ^3%s^1 ] Menu are empty !",TAG)
        return 
PLUGIN_HANDLED        
    
}
    
    static 
temp_menu[64]
    static 
menutemp_string1[33], temp_integer1temp_string2[33], temp_string3[5]
    
    if(
get_user_team(id) == 2)
    {
        
menu menu_create("Levelmod CT Menu:""menu1_handle_ct")
        
        for(new 
0g_itemi++)
        {
            if(
ArrayGetCell(Item_Teami) == TEAM_CT)
            {
                
ArrayGetString(Item_Nameitemp_string1sizeof(temp_string1))
                
temp_integer1 ArrayGetCell(Item_Costi)
                
ArrayGetString(Item_Descitemp_string2sizeof(temp_string2))
                
                
formatex(temp_menusizeof(temp_menu), " %s - %i XP "temp_string1temp_integer1)
                
                
num_to_str(itemp_string3sizeof(temp_string3))
                
menu_additem(menutemp_menutemp_string3)
            }
        }
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
menu_display(idmenu0)    
        
    } else if(
get_user_team(id) == 1) {
        
menu menu_create("Levelmod Tero menu:""menu1_handle_tero")
        
        for(new 
0g_itemi++)
        {
            if(
ArrayGetCell(Item_Teami) == TEAM_T
            {
                
ArrayGetString(Item_Nameitemp_string1sizeof(temp_string1))
                
temp_integer1 ArrayGetCell(Item_Costi)
                
ArrayGetString(Item_Descitemp_string2sizeof(temp_string2))
                
                
formatex(temp_menusizeof(temp_menu), "%s - %i XP "temp_string1temp_integer1)
                
                
num_to_str(itemp_string3sizeof(temp_string3))
                
menu_additem(menutemp_menutemp_string3)            
            }
        }
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
menu_display(idmenu0)    
    }
    
    return 
PLUGIN_CONTINUE
}

public 
menu1_handle_ct(idmenuitem)
{
    new 
TAG[60];
    
get_pcvar_stringlevelmod_prefixTAGcharsmaxTAG ) - );

    if(
item == MENU_EXIT || get_user_team(id) != 2)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    static 
data[6], szName[64], accesscallback
    
static temp_integer1
    menu_item_getinfo
(menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback)
    
    
temp_integer1 str_to_num(data)
    
    static 
costwp_name[64], wp_desc[64]
    
cost ArrayGetCell(Item_Costtemp_integer1)
    
ArrayGetString(Item_Nametemp_integer1wp_namesizeof(wp_name))
    
ArrayGetString(Item_Desctemp_integer1wp_descsizeof(wp_desc))
    
    if(
hnsxp_playerxp[id] >= cost)
    {
        
ColorChat(idTEAM_COLOR"^1[ ^3%s^1 ] You bought ^4%s^1 for ^4%i^1 XP !",TAGwp_namecost)
        
ColorChat(idTEAM_COLOR"^1[ ^3%s^1 ] %s",TAG,wp_desc)
        
        
TakeExp(idcost);
        
        static 
g_dummy
        ExecuteForward
(g_selected_forwardg_dummyidtemp_integer1)
    } else {
        
ColorChat(idTEAM_COLOR"^1[ ^3%s^1 ] You need at least ^4%i^1 XP to buy ^4%s^1 !",TAGcostwp_name )
    }
        
    return 
PLUGIN_CONTINUE
}

public 
menu1_handle_tero(idmenuitem)
{
    new 
TAG[60];
    
get_pcvar_stringlevelmod_prefixTAGcharsmaxTAG ) - );

    if(
item == MENU_EXIT || get_user_team(id) != 1)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    static 
data[6], szName[64], accesscallback
    
static temp_integer1
    menu_item_getinfo
(menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback)
    
    
temp_integer1 str_to_num(data)
    
    static 
costname[32], desc[32]
    
cost ArrayGetCell(Item_Costtemp_integer1)
    
ArrayGetString(Item_Nametemp_integer1namesizeof(name))
    
ArrayGetString(Item_Desctemp_integer1descsizeof(desc))

    if(
hnsxp_playerxp[id] >= cost)
    {
        
ColorChat(idTEAM_COLOR"^1[ ^3%s^1 ] You bought ^4%s^1 for ^4%i^1 XP !",TAGnamecost)
        
ColorChat(idTEAM_COLOR"^1[ ^3%s^1 ] %s",TAG,desc)
        
        
TakeExp(idcost);
        
        static 
g_dummy
        ExecuteForward
(g_selected_forwardg_dummyidtemp_integer1)
    } else {
        
ColorChat(idTEAM_COLOR"^1[ ^3%s^1 ] You need at least ^4%i^1 XP to buy ^4%s^1 !",TAGcostname )
    }
        
    return 
PLUGIN_CONTINUE    
}


public 
Player_TakeDamage iVictimiInflictoriAttackerFloat:fDamage ) {
    
    if ( 
iInflictor == iAttacker && IsPlayer iAttacker ) && hnsxp_playerlevel[iAttacker]) 
    {
    
        
SetHamParamFloat 4fDamage hnsxp_playerxpiAttacker ] * get_pcvar_numg_damage_per_level ) );
        return 
HAM_HANDLED;
           }
    
    return 
HAM_IGNORED;
    
}

public 
ClientUserInfoChanged(id)
{
    static const 
name[] = "name"
    
static szOldName[32], szNewName[32]
    
pev(idpev_netnameszOldNamecharsmax(szOldName))
    if( 
szOldName[0] )
    {
        
get_user_info(idnameszNewNamecharsmax(szNewName))

        if( !
equal(szOldNameszNewName) )
        {
            
set_user_info(idnameszOldName)
            return 
FMRES_HANDLED
        
}
    }
    return 
FMRES_IGNORED
}

public 
cmd_xp(id,level,cid)
{
    if(!
cmd_access(id,level,cid,3))
        return 
PLUGIN_HANDLED;
    
    new 
arg[33], amount[33]
    
read_argv(1argcharsmax(arg) - 1)
    
read_argv(2amountcharsmax(amount) - 1)
    new 
target cmd_target(idarg7)
    new 
admin_name[35], player_name[35];
    
get_user_name(targetplayer_namecharsmax(player_name) - 1);
    
get_user_name(idadmin_namecharsmax(admin_name) - 1);
    new 
TAG[60];
    
get_pcvar_stringlevelmod_prefixTAGcharsmaxTAG ) - );



    new 
wors str_to_num(amount)
    
    
    if(!
target)
    {
        return 
1
    
}
    
        new 
ret;
        
ExecuteForward(wxprettarget);
    
hnsxp_playerxp[target] = wors;
    
ColorChat(0TEAM_COLOR"^1[ ^3%s^1 ] Admin ^4%s^1 set ^4%i^1 xp on ^4%s^1 !",TAG,admin_name,wors,player_name);
    
UpdateLevel(target);
    return 
0
}
  
public 
cmd_xp_info(id,level,cid)
{
    if(!
cmd_access(id,level,cid,2))
        return 
PLUGIN_HANDLED;

    new 
arg[33]
    
read_argv(1arg32)

    new 
target cmd_target(idarg7)

    new 
player_name[35];
    
get_user_name(targetplayer_namecharsmax(player_name) - 1);
    new 
TAG[60];
    
get_pcvar_stringlevelmod_prefixTAGcharsmaxTAG ) - );
    
    
    if(!
target)
    {
        return 
1;
    }
    
    
ColorChat(0TEAM_COLOR"^1[ ^3%s^1 ] Player ^3%s^1 have level ^4%i^1 [ ^4%i^1 / ^4%i^1 ]",TAG,player_name,hnsxp_playerlevel[target], hnsxp_playerxp[target],levels[hnsxp_playerlevel[target]]); 
    return 
0;
}

/*      Speed Check      */
public Ham_CheckSpeed_Bonusid )
{
    if(
is_user_alive(id))
    {
        
set_user_maxspeedid250.0 get_pcvar_numspeed_per_level ) * hnsxp_playerlevelid ] );
    }        
}

GiveExp(indexvalue)
{
    if(
value >= 1999999)
    {
        
hnsxp_playerxp[index] = 1999999 ;
        return 
1;
    }
    if(
hnsxp_playerxp[index] >= 1999999)
    {
        
hnsxp_playerxp[index] = 1999999;
        return 
1;
    }

        new 
ret;
        
ExecuteForward(wxpretindex);

    
client_cmd(0"spk buttons/bell1");
    
hnsxp_playerxp[index] = hnsxp_playerxp[index] + value;
    return 
0;
}

TakeExp(indexvalue)
{
    if(
hnsxp_playerxp[index] >= value)
    {
        
hnsxp_playerxp[index] = hnsxp_playerxp[index] - value;
    }

    else
    {
        
hnsxp_playerxp[index] = 0;
    }
}

public 
plugin_precache()
{
    
Item_Name ArrayCreate(641)
    
Item_Cost ArrayCreate(11)
    
Item_Desc ArrayCreate(641)
    
Item_Team ArrayCreate(11)
}

public 
plugin_natives()
{
        
register_native("levelmod_get_user_xp","_get_user_xp");
        
register_native("levelmod_get_user_level","_get_user_level");
    
register_native("levelmod_get_user_next_level""_next_level");
    
register_native("levelmod_get_user_xp_needed""_xp_needed");
        
register_native("levelmod_set_user_xp","_set_user_xp");
        
register_native("levelmod_set_user_level","_set_user_level");
    
register_native("levelmod_updatelevel","_update");
    
register_native("levelmod_open_menu","_open");
    
register_native("levelmod_menu_register_item""native_register_item"1)

}

public 
_open(pluinparams)
{
    new 
id get_param);

    if( 
is_user_aliveid ) )
    {
        
_open_menuid );
    }    
}

public 
_update(pluinparams)
{
    new 
ids get_param);

    if( 
is_user_connectedids ) )
    {
        
UpdateLevelids );
    }
}

public 
_get_user_xp(pluginparams)
{
        return 
hnsxp_playerxp[get_param(1)];
}

public 
_get_user_level(pluginparams)
{
        return 
hnsxp_playerlevel[get_param(1)];
}

public 
_next_level(pluginparams)
{
    return 
hnsxp_playerlevel[get_param(1)] + 1;
}

public 
_xp_needed(pluinparams)
{
    return 
levels[hnsxp_playerlevel[get_param(1)]];
}

public 
_set_user_xp(pluginxer)
{
    new 
id get_param(1)
    new 
value get_param(2)

    if(
is_user_connected(id))
    {
        
hnsxp_playerxp[id] = value;
        return 
0
    
}

    else
    {
        
log_error(AMX_ERR_NATIVE,"User %d is not connected !",id)
        return 
0
    
}
    return 
1
}


public 
_set_user_level(plugineat)
{
    new 
id get_param(1)
    new 
valuex get_param(2)

    if(
is_user_connected(id))
    {
        
hnsxp_playerlevel[id] = valuex;
        return 
0
    
}

    else
    {
        
log_error(AMX_ERR_NATIVE,"User %d is not connected !",id)
        return 
0
    
}
    return 
1
}
public 
native_register_item(const item_name[], const item_cost, const item_desc[], const item_team)
{
    
param_convert(1)
    
param_convert(3)
    
    
ArrayPushString(Item_Nameitem_name)
    
ArrayPushCell(Item_Costitem_cost)
    
ArrayPushString(Item_Descitem_desc)
    
ArrayPushCell(Item_Teamitem_team)
    
    
g_item++
    
    return 
g_item 1
}

public 
gItem(id)
{
    new 
TAG[60];
    
get_pcvar_stringlevelmod_prefixTAGcharsmaxTAG ) - );

        new 
dgl give_item(id"weapon_deagle")

    new 
hp get_pcvar_numhealth_per_level ) * hnsxp_playerlevelid ];
    new 
money get_pcvar_nummoney_per_level ) * hnsxp_playerlevelid ];
    new 
armor get_pcvar_numg_armor_per_level ) * hnsxp_playerlevelid ];


        if(
is_user_alive(id))
        {
                switch(
hnsxp_playerlevel[id])
                {
                
                        case 
0:
                        {
                                
set_user_healthidget_user_healthid ) + hp );
                
set_user_armoridget_user_armorid ) + armor );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money )

                if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl1);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 1DGL ^1, ^4 0SG ^1, ^4 0FL ^1, ^4 0HE ^1!",TAG,hp,moneyarmor);
                                
remove_task(id);
                        }
                        
                        case 
1..5:
                        {
                                
give_item(id"weapon_hegrenade");
                                
give_item(id"weapon_flashbang");
                                
give_item(id"weapon_smokegrenade");

                                
cs_set_user_bpammo(idCSW_HEGRENADE1);
                                
cs_set_user_bpammo(idCSW_FLASHBANG1);
                                
cs_set_user_bpammo(idCSW_SMOKEGRENADE1);

                                
set_user_healthidget_user_healthid ) + hp );
                
set_user_armoridget_user_armorid ) + armor );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money )

                if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl1);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 1DGL ^1, ^4 1SG ^1, ^4 1FL ^1, ^4 1HE ^1!",TAG,hp,money,armor);
                         
                
remove_task(id);
                
                        }

                        case 
6..10:
                        {
                                
give_item(id"weapon_hegrenade");
                                
give_item(id"weapon_flashbang");
                                
give_item(id"weapon_smokegrenade");

                                
cs_set_user_bpammo(idCSW_HEGRENADE2);
                                
cs_set_user_bpammo(idCSW_FLASHBANG1);
                                
cs_set_user_bpammo(idCSW_SMOKEGRENADE2);

                                
set_user_healthidget_user_healthid ) + hp );
                
set_user_armoridget_user_armorid ) + armor );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money )

                if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl2);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 2DGL ^1, ^4 2SG ^1, ^4 1FL ^1, ^4 2HE ^1!",TAG,hp,money,armor);
                                
remove_task(id);
                
                        }

                        case 
11..14:
                        {
                                
give_item(id"weapon_hegrenade");
                                
give_item(id"weapon_flashbang");
                                
give_item(id"weapon_smokegrenade");

                                
cs_set_user_bpammo(idCSW_HEGRENADE3);
                                
cs_set_user_bpammo(idCSW_FLASHBANG2);
                                
cs_set_user_bpammo(idCSW_SMOKEGRENADE4);

                                
set_user_healthidget_user_healthid ) + hp );
                
set_user_armoridget_user_armorid ) + armor );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money )

                if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl3);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 3DGL ^1, ^4 4SG ^1, ^4 2FL ^1, ^4 3HE ^1!",TAG,hp,money,armor);
                                
remove_task(id);
                
                        }

                        case 
15..24:
                        {
                                
give_item(id"weapon_hegrenade");
                                
give_item(id"weapon_flashbang");
                                
give_item(id"weapon_smokegrenade");

                                
cs_set_user_bpammo(idCSW_HEGRENADE5);
                                
cs_set_user_bpammo(idCSW_FLASHBANG5);
                                
cs_set_user_bpammo(idCSW_SMOKEGRENADE5);

                                
set_user_healthidget_user_healthid ) + hp );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money )
                
set_user_armoridget_user_armorid ) + armor );

                 if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl4);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 4DGL ^1, ^4 5SG ^1, ^4 5FL ^1, ^4 5HE ^1!",TAG,hp,money,armor);
                                
remove_task(id);
                
                        }

                        case 
25..29:
                        {
                                
give_item(id"weapon_hegrenade");
                                
give_item(id"weapon_flashbang");
                                
give_item(id"weapon_smokegrenade");

                                
cs_set_user_bpammo(idCSW_HEGRENADE6);
                                
cs_set_user_bpammo(idCSW_FLASHBANG5);
                                
cs_set_user_bpammo(idCSW_SMOKEGRENADE7);

                                
set_user_healthidget_user_healthid ) + hp );
                
set_user_armoridget_user_armorid ) + armor );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money );

                if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl5);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 5DGL ^1, ^4 7SG ^1, ^4 5FL ^1, ^4 6HE ^1!",TAG,hp,money,armor);
                                
remove_task(id);
            }

                        case 
30..39:
                        {
                                
give_item(id"weapon_hegrenade");
                                
give_item(id"weapon_flashbang");
                                
give_item(id"weapon_smokegrenade");

                                
cs_set_user_bpammo(idCSW_HEGRENADE7);
                                
cs_set_user_bpammo(idCSW_FLASHBANG6);
                                
cs_set_user_bpammo(idCSW_SMOKEGRENADE7);

                                
set_user_healthidget_user_healthid ) + hp );
                
set_user_armoridget_user_armorid ) + armor );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money );

                  if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl,5);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 5DGL ^1, ^4 7SG ^1, ^4 6FL ^1, ^4 7HE ^1!",TAG,hp,money,armor);
                                
remove_task(id);
            }

                        case 
40..45:
                        {
                                
give_item(id"weapon_hegrenade");
                                
give_item(id"weapon_flashbang");
                                
give_item(id"weapon_smokegrenade");

                                
cs_set_user_bpammo(idCSW_HEGRENADE8);
                                
cs_set_user_bpammo(idCSW_FLASHBANG8);
                                
cs_set_user_bpammo(idCSW_SMOKEGRENADE8);

                                
set_user_healthidget_user_healthid ) + hp );
                
set_user_armoridget_user_armorid ) + armor );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money )

                if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl6);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 6DGL ^1, ^4 8SG ^1, ^4 8FL ^1, ^4 8HE ^1!",TAG,hp,money,armor);
                                
remove_task(id);
            }

                        case 
46..49:
                        {
                                
give_item(id"weapon_hegrenade");
                                
give_item(id"weapon_flashbang");
                                
give_item(id"weapon_smokegrenade");

                                
cs_set_user_bpammo(idCSW_HEGRENADE9);
                                
cs_set_user_bpammo(idCSW_FLASHBANG8);
                                
cs_set_user_bpammo(idCSW_SMOKEGRENADE9);

                                
set_user_healthidget_user_healthid ) + hp );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money )
                
set_user_armoridget_user_armorid ) + armor );

                if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl,6);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 6DGL ^1, ^4 9SG ^1, ^4 8FL ^1, ^4 9HE ^1!",TAG,hp,money,armor);
                                
remove_task(id);
            }
                   
                        case 
50:
                        {
                                
give_item(id"weapon_hegrenade");
                                
give_item(id"weapon_flashbang");
                                
give_item(id"weapon_smokegrenade");

                                
cs_set_user_bpammo(idCSW_HEGRENADE10);
                                
cs_set_user_bpammo(idCSW_FLASHBANG10);
                                
cs_set_user_bpammo(idCSW_SMOKEGRENADE10);

                                
set_user_healthidget_user_healthid ) + hp );
                
cs_set_user_moneyidcs_get_user_moneyid ) + money );
                
set_user_armoridget_user_armorid ) + armor );

                if( 
dgl )
                {
                                    
cs_set_weapon_ammo(dgl7);
                }

                                
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 7DGL ^1, ^4 10SG ^1, ^4 10FL ^1, ^4 10HE ^1!",TAG,hp,money,armor);
                                
remove_task(id);
            }
                
     
                        
 
                }
                        
        }

}




UpdateLevel(id)
{
    new 
ret;
        if((
hnsxp_playerlevel[id] < 50) && (hnsxp_playerxp[id] >= levels[hnsxp_playerlevel[id]]))
        {
                
ExecuteForward(xlevelretid);

                while(
hnsxp_playerxp[id] >= levels[hnsxp_playerlevel[id]])
                {
                        
hnsxp_playerlevel[id]++;
                }
        }
    else
    {
                
ExecuteForward(dcr_fwdretid);

        while(
hnsxp_playerxp[id] < levels[hnsxp_playerlevel[id]])
        {
            
hnsxp_playerlevel[id]--;
        }
    }
        
}

public 
hnsxp_spawn(id)
{
        
set_task(get_pcvar_float(time_item_cvar), "gItem"id);

    new 
GRAVITYCheck 800 get_pcvar_numgravity_per_level ) * hnsxp_playerlevelid ];

    if(
is_user_alive(id))
    {

        
set_user_gravityidfloatGRAVITYCheck ) / 800.0 );
        
UpdateLevel(id);
    
    }


}

public 
plvl(id)
{
    new 
TAG[60];
    
get_pcvar_stringlevelmod_prefixTAGcharsmaxTAG ) - );

        if(
hnsxp_playerlevel[id] >= 99)
    {
        
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] ^1Max Level(50) ! ",TAG);
        return 
PLUGIN_HANDLED
    
}
    
    else
    {
            
ColorChat(idTEAM_COLOR,"^1[^3 %s^1 ] ^4LVL ^1: ^3%i ^1, ^4XP ^1: ^3%i ^1/ ^3%i ",TAGhnsxp_playerlevel[id], hnsxp_playerxp[id], levels[hnsxp_playerlevel[id]]);
            return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE    
            
}


public 
hnsxp_playerdie() 
{
    new 
iVictim read_data)
    new 
attacker read_data)
    new 
headshot read_data)

        
        if( !
attacker || attacker == iVictim )
                return;
        
        
GiveExp(attackerget_pcvar_num(xp_kill_cvar));
        
        
        
UpdateLevel(attacker);
        
UpdateLevel(iVictim);


    if(
headshot)
    { 
        
GiveExp(attackerget_pcvar_num(xp_hs_cvar));

    }

        if(
is_user_vip(attacker))
        {
        
GiveExp(attackerget_pcvar_num(xp_vip_cvar));

        }

}

public 
client_putinserver(id)
{
    
UpdateLevel(id);
}

public 
client_connect(id)

        
LoadData(id);            
}
public 
client_disconnect(id)

        
SaveData(id);
}

public 
SaveData(id)
{
        new 
PlayerName[35];
        
get_user_name(id,PlayerName,34);
       
        new 
vaultkey[64],vaultdata[256];
        
format(vaultkey,63,"%s",PlayerName);
        
format(vaultdata,255,"%i`i%",hnsxp_playerxp[id],hnsxp_playerlevel[id]);
        
nvault_set(g_hnsxp_vault,vaultkey,vaultdata);
        return 
PLUGIN_CONTINUE;
}
public 
LoadData(id)
{
        new 
PlayerName[35];
        
get_user_name(id,PlayerName,34);
       
        new 
vaultkey[64],vaultdata[256];
        
format(vaultkey,63,"%s",PlayerName);
        
format(vaultdata,255,"%i`%i",hnsxp_playerxp[id],hnsxp_playerlevel[id]);
        
nvault_get(g_hnsxp_vault,vaultkey,vaultdata,255);
       
        
replace_all(vaultdata255"`"" ");
       
        new 
playerxp[32], playerlevel[32];
       
        
parse(vaultdataplayerxp31playerlevel31);
       
        
hnsxp_playerxp[id] = str_to_num(playerxp);
        
hnsxp_playerlevel[id] = str_to_num(playerlevel);
       
        return 
PLUGIN_CONTINUE;
}

public 
t_win(id)
{
          new 
TAG[60];
    
get_pcvar_stringlevelmod_prefixTAGcharsmaxTAG ) - );
  
        new 
iPlayer 32 ], iNum;
        
get_players(iPlayeriNum"ae""TERRORIST")
        for ( new 
0iNumi++ ) 
        {
            if(
is_user_alive(iPlayer[i]))
        {
                    
GiveExp(iPlayer ], get_pcvar_num(xp_win_cvar));
                    
ColorChat(iPlayer[i], TEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iXP^1 because your team has win the round !",TAG,get_pcvar_num(xp_win_cvar));
                    
UpdateLevel(iPlayer[i]);
                }
        }
}
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    new 
message[256];
 
    switch(
type)
    {
        case 
NORMAL// clients scr_concolor cvar color
        
{
            
message[0] = 0x01;
        }
        case 
GREEN// Green
        
{
            
message[0] = 0x04;
        }
        default: 
// White, Red, Blue
        
{
            
message[0] = 0x03;
        }
    }
     
    
vformat(message[1], 251msg4);
 
    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[191] = '^0';
 
    new 
teamColorChangeindexMSG_Type;
    if(
id)
    {
        
MSG_Type MSG_ONE;
        
index id;
    } else {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    }

    
team get_user_team(index);
    
ColorChange ColorSelection(indexMSG_Typetype);
 

    
ShowColorMessage(indexMSG_Typemessage);
    if(
ColorChange)
    {
        
Team_Info(indexMSG_TypeTeamName[team]);
    }
}
 
ShowColorMessage(idtypemessage[])
{
    static 
get_user_msgid_saytext;
    if(!
get_user_msgid_saytext)
    {
        
get_user_msgid_saytext get_user_msgid("SayText");
    }
    
message_begin(typeget_user_msgid_saytext_id);
    
write_byte(id)    
    
write_string(message);
    
message_end();    
}
 
Team_Info(idtypeteam[])
{
    static 
bool:teaminfo_used;
    static 
get_user_msgid_teaminfo;
    if(!
teaminfo_used)
    {
        
get_user_msgid_teaminfo get_user_msgid("TeamInfo");
        
teaminfo_used true;
    }
    
message_begin(typeget_user_msgid_teaminfo_id);
    
write_byte(id);
    
write_string(team);
    
message_end();
 
    return 
1;
}
 
ColorSelection(indextypeColor:Type)
{
    switch(
Type)
    {
        case 
RED:
        {
            return 
Team_Info(indextypeTeamName[1]);
        }
        case 
BLUE:
        {
            return 
Team_Info(indextypeTeamName[2]);
        }
        case 
GREY:
        {
            return 
Team_Info(indextypeTeamName[0]);
        }
    }
 
    return 
0;
}
 
FindPlayer()
{
    new 
= -1;
    static 
iMaxPlayers;
    if( !
iMaxPlayers )
    {
        
iMaxPlayers get_maxplayers( );
    }
    while(
<= iMaxPlayers)
    {
        if(
is_user_connected(++i))
            return 
i;
    }
 
    return -
1;


Last edited by swapped; 05-03-2014 at 02:15.
swapped is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 05-02-2014 , 12:04   Re: nvault : when i change name problem
Reply With Quote #2

Save with Steam-ID its much better!
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-03-2014 , 00:17   Re: nvault : when i change name problem
Reply With Quote #3

Quote:
Originally Posted by ironskillz1 View Post
Save with Steam-ID its much better!
I know but, i wanna create a cvar for save type, name - ip - steam, so , solution ?
swapped is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 05-03-2014 , 01:00   Re: nvault : when i change name problem
Reply With Quote #4

Quote:
Originally Posted by swapped View Post
I know but, i wanna create a cvar for save type, name - ip - steam, so , solution ?
See .. Firstly dont support Saving anything by Name/IP here because that only points to the direction of non steam .. MOST OF THE TIMES!
Assuming the positive intentions .. I ll try to solve your issue (I am not really sure it will work or not but worth a try)

First Way :

Only time you load and save data is connect and disconnect..

PHP Code:
public client_connect(id
{  
        
LoadData(id);             

public 
client_disconnect(id
{  
        
SaveData(id); 

Try to consider the client_infochanged() function which is triggered when player changes name..
Save the data instantly and load the data with a set_task for delay see if it works...

Second Way :

Disable Name change atleast it will stop XP loss.

Best Way :
Stick to Steam ID.
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-03-2014 , 01:40   Re: nvault : when i change name problem
Reply With Quote #5

I solve mysfel ...

Code:
public ClientUserInfoChanged( id, szBuffer ) {     if ( !is_user_connected( id ) )         return FMRES_IGNORED;         static szNewName[ 32 ];     new g_szName[ 32 ];     get_user_name(id, g_szName, 31 );         engfunc( EngFunc_InfoKeyValue, szBuffer, "name", szNewName, sizeof ( szNewName ) -1 );         if ( equal( szNewName, g_szName ) )         return FMRES_IGNORED;             hnsxp_playerlevel[ id ] = 0;     hnsxp_playerxp[ id ] = 0;     set_task( 0.10 , "LoadData", id );     set_task( 0.50, "TryFuckUp", id );     return FMRES_IGNORED; } public TryFuckUp( id )     UpdateLevel( id );
swapped is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:22.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode