Raised This Month: $ Target: $400
 0% 

Block keeps getting called.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 10-28-2021 , 17:17   Re: Block keeps getting called.
Reply With Quote #1

Quote:
Originally Posted by Shadows Adi View Post
http://www.amxmodx.org/api/nvault/nvault_get

Code:
Return Result as integer if only the first two arguments of the function are used. 1 if only the first three arguments are used. String length if all four parameters are used.
However, my first example should return a string, as explained in the wiki.

Code:
nvault_get(vaultHandle, "myKey", myString, charsmax(myString));
Quote:
Originally Posted by Natsheh View Post
Then change the key to save by name instead of steamid if you desire to give points per name.

And about the explanation you can just do debugging and see what'sthe outputs.
Yea you're right, i'll just save by name, lmao my brain these days.
__________________

Last edited by Napoleon_be; 10-28-2021 at 17:21.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 10-28-2021 , 17:37   Re: Block keeps getting called.
Reply With Quote #2

Quote:
Originally Posted by Napoleon_be View Post
However, my first example should return a string, as explained in the wiki.

Code:
nvault_get(vaultHandle, "myKey", myString, charsmax(myString));
No, in return you will get the string lenght, string is copied into the parameter passed.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 10-28-2021 at 17:37.
Shadows Adi is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 10-28-2021 , 18:07   Re: Block keeps getting called.
Reply With Quote #3

Quote:
Originally Posted by Shadows Adi View Post
No, in return you will get the string lenght, string is copied into the parameter passed.
You're right.

From what i've heard of the tester, this version should work.

PHP Code:
public GetFreePoints(id)
{
    new 
szName[MAX_NAME_LENGTH], szResult[MAX_NAME_LENGTH];
    
get_user_name(idszNamecharsmax(szName));

    
log_amx("DEBUG: Player current name: %s"szName);

    if(
nvault_get(g_iVaultHandleszNameszResultcharsmax(szResult)))
    {
        
log_amx("DEBUG: Player name was already found: %s"szResult);
        return 
PLUGIN_HANDLED;
    }

    
log_amx("DEBUG: Player name not found in nvault: %s, xp granted."szName);

    
nvault_set(g_iVaultHandleszNameszName);

    
hnsxp_add_user_xp(idget_pcvar_num(g_pPointsAmount));

    
CC_SendMessage(id"You succesfully received &x03%i &x04XP&x01."get_pcvar_num(g_pPointsAmount));

    return 
PLUGIN_HANDLED;

If anyone has suggestions on how to do it "better", always welcome.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 11:29.


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