SA-MP Forums Archive
GetPlayerName Array must be indexed error - 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: GetPlayerName Array must be indexed error (/showthread.php?tid=428675)



GetPlayerName Array must be indexed error - Tamer - 06.04.2013

pawn Код:
new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    if(playername == "NameHere")
    {
    Variable[playerid] = 1;
    }
error 033: array must be indexed (variable "playername")


Re: GetPlayerName Array must be indexed error - Tamer - 06.04.2013

Sorry,I never had compared strings before so I don't know how to.


Re: GetPlayerName Array must be indexed error - Niko_boy - 06.04.2013

use strcmp function to do so
https://sampwiki.blast.hk/wiki/Strcmp
Код:
if(!strcmp(playerName,"NameHere"))// case senstiive 
{
//means they both match, can be here too when one of those string are empty
}



Re: GetPlayerName Array must be indexed error - zxc1 - 06.04.2013

Try reading this: https://sampwiki.blast.hk/wiki/Strcmp.