strlen inputtext help - 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: strlen inputtext help (
/showthread.php?tid=389892)
strlen inputtext help -
mSlat3r - 03.11.2012
I have this:
pawn Код:
new myname = GetPlayerNameEx(playerid);
if(strlen(inputtext) == myname)
{
error:
error 033: array must be indexed (variable "-unknown-")
on line:
new myname = GetPlayerNameEx(playerid);
Any help on 'dis
Re: strlen inputtext help -
Jakku - 03.11.2012
You cannot use the '==' operator to compare strings. Use strcmp instead
Re: strlen inputtext help -
mSlat3r - 04.11.2012
How can I do that
Re: strlen inputtext help -
ReneG - 04.11.2012
myname needs to be a string.
pawn Код:
new myname[MAX_PLAYER_NAME] = GetPlayerNameEx(playerid);
if(!strcmp(inputtext, myname))
{
// inputtext matches myname
}
Re: strlen inputtext help -
mSlat3r - 04.11.2012
'error 008: must be a constant expression; assumed zero'
Line:
new myname[MAX_PLAYER_NAME] = GetPlayerNameEx(playerid);
Re: strlen inputtext help -
ReneG - 04.11.2012
Delete the whole myname variable, and use GetPlayerNameEx in the if() statement.
pawn Код:
if(!strcmp(inputtext, GetPlayerNameEx(playerid)))
{
}