View Single Post
MrMoHanD
Junior Member
Join Date: Mar 2016
Old 03-21-2016 , 17:09   Re: [BB] Addon: Ammo-Pack System v2.0 [API Shop, nVault Saving, AP Rewards and more!]
Reply With Quote #7

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_authididg_szAuthID[id], charsmax(g_szAuthID[])) 
Replace
PHP Code:
public client_putinserver(id)
{
    
load_ap(id)
    
set_task0.1"hud_info"id__"b")

by
PHP Code:
public client_connect(id){
    
load_ap(id)
}
public 
client_putinserver(id)
{
    
set_task0.1"hud_info"id__"b")

replace line 31 by
PHP Code:
new cvar_human_killed_rewardcvar_zombie_killed_rewardcvar_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(idg_szAuthID[id], charsmax(g_szAuthID[]))
    
formatexszKeycharsmax(szKey), "%sAMMOPACK"g_szAuthID[id])
    
formatexszAPcharsmax(szAP), "%d"g_AP[id])
    
    
nvault_setg_VaultszKeyszAP)
}


public 
load_ap(id)
{
    new 
szAP[7]
    new 
szKey[40]
    
get_auth(idg_szAuthID[id], charsmax(g_szAuthID[]))
    
formatexszKeycharsmax(szKey), "%sAMMOPACK"g_szAuthID[id])
    
formatexszAPcharsmax(szAP), "%d"g_AP[id])
    new 
iAP nvault_getg_VaultszKey)
    if(
iAP)
    {
        
g_AP[id] = iAP
        nvault_remove
g_VaultszKey)
    }

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 
1get_user_authid(id,data,len);
        case 
2get_user_ip(id,data,len,1);
        case 
3get_user_name(id,data,len);

if i'm somewhere wrong please let me know.. and hope to see that on next updates

Last edited by MrMoHanD; 03-26-2016 at 18:40.
MrMoHanD is offline