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

nVault weird saving


Post New Thread Reply   
 
Thread Tools Display Modes
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-25-2020 , 14:18   Re: nVault weird saving
Reply With Quote #11

Players can change name in game - did you account for that?

Also, I still don't get the point of "%s-/". What's the problem with using only the name as a key?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-25-2020 , 22:13   Re: nVault weird saving
Reply With Quote #12

Use Steam ID to save player data, always.

PHP Code:

#include <amxmodx>
#include <nvault_array>

enum _:enData
{
    
Data,
    
Kills,
    
Deaths,
    
Shots,
    
Damage,
    
Hits,
    
Rank,
    
Skill,
    
PlayerName[MAX_NAME_LENGTH],
    
SteamID[MAX_AUTHID_LENGTH]
}

new 
iVault;
new 
iDataMAX_PLAYERS ][ enData ];

public 
plugin_init()
{

}

public 
plugin_cfg()
{
    
iVault nvault_open("Mission_VAULT");
}

public 
plugin_end()
{
    
nvault_closeiVault );
}

public 
client_authorizedid )
{
    
get_user_authidid iDataid ][ SteamID ] , charsmaxiData[][ SteamID ] ) );
    
get_user_nameid iDataid ][ PlayerName ] , charsmaxiData[][ PlayerName ] ) );
    
    
LoadDataid );
}

public 
client_disconnectedid )
{
    
SaveDataid );
}

public 
exampleid )
{
    
iDataid ][ Kills ]++;
}

public 
SaveDataid )
{
    
nvault_set_arrayiVault iDataid ][ SteamID ], iDataid ][ enData:], sizeofiData[] ) );
}

public 
LoadDataid )
{
    
nvault_get_arrayiVault iDataid ][ SteamID ] , iDataid ][ enData:] , sizeofiData[] ));

__________________

Last edited by Bugsy; 03-25-2020 at 22:24.
Bugsy is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-26-2020 , 06:50   Re: nVault weird saving
Reply With Quote #13

Quote:
Originally Posted by OciXCrom View Post
Players can change name in game - did you account for that?

Also, I still don't get the point of "%s-/". What's the problem with using only the name as a key?
I use "%s-/" beacause I like this save ) and is easier to find a players data.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-26-2020 , 08:01   Re: nVault weird saving
Reply With Quote #14

You're just adding -/ to the player's name for no reason. How is this better than searching just for the player's name?
Did you account for what happens when a player actually has -/ in their name? This is what will break the plugin because it won't replace the -/ in the end of the name, but the first one it finds inside it.
__________________

Last edited by OciXCrom; 03-26-2020 at 08:02.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-26-2020 , 09:38   Re: nVault weird saving
Reply With Quote #15

It makes no sense to use player name since this can change at any time, resulting in your plugin losing the link between a player and their data in the vault. Use Steam ID
__________________
Bugsy is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-26-2020 , 15:03   Re: nVault weird saving
Reply With Quote #16

Quote:
Originally Posted by Bugsy View Post
It makes no sense to use player name since this can change at any time, resulting in your plugin losing the link between a player and their data in the vault. Use Steam ID
That's the point, other name = other data, to keep player evidence.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-26-2020 , 16:28   Re: nVault weird saving
Reply With Quote #17

That makes no sense, but it's your server do what you want. Not sure what 'to keep player evidence' means.
__________________
Bugsy is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-27-2020 , 15:47   Re: nVault weird saving
Reply With Quote #18

Quote:
Originally Posted by Bugsy View Post
That makes no sense, but it's your server do what you want. Not sure what 'to keep player evidence' means.
With 'keep player evidence', I mean if the player changes the name, he will have other statistics.
new name = new statistics.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi 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 16:33.


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