error 001: expected token: "-string end-", but found "-identifier-"
#1

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;
}
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)