Expected token 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: Expected token error. (
/showthread.php?tid=529557)
[RESOLVED] Expected token error. -
MotherDucker - 02.08.2014
Hello, I've been getting this error for a while, I'm confused at why it is sending the error.
Код:
stock ContainsValidCharacters(text[])
{
if(strfind(text, "[") != -1 || strfind(text, "]") != -1 || strfind(text, "/") != -1 || strfind(text, "\") != -1 || strfind(text, ":") != -1 || strfind(text, "*") != -1 || strfind(text, "?") != -1 || strfind(text, "<") != -1 || strfind(text, ">") != -1 || strfind(text, "|") != -1 || strfind(text, ".") != 1 || strfind(text, "#") || strfind(text, "¬") || strfind(text, "`") || strfind(text, "¦") || strfind(text, "Ј") || strfind(text, "$") || strfind(text, "%") || strfind(text, "^") || strfind(text, "&") || strfind(text, "(") || strfind(text, ")") || strfind(text, "-") || strfind(text, "=") || strfind(text, "{") || strfind(text, "}")) //The error line {line:31881}
}
The error's i'm getting are:
Код:
C:\Users\Duck\Documents\Samp server stuff\CS-RP\gamemodes\CSRPV2.1.pwn(31881) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Duck\Documents\Samp server stuff\CS-RP\gamemodes\CSRPV2.1.pwn(31881) : error 029: invalid expression, assumed zero
Thanks for the help.
Re: Expected token error. -
Mauzen - 02.08.2014
\ is an escape character. Escape characters have a certain effect on the character following them
\" in this case means just " in a way that it doesnt close the string, but the " being part of the string.
The string "\"" then would just show " ingame, while "\" is an unclosed string. What you actually want to use there is "\\" The \ escapes itself there and means "dont do what a \ commonly does, but just put the \ in there"
Re: Expected token error. -
MotherDucker - 02.08.2014
Ahh okay, I get what you mean, as \n is next line and so on.
Thanks anyway!

rep+