strcmp question
#5

The lines
pawn Code:
if( !strcmp( accInfo [ playerid ] [ Password ], inputtext, false ) )
                            return ShowPlayerDialog( playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, etc....
This basically says that if the player types the password correctly, then it'll return that dialog no matter what. I won't treat you like an idiot, because you aren't lol, but strcmp subtracts the two strings' ASCII values and if the strings are the same, then it'll return 0. That is why some lines look like this.
pawn Code:
if(strcmp(string,string2,true) == 0)
So what you would do is this.
pawn Code:
if( strcmp( accInfo [ playerid ] [ Password ], inputtext, false ) != 0 )
                            return ShowPlayerDialog( playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, etc....
So if strcmp subtracts the password's ASCII values with the inputtext's values, if that does not equal 0 then the two strings aren't correct, thus returning the Invalid Password dialog. Hope I helped.

EDIT:

This post explains how strcmp works.
That's how I learned lol
http://forum.sa-mp.com/showpost.php?...28&postcount=1
Reply


Messages In This Thread
strcmp question - by 2KY - 31.03.2012, 15:13
Re: strcmp question - by jotan. - 31.03.2012, 15:15
Re: strcmp question - by 2KY - 31.03.2012, 15:16
Re: strcmp question - by Jochemd - 31.03.2012, 15:17
Re: strcmp question - by ReneG - 31.03.2012, 15:29
Re: strcmp question - by 2KY - 31.03.2012, 15:31
Re: strcmp question - by ReneG - 31.03.2012, 15:38
Re: strcmp question - by 2KY - 31.03.2012, 15:40
Re: strcmp question - by ReneG - 31.03.2012, 15:45
Re: strcmp question - by 2KY - 31.03.2012, 16:02
Re: strcmp question - by mprofitt - 07.05.2012, 20:13

Forum Jump:


Users browsing this thread: 1 Guest(s)