Raised This Month: $ Target: $400
 0% 

STEAMID saving to name saving


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
Change377
Junior Member
Join Date: Aug 2010
Old 07-23-2011 , 07:47   STEAMID saving to name saving
#1

Hey,
I edited plugin (deathrun shop). Points have been saving by authid, and i wanted saving by name. Original functions (save and load points):

PHP Code:
stock save_client_pointsindex )
{
    
/* --| Open the vault file */
    
gVault nvault_open"DeathrunShop_SavedPoints" );
    
    
/* --| If vault return -1, lets stop this shit */
    
if( gVault == INVALID_HANDLE )
    {
        
set_fail_state"[DrShop] nValut ERROR: =-> Invalid-Handle" );
    }
    
    
/* --| Get the player steamid */
    
get_user_authidindexgSteamIDcharsmaxgSteamID ) );
    
    
/* --| Setting stuff on vault file, and close the file */
    
formatexvKeycharsmaxvKey ), "%sPOINTS"gSteamID );
    
formatexvDatacharsmaxvData ), "%d"gKillerPointsindex ] );
    
nvault_setgVaultvKeyvData );
    
nvault_closegVault );
}

/* --| Loading client points */
stock load_client_pointsindex )
{
    
/* --| Open the vault file */
    
gVault nvault_open"DeathrunShop_SavedPoints" );
    
    
/* --| If vault return -1, lets stop this shit */
    
if( gVault == INVALID_HANDLE )
    {
        
set_fail_state"[DrShop] nValut ERROR: =-> Invalid-Handle" );
    }
    
    
/* --| Get the player steamid */
    
get_user_authidindexgSteamIDcharsmaxgSteamID ) );
    
    
/* --| Get the player points, then, close the nvault vile */
    
formatexvKeycharsmaxvKey ), "%sPOINTS"gSteamID );
    
gKillerPointsindex ] = nvault_getgVaultvKey );
    
nvault_closegVault );

and edited functions:
PHP Code:
stock save_client_pointsindex )
{
    
/* --| Open the vault file */
    
gVault nvault_open"DeathrunShop_SavedPoints" );
    
    
/* --| If vault return -1, lets stop this shit */
    
if( gVault == INVALID_HANDLE )
    {
        
set_fail_state"[DrShop] nValut ERROR: =-> Invalid-Handle" );
    }
    
    
/* --| Get the player steamid */
    
get_user_name(indexnamepointscharsmax(namepoints));
    
    
/* --| Setting stuff on vault file, and close the file */
    
formatexvKeycharsmaxvKey ), "%sPOINTS"namepoints);
    
formatexvDatacharsmaxvData ), "%d"gKillerPointsindex ] );
    
nvault_setgVaultvKeyvData );
    
nvault_closegVault );
}

/* --| Loading client points */
stock load_client_pointsindex )
{
    
/* --| Open the vault file */
    
gVault nvault_open"DeathrunShop_SavedPoints" );
    
    
/* --| If vault return -1, lets stop this shit */
    
if( gVault == INVALID_HANDLE )
    {
        
set_fail_state"[DrShop] nValut ERROR: =-> Invalid-Handle" );
    }
    
    
    
/* --| Get the player steamid */
    
get_user_name(indexnamepointscharsmax(namepoints));
    
    
/* --| Get the player points, then, close the nvault vile */
    
formatexvKeycharsmaxvKey ), "%sPOINTS"namepoints );
    
gKillerPointsindex ] = nvault_getgVaultvKey );
    
nvault_closegVault );

No errors/warnings, but saving is still by authid (after server restart, changing map etc, I can disconnect, change my name and reconnect, and my points have still the same value. Whats wrong?
Thanks

Last edited by Change377; 07-23-2011 at 09:47.
Change377 is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-23-2011 , 09:33   Re: STEAMID saving to name saving
#2

That code looks too complicated to me(not cuz its messy, cuz i suck at knowing amx scripting functions), but i think saving by name will be a bit problematic, since ppl change their names. SteamID would be the best, the only place it wouldnt be good for is NonSteam servers.
Diegorkable is offline
Change377
Junior Member
Join Date: Aug 2010
Old 07-23-2011 , 09:46   Re: STEAMID saving to name saving
#3

Yeah, but I just prefer saving by nick, and please about correcting my code, not to recommend better option to choose I know that ppl change their names, and it's ok, no problem. So what can I change to make this code working?
Change377 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-23-2011 , 16:07   Re: STEAMID saving to name saving
#4

Just use SteamID.

P.S. You probably didn't compile it successfully or didn't replace the original .amxx.
__________________

Last edited by fysiks; 07-23-2011 at 16:09.
fysiks is offline
Honors
Member
Join Date: Jul 2011
Old 07-23-2011 , 17:20   Re: STEAMID saving to name saving
#5

Why using saving by name instead of SteamID ?!

No-Steam user ?!
Honors is offline
Change377
Junior Member
Join Date: Aug 2010
Old 07-23-2011 , 19:53   Re: STEAMID saving to name saving
#6

Unfortunately I compiled and replaced original .amxx - I just compiled - new plugin has different name, so I couldn't to not replaced the original .amxx. Is this code correct? Should it work? Without deleting vault file? I think it should create new lines in file and work correctly, but it doesn't..

Why I want by name? Because I have some other plugins which save things by name and I'd like this to be saving by name too.
Change377 is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-23-2011 , 19:56   Re: STEAMID saving to name saving
#7

Well I bet its because something that involves NonSteam but that's really ok, still you could use steamids and then translate them to names for a putout or anything else if needed. Sorry if I make you mad for posting with not helping but these functions are way ahead of me and i don't know them, good luck getting it set.
Diegorkable is offline
Closed Thread



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 01:09.


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