[Help] Comparing strings (strcmp) - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Comparing strings (strcmp) (
/showthread.php?tid=165065)
[Help] Comparing strings (strcmp) -
Maxips2 - 03.08.2010
I did it like that:
pawn Код:
if(!strcmp(inputtext, gServerPassword))
{
SCM(playerid, COLOR_LIGHTRED, "Wrong password!");
Kick(playerid);
return 1;
}
But I'm getting this error:
pawn Код:
error 035: argument type mismatch (argument 2)
Any ideas?
Re: [Help] Comparing strings (strcmp) -
iggy1 - 03.08.2010
maybe something to do with "gServerPassword" is it an array, does it hold a string? Also it looks like your comparing two passwords and if they are the same kicking them lol.
I think you want,
pawn Код:
if(strcmp(inputtext, gServerPassword))
Re: [Help] Comparing strings (strcmp) -
Zimon95 - 03.08.2010
Try this, it should work, by the way you have to assign a string to that variable:
pawn Код:
if(strcmp(inputtext,gServerPassword,false))
{
SCM(playerid, COLOR_LIGHTRED, "Wrong password!");
Kick(playerid);
return 1;
}