AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help (https://forums.alliedmods.net/showthread.php?t=184442)

Artifact 05-05-2012 10:07

help
 
How to catch if is password removed??
PHP Code:

    new pass[32]
    if(
get_cvar_string("sv_password"passcharsmax(pass)) == "")
        return 
PLUGIN_HANDLED 

Code:

Error: Array must be indexed (variable "-unknown-") on line 55

Liverwiz 05-05-2012 10:27

Re: help
 
remove "charsmax(pass)" and just put 31

Artifact 05-05-2012 10:41

Re: help
 
Anyone else?

GordonFreeman (RU) 05-05-2012 10:51

Re: help
 
Code:
new pass[32] get_cvar_string("sv_password", pass, charsmax(pass)) if(!pass[0])        return PLUGIN_HANDLED

Artifact 05-05-2012 11:49

Re: help
 
Work, thanks ;)

<VeCo> 05-05-2012 12:01

Re: help
 
You should also trim the password string, because the password can be " pass", but the code will check only the first character which is empty and it will return wrong result.

Liverwiz 05-05-2012 12:14

Re: help
 
Quote:

Originally Posted by <VeCo> (Post 1702678)
You should also trim the password string, because the password can be " pass", but the code will check only the first character which is empty and it will return wrong result.

#include <core>
Code:

if(strlen(pass) == 0)    return PLUGIN_HANDLED

Artifact 05-05-2012 13:22

Re: help
 
Thanks a lot guys ;)

fysiks 05-06-2012 03:55

Re: help
 
Quote:

Originally Posted by Liverwiz (Post 1702616)
remove "charsmax(pass)" and just put 31

Really? You should NOT hardcode the array size and SHOULD use charsmax(). This is why you should start testing any code/changes you suggest.

EpicMonkey 05-06-2012 04:36

Re: help
 
Quote:

Originally Posted by fysiks (Post 1703222)
Really? You should NOT hardcode the array size and SHOULD use charsmax(). This is why you should start testing any code/changes you suggest.

i seriously dont understand why they dont test their codes b4 posting ... , and changing charsmax to 31 .... is simply retarded ... :3


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

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