SA-MP Forums Archive
Error 001: expected token: ",", but found ";" - 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: ",", but found ";" (/showthread.php?tid=279436)



Error 001: expected token: ",", but found ";" - Jack Lewis - 27.08.2011

Yes, this is probably a fools mistake and most likely the easiest thing to fix in the world, I have tried but everything I change generates a new error. Sorry, but I'm completely new to PAWN.

Код:
public OnPlayerConnect(playerid)
{
	playersconnected++;
	SendClientMessage(playerid, 0xFF8000FF, "Welcome to the test server!");
	new string[128];
	format (string, sizeof(string), "There are currently %i players in the server (Including you)", playersconnected;
	SendClientMessageToAll(0xFF8000FF, string);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	playersconnected--;
	new string[128];
	format (string, sizeof(string), "There are currently %i players in the server (Including you)", playersconnected;
	SendClientMessageToAll(0xFF8000FF, string);
	return 1;
The lines in bold are the issue.


Re: Error 001: expected token: ",", but found ";" - -CaRRoT - 27.08.2011

Which line the error in ?


Re: Error 001: expected token: ",", but found ";" - Gagi_Corleone - 27.08.2011

Put this:
Код:
public OnPlayerConnect(playerid)
{
	playersconnected++;
	SendClientMessage(playerid, 0xFF8000FF, "Welcome to the test server!");
	new string[128];
	format (string, sizeof(string), "There are currently %i players in the server (Including you)", playersconnected);
	SendClientMessageToAll(0xFF8000FF, string);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	playersconnected--;
	new string[128];
	format (string, sizeof(string), "There are currently %i players in the server (Including you)", playersconnected);
	SendClientMessageToAll(0xFF8000FF, string);
	return 1;



Re: Error 001: expected token: ",", but found ";" - Jack Lewis - 27.08.2011

Quote:
Originally Posted by Jack Lewis
Посмотреть сообщение
format (string, sizeof(string), "There are currently %i players in the server (Including you)", playersconnected;

format (string, sizeof(string), "There are currently %i players in the server (Including you)", playersconnected;

return 1;

The lines in bold are the issue.
As I said... The lines in bold.


Re: Error 001: expected token: ",", but found ";" - Darnell - 27.08.2011

I see that you didn't place a bracket at the end of the public OnPlayerDisconnect.


Re: Error 001: expected token: ",", but found ";" - Gagi_Corleone - 27.08.2011

I've already put you over that you forgot to put bracket
format (string, sizeof(string), "There are currently %i players in the server (Including you)", playersconnected);


Re: Error 001: expected token: ",", but found ";" - Jack Lewis - 27.08.2011

Quote:
Originally Posted by Darnell
Посмотреть сообщение
I see that you didn't place a bracket at the end of the public OnPlayerDisconnect.
It's there, must have got cut off when I was copy and pasting.

Quote:
Originally Posted by Gagi_Corleone
Посмотреть сообщение
I've already put you over that you forgot to put bracket
format (string, sizeof(string), "There are currently %i players in the server (Including you)", playersconnected);
Thank you!