View Single Post
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-25-2020 , 12:50   Re: nVault weird saving
Reply With Quote #6

PHP Code:
enum _:enData
{
    
Data,
    
Kills,
    
Deaths,
    
Shots,
    
Damage,
    
Hits,
    
Rank,
    
Skill
    PlayerName
[MAX_NAME_LENGTH],
}
new 
szVault
new GetAuth[MAX_PLAYERS 1][MAX_AUTHID_LENGTH]
new 
iData[MAX_PLAYERS 1][enData]

public 
plugin_init()
{
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")
}

public 
plugin_cfg()
{
    
szVault nvault_open("Mission_VAULT")
}

public 
plugin_end()
{
    
nvault_close(szVault)
}

public 
ClientUserInfoChanged(id)
{
    new 
szOldName[MAX_PLAYERS]
    
get_user_name(idszOldNamecharsmax(szOldName))

    if(
szOldName[0])
    {                   
        new 
szNewName[MAX_PLAYERS]
        
get_user_info(id"name"szNewNamecharsmax(szNewName))

        
set_user_info(id"name"szNewName)

        
copy(iData[id][PlayerName], charsmax(iData[]), szNewName)
        
SaveData(id)
    }
    
    return 
FMRES_SUPERCEDE
}

public 
client_authorized(id, const authid[])
{
    
get_user_authid(idGetAuth[id], MAX_AUTHID_LENGTH 1)
    
get_user_name(idiData[id][PlayerName], MAX_NAME_LENGTH 1)
    
LoadData(id)
}

public 
client_disconnected(id)
{
    
SaveData(id)
}

public 
example(id)
{
    
iData[id][Kills]++
}

public 
SaveData(const index)
{
    
nvault_set_array(szVault GetAuth[index], iDataindex ][enData:0], sizeofiData[] ) )
}

public 
LoadData(const index)
{
    
nvault_get_arrayszVault GetAuth[index] , iDataindex ][enData:0] , sizeofiData[] ))

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 03-25-2020 at 13:56.
iceeedr is offline
Send a message via Skype™ to iceeedr