Raised This Month: $ Target: $400
 0% 

If (nvault key exist)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 08-07-2010 , 03:44   If (nvault key exist)
Reply With Quote #1

Hello guys,

I already tried:

PHP Code:
f(nvault_get(vaultkey) == 0
but that dont seems to work
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
tm.
Member
Join Date: Apr 2010
Old 08-07-2010 , 05:17   Re: If (nvault key exist)
Reply With Quote #2

Code:
new Find = nvault_get(vault, key) if(!Find) {     ....
tm. is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-07-2010 , 07:28   Re: If (nvault key exist)
Reply With Quote #3

Both of those codes do exactly the same thing. What type of value is stored in the key? string, float, integer?
__________________
Bugsy is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 08-07-2010 , 10:13   Re: If (nvault key exist)
Reply With Quote #4

Bugsy thts how i save:

the thing is, the player can set a username & password.
When the username is already taken the plugin shoud stop the register and send a message "Invalid Username". But i can take the name "mottzi" many times.

PHP Code:
public cmdnewname(id)
{
    
read_args(name[id], 99)
    
remove_quotes(name[id])
    
    if(
nvault_get(n_vaultname[id]) == && containi(name[id], " ") == -1)
    {
        
client_cmd(id"messagemode _newpassword")
    }
    if(
nvault_get(n_vaultname[id]) != 0)
    {
        
client_cmd(id"messagemode _newname")
        
client_print(idprint_chat"[Login] Invalid Username!")
    }
}

public 
cmdnewpassword(id)
{
    
read_args(password[id], 99)
    
remove_quotes(password[id])
    
    if(
containi(password[id], " ") == -1)
    {
        
nvault_set(n_vaultname[id], password[id])
        
client_print(idprint_chat"[Login] You createt a new Account! Username: %s  Password: %s"name[id], password[id])
    }

__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers

Last edited by mottzi; 08-07-2010 at 10:46.
mottzi is offline
Send a message via MSN to mottzi
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 08-07-2010 , 10:29   Re: If (nvault key exist)
Reply With Quote #5

Use nvault_lookup != 0
Seta00 is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 08-07-2010 , 10:45   Re: If (nvault key exist)
Reply With Quote #6

wow -.- worked. Thank you. Can you tell me why my version didnt work, i wanna learn u know.
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-07-2010 , 12:00   Re: If (nvault key exist)
Reply With Quote #7

try this, untested.

PHP Code:
new szPw99 ];
if ( !
nvault_getn_vault nameid ] , szPw charsmaxszPw ) ) )
{


Take a look at the nvault tutorial.
__________________

Last edited by Bugsy; 08-07-2010 at 12:06.
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 00:17.


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