error 001: 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 001: expected token: "-string end-", but found "-identifier-" (
/showthread.php?tid=108448)
error 001: expected token: "-string end-", but found "-identifier-" -
cdcyborg - 14.11.2009
Code:
C:\Network Game Servers\GTA\DEBUG\gamemodes\lvcrs.pwn(3789) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Network Game Servers\GTA\DEBUG\gamemodes\lvcrs.pwn(3790) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Network Game Servers\GTA\DEBUG\gamemodes\lvcrs.pwn(3796) : error 001: expected token: "-string end-", but found "-identifier-"
Whats wrong with this anyone please, Thanks in advance.
Code:
new EchoChan[23] = "#GTA2";
new EchoChana[23] = "#GTA-admin";
public ircOnUserJoin(conn, channel[], user[]) {
line:3789 if (user == "gta" || user == "gta2") {
line:3790 if ("channel" == EchoChan) {
ircSay(EchoConnection, EchoChan,"4,15____________6,15 St0rmNet San Andreas Server 4,15____________");
ircSay(EchoConnection, EchoChan,"15,15################7Cops 'n' Criminals15,15###################");
ircSay(EchoConnection, EchoChan,"15,15############7Server Started Succesfully15,15###############");
ircSay(EchoConnection, EchoChan,"4,15__________________ 4Version 1.0.84,15 ____________________");
}
line:3796 else if ("channel" == EchoChana) {
ircSay(EchoConnection, EchoChana,"4,15____________6,15 St0rmNet San Andreas Server 4,15____________");
ircSay(EchoConnection, EchoChana,"15,15################7Cops 'n' Criminals15,15###################");
ircSay(EchoConnection, EchoChana,"15,15############7Server Started Succesfully15,15###############");
ircSay(EchoConnection, EchoChana,"4,15__________________ 4Version 1.0.84,15 ____________________");
}
}
return 1;
}
Re: error 001: expected token: "-string end-", but found "-identifier-" -
Joe Staff - 14.11.2009
You cannot compare an array with a string directly, you have to use a function (strcmp)
USAGE:
pawn Code:
if( strcmp(EchoChan,"channel",true,7) == 0 )
the 'true' is stating that it's going to ignore caps, so it can be 'Channel', 'CHANNEL', or 'channel', doesn't matter. The '7' is how far into either string (EchoChan or "channel") it's going to compare (if it were '4' it would only compare up until "chan"). We're seeing if it equals '0' because 'strcmp' will return 0 when the strings match.