Raised This Month: $ Target: $400
 0% 

[HELP] Save Model Permanent


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
DavidJr
Senior Member
Join Date: Apr 2012
Old 03-19-2014 , 06:40   Re: [HELP] Save Model Permanent
Reply With Quote #2

Just an example to save and load your weapon. I use fvault

PHP Code:
new const VAULT_NAME[] = "cs_weapon";

new 
gAwp[33];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
}

public 
client_authorized(iIndex)
{
    if (!
is_user_hltv(iIndex) && !is_user_bot(iIndex)) LoadData(iIndex);
}

public 
client_disconnect(iIndex)
{
    
SaveData(iIndex);
}

LoadData(iIndex)
{
    new 
szAuthId[35];
    
get_user_authid(iIndexszAuthIdsizeof szAuthId);
    
    new 
szWpnKey[33];
    
format(szWpnKeysizeof szWpnKey"%s_Wpn"szAuthId);
    
    new 
szWpn[25];
    
fvault_get_data(VAULT_NAMEszWpnKeyszWpnsizeof szWpn);
    
    
gAwp[iIndex] = str_to_num(szWpn);
}

SaveData(iIndex)
{
    new 
szAuthId[35];
    
get_user_authid(iIndexszAuthIdsizeof(szAuthId));
    
    new 
szWpnKey[33];
    
format(szWpnKeysizeof szWpnKey"%s_Wpn"szAuthId);
    
    new 
szWpn[25];
    
num_to_str(gAwp[iIndex], szWpnsizeof szWpn);
    
    
fvault_set_data(VAULT_NAMEszWpnKeyszWpn);

__________________
What are you looking for here?

Last edited by DavidJr; 03-19-2014 at 06:40.
DavidJr is offline
 



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 05:54.


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