strlen inputtext help
#1

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
Reply
#2

You cannot use the '==' operator to compare strings. Use strcmp instead
Reply
#3

How can I do that
Reply
#4

myname needs to be a string.
pawn Код:
new myname[MAX_PLAYER_NAME] = GetPlayerNameEx(playerid);

if(!strcmp(inputtext, myname))
{
    // inputtext matches myname
}
Reply
#5

'error 008: must be a constant expression; assumed zero'

Line:
new myname[MAX_PLAYER_NAME] = GetPlayerNameEx(playerid);
Reply
#6

Delete the whole myname variable, and use GetPlayerNameEx in the if() statement.
pawn Код:
if(!strcmp(inputtext, GetPlayerNameEx(playerid)))
{

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)