AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   If (nvault key exist) (https://forums.alliedmods.net/showthread.php?t=134610)

mottzi 08-07-2010 03:44

If (nvault key exist)
 
Hello guys,

I already tried:

PHP Code:

f(nvault_get(vaultkey) == 0

but that dont seems to work

tm. 08-07-2010 05:17

Re: If (nvault key exist)
 
Code:
new Find = nvault_get(vault, key) if(!Find) {     ....

Bugsy 08-07-2010 07:28

Re: If (nvault key exist)
 
Both of those codes do exactly the same thing. What type of value is stored in the key? string, float, integer?

mottzi 08-07-2010 10:13

Re: If (nvault key exist)
 
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])
    }



Seta00 08-07-2010 10:29

Re: If (nvault key exist)
 
Use nvault_lookup != 0

mottzi 08-07-2010 10:45

Re: If (nvault key exist)
 
wow -.- worked. Thank you. Can you tell me why my version didnt work, i wanna learn u know.

Bugsy 08-07-2010 12:00

Re: If (nvault key exist)
 
try this, untested.

PHP Code:

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



Take a look at the nvault tutorial.


All times are GMT -4. The time now is 00:17.

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