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

Block keeps getting called.


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-29-2021 , 23:56   Re: Block keeps getting called.
Reply With Quote #11

PHP Code:
public GetFreePointsid )
{
    new 
szSavedName32 ] , szCurrentName32 ] , szAuth35 ] , iTS iVaultExists;
    
    
get_user_authidid szAuth charsmaxszAuth ) );
    
    
iVaultExists nvault_lookupg_iVaultHandle szAuth szSavedName charsmaxszSavedName ) , iTS );
    
get_user_nameid szCurrentName charsmaxszCurrentName ) );
    
    
//Assuming a player who is not in the vault yet is eligible. 
    // - If players not in the vault are not eligible, remove the !iVaultExists condition.
    
if ( !iVaultExists || ( iVaultExists && !equalszSavedName szCurrentName ) ) )
    {
        
hnsxp_add_user_xp(idget_pcvar_num(g_pPointsAmount));
        
nvault_setg_iVaultHandle szAuth szCurrentName );
        
CC_SendMessage(id"You succesfully received &x03%i &x04XP&x01."get_pcvar_num(g_pPointsAmount));
    }

__________________
Bugsy is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 10-30-2021 , 00:04   Re: Block keeps getting called.
Reply With Quote #12

Thanks Bugsy, that was my first intention, does it really matter if i use either "lookup" or "get"? I don't really see the timestamp having any use here.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-30-2021 , 00:15   Re: Block keeps getting called.
Reply With Quote #13

If there is guaranteed to always be a value for the string key in your plugin/vault, then no. If there's a possibility for a key with an empty string value, then you must use lookup.

nvault_get( vault , key , data , len ) would return:

6 - ["key1"] ["value1"]
0 - ["key1"] [""]
0 - (key does not exist at all)
__________________
Bugsy 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 22:58.


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