Expected token error.
#1

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

\ 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"
Reply
#3

Ahh okay, I get what you mean, as \n is next line and so on.
Thanks anyway! rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)