SA-MP Forums Archive
expected token: "-string end-", but found "-identifier-" - 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: expected token: "-string end-", but found "-identifier-" (/showthread.php?tid=499411)



expected token: "-string end-", but found "-identifier-" - Aerotactics - 08.03.2014

Код:
C:\Users\Aerotactics' PC\Desktop\ALSRP\filterscripts\adminsystemv1.pwn(469) : error 001: expected token: "-string end-", but found "-identifier-"
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (PlayerInfo[playerid][pBeta]==1)
    {
        if (cmdtext == "/goto" || "/sethunger" || "/bsay" || "/setthirst" || "/startround" || "/endround" || "/setbeta")
        { //^that line
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid,pname,sizeof(pname));
            for (new i=0;i<MAX_PLAYERS;i++)
            {
                if (PlayerInfo[i][pBeta]>1)
                {
                    new string[128];
                    format(string,sizeof(string),"[Trial Tester]%s sent a command: %s",pname,cmdtext);
                    SendClientMessage(i,COLOR_CYAN,string);
                    return 1;
                }
            }
        }
    }
    return 0;
}



Re: expected token: "-string end-", but found "-identifier-" - ]Rafaellos[ - 08.03.2014

Check @ Haydz post.


Re: expected token: "-string end-", but found "-identifier-" - Haydz - 08.03.2014

You can't match strings like that in PAWN, this way looks ugly but it should work

pawn Код:
if(strcmp("/goto", cmdtext, true, 10) == 0 || strcmp("/sethunger", cmdtext, true, 10) == 0 || strcmp("/bsay", cmdtext, true, 10) == 0 || strcmp("/setthirst", cmdtext, true, 10) == 0
    || strcmp("/startround", cmdtext, true, 11) == 0 || strcmp("/endround", cmdtext, true, 10) == 0 || strcmp("/setbeta", cmdtext, true, 10) == 0)



Re: expected token: "-string end-", but found "-identifier-" - ]Rafaellos[ - 08.03.2014

Oh yeah, you have right. Editing my post.


Re: expected token: "-string end-", but found "-identifier-" - Aerotactics - 08.03.2014

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
Oh yeah, you have right. Editing my post.
Thanks guys!