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



error 001: expected token: "-string end-", but found "-identifier-" Any Ideas? - Jack_Rocker - 04.11.2011

Right, I know its something to do with strings, but not quite sure...
(the code is in a dialog)
pawn Code:
if(inputtext == "LV"||"LS"||"SF"||"AA")
Code:
error 001: expected token: "-string end-", but found "-identifier-"
Any ideas?

Thanks

Jack_Rocker


Re: error 001: expected token: "-string end-", but found "-identifier-" Any Ideas? - EvgeN 1137 - 04.11.2011

PHP Code:
if(!strcmp(inputtext"LV"true) || !strcmp(inputtext"LS"true) || !strcmp(inputtext"LS"true) || !strcmp(inputtext"AA"true)) 



Re: error 001: expected token: "-string end-", but found "-identifier-" Any Ideas? - Calgon - 04.11.2011

You can't compare strings like that at all in Pawn.

First of all, you need to use strcmp() to compare values to strings, and you can't use quotation marks like that.

Secondly, you can't use logical 'or' statements like that, you quite literally need to compare the value to the string each time.

pawn Code:
if(!strcmp(inputtext, "LV", true) || !strcmp(inputtext, "LS", true) || !strcmp(inputtext, "SF", true) || !strcmp(inputtext, "AA", true))
Should be right, my memory of the syntax in Pawn is pretty bad.


Re: error 001: expected token: "-string end-", but found "-identifier-" Any Ideas? - FarSe. - 04.11.2011

pawn Code:
if(inputtext[0] == 'L' && (inputtext[1] == 'S' ||inputtext[1] == 'F' ||inputtext[1] == 'V') && inputtext[2] == EOS)
{
//do something
}
for strings with a size bigger use strcmp .. https://sampwiki.blast.hk/wiki/Strcmp


Re: error 001: expected token: "-string end-", but found "-identifier-" Any Ideas? - Jack_Rocker - 04.11.2011

Thanks