Raised This Month: $51 Target: $400
 12% 

Auto Save Ammopack


Post New Thread Reply   
 
Thread Tools Display Modes
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 06-28-2010 , 11:07   Re: Auto Save Ammopack
Reply With Quote #11

Quote:
Originally Posted by AfteR. View Post
yes.

If your server crashes, you will lose data. Fixed:

PHP Code:
#include <amxmodx>
#include <fvault>
#include <fakemeta>
#include <zombieplague>

new const g_vault_name[] = "ammopacks";

new 
maxplayers

public plugin_init()
{
    
register_plugin("[ZP] AP Save (Fixed)" "1.1" "AfteR. / Vechta")
    
    
register_forward(FM_Sys_Error"fw_ServerDown")
    
register_forward(FM_GameShutdown"fw_ServerDown")
    
register_forward(FM_ServerDeactivate"fw_ServerDown")
    
    
maxplayers get_maxplayers()
    
}

public 
client_putinserver(id)
{
    if( !
is_user_hltv(id) && !is_user_bot(id) )
    {
        
Load(id);
    }
}

public 
client_disconnect(id)
{
    
Save(id)
}

public 
Load(id)
{
    new 
name[32];
    
get_user_name(idnamesizeof(name) - 1);
    
    new 
data[16];
    if( 
fvault_get_data(g_vault_namenamedatasizeof(data) - 1) )
    {
        
zp_set_user_ammo_packs(idstr_to_num(data))
    }
    else
    {
        
zp_set_user_ammo_packs(id5// Modify here for default ammopacks.
    
}    
}

public 
Save(id)
{
    new 
name[32];
    
get_user_name(idnamesizeof(name) - 1);
    
    new 
data[16];
    
num_to_str(zp_get_user_ammo_packs(id), datasizeof(data) - 1);
    
    
fvault_set_data(g_vault_namenamedata);
}

public 
fw_ServerDown()
{
    for(new 
1<= maxplayersi++)
        
Save(i)

nice =) It's good for me bcz my server crashes sometimes
Empowers is offline
Send a message via ICQ to Empowers
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 06-28-2010 , 11:23   Re: Auto Save Ammopack
Reply With Quote #12

BOTH PLUGINS DOESN'T SAVE AMMOPACKS ON MAPCHANGE. HELP PLEASE
Empowers is offline
Send a message via ICQ to Empowers
Old 06-28-2010, 12:14
NiHiLaNTh
This message has been deleted by NiHiLaNTh. Reason: Shit happens!
Old 06-28-2010, 12:18
NiHiLaNTh
This message has been deleted by NiHiLaNTh. Reason: Lag!
noleader
Member
Join Date: Jan 2009
Old 06-29-2010 , 03:13   Re: Auto Save Ammopack
Reply With Quote #13

Bcz you need to set in zombieplague.cfg zp_starting_ammo_packs 0 and it should work.
__________________
www.frageris.lt | Fragers website

Last edited by noleader; 06-29-2010 at 03:16.
noleader is offline
Reply



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 20:28.


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