SA-MP Forums Archive
strcmp not working? properly? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: strcmp not working? properly? (/showthread.php?tid=460872)



strcmp not working? properly? - [WSF]ThA_Devil - 30.08.2013

Hello, I've have this problem, If I input password, and if it's part is right it allows it trough
Code:
pawn Код:
if(!strcmp(inputtext,Field,false,strlen(Field)))
the thing is: if in database there is pass, and player types in password he will get in the server.


Re: strcmp not working? properly? - Konstantinos - 30.08.2013

Just change to:
pawn Код:
if(!strcmp(inputtext,Field,false))
You use the lenght of the password. Let's say, you type "password", it will check the lenght of the Field which is "pass".


Re: strcmp not working? properly? - [WSF]ThA_Devil - 30.08.2013

So basicly I am checking "empty" string?


Re: strcmp not working? properly? - Konstantinos - 30.08.2013

You used for max lenght the lenght of "pass" (Field). If you input "password", it will only check for the first 4 characters. Removing the lenght since it's optional will fix it. Oh and by the way, be sure you check that the strings are not null. They returns false as well.