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

Solved help player data


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tepegoz
Senior Member
Join Date: Apr 2019
Old 01-19-2020 , 06:26   help player data
Reply With Quote #1

I want if player's kramponcinsi[id] = 6 , they will get player model but I could not . It is not loading. Can you fix?


PHP Code:
case 6: { 
//****
                
kramponcinsi[id] = 6
            SavePlayerExp
(id)
//*****
    
}
public 
SavePlayerExp(id)
{
    new 
kramponu
    
if(!is_user_connected(id))
        return 
PLUGIN_HANDLED;
        
    
nameVault nvault_open(VAULTNAMEEXP);        

    new 
playername[33];
    
get_user_name(idplayername33);

    new 
vaultkey[64], vaultdata[64];    
    
kramponu =  kramponcinsi[id
    
format(vaultkey63"^"%s^""playername);
    
format(vaultdata63"%i"kramponu)
    
nvault_set(nameVaultvaultkeyvaultdata);
    
    
nvault_close(nameVault);

    return 
PLUGIN_CONTINUE;
}

public 
LoadPlayerExp(id)
{
    new 
kramponu
    nameVault 
nvault_open(VAULTNAMEEXP);
        
    if(!
is_user_connected(id))
        return 
PLUGIN_HANDLED;

    new 
playername[33];
    
get_user_name(idplayername33);

    new 
vaultkey[64], vaultdata[64], timestamp

    
    format
(vaultkey63"^"%s^""playername);
    
nvault_lookup(nameVaultvaultkeyvaultdata1500timestamp)
    
    
kramponcinsi[id] = kramponu 
    
    ColorChat
(idRED"number: %i"kramponu)
    
    if( 
kramponu == 6) {
    
    
    
g_realadminmarkEnt[id] = create_entity("info_target")
    
entity_set_int(g_realadminmarkEnt[id], EV_INT_movetypeMOVETYPE_FOLLOW)
    
entity_set_edict(g_realadminmarkEnt[id], EV_ENT_aimentid)
    
entity_set_model(g_realadminmarkEnt[id], MODEL_MARK6)    
    }
        
    
nvault_close(nameVault);    
    return 
PLUGIN_CONTINUE;
}

public 
client_connect(id)
{
    
kramponcinsi[id] = 0
    set_task
(5.0"LoadPlayerExp" id

Last edited by tepegoz; 07-13-2020 at 11:02.
tepegoz is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-19-2020 , 06:54   Re: help remember player data
Reply With Quote #2

So much reduntant code for such a simple task.

First of all, open the vault in "plugin_init" and close it in "plugin_end", instead of doing it every time a player enters/leaves.

Saving - in "client_disconnect":

Code:
new szName[32], szModel[3] get_user_name(id, szName, charsmax(szName)) num_to_str(kramponcinsi[id], szModel, charsmax(szModel)) nvault_set(nameVault, szName, szModel)

Loading - in "client_connect" (no task required):

Code:
new szName[32], szModel[3] get_user_name(id, szName, charsmax(szName)) if(nvault_get(nameVault, szName, szModel, charsmax(szModel)) {     kramponcinsi[id] = str_to_num(szModel) } else {     kramponcinsi[id] = 0 }
__________________

Last edited by OciXCrom; 01-19-2020 at 06:55.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
tepegoz
Senior Member
Join Date: Apr 2019
Old 01-19-2020 , 09:24   Re: help remember player data
Reply With Quote #3

thanks
tepegoz 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 05:33.


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