Bug: The New Connected Player Got the latest players ammo
Fix + Add : How to save ammo (SteamID, IP, Name)
Remove
PHP Code:
public client_authorized(id)
get_user_authid( id, g_szAuthID[id], charsmax(g_szAuthID[]))
Replace
PHP Code:
public client_putinserver(id)
{
load_ap(id)
set_task( 0.1, "hud_info", id, _, _, "b")
}
by
PHP Code:
public client_connect(id){
load_ap(id)
}
public client_putinserver(id)
{
set_task( 0.1, "hud_info", id, _, _, "b")
}
replace line 31 by
PHP Code:
new cvar_human_killed_reward, cvar_zombie_killed_reward, cvar_save_type
before this line
PHP Code:
cvar_zombie_killed_reward = register_cvar( "ap_zombie_killed_reward", "5")
add the following
PHP Code:
cvar_save_type = register_cvar("ap_save_type","3"); // 1- SteamID 2-IP 3-Name
and replace those 2 fuctions
PHP Code:
public save_ap(id)
public load_ap(id)
by
PHP Code:
public save_ap(id)
{
new szAP[7]
new szKey[40]
get_auth(id, g_szAuthID[id], charsmax(g_szAuthID[]))
formatex( szKey, charsmax(szKey), "%sAMMOPACK", g_szAuthID[id])
formatex( szAP, charsmax(szAP), "%d", g_AP[id])
nvault_set( g_Vault, szKey, szAP)
}
public load_ap(id)
{
new szAP[7]
new szKey[40]
get_auth(id, g_szAuthID[id], charsmax(g_szAuthID[]))
formatex( szKey, charsmax(szKey), "%sAMMOPACK", g_szAuthID[id])
formatex( szAP, charsmax(szAP), "%d", g_AP[id])
new iAP = nvault_get( g_Vault, szKey)
if(iAP)
{
g_AP[id] = iAP
nvault_remove( g_Vault, szKey)
}
}
and finaly add stock at the end of file
PHP Code:
stock get_auth(id,data[],len)
switch(get_pcvar_num(cvar_save_type)) {
case 1: get_user_authid(id,data,len);
case 2: get_user_ip(id,data,len,1);
case 3: get_user_name(id,data,len);
}
if i'm somewhere wrong please let me know.. and hope to see that on next updates