SA-MP Forums Archive
Help with errors - 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: Help with errors (/showthread.php?tid=148383)



Help with errors - w00tNew - 16.05.2010

what ever i did i cant figure out the errors so can you guys help me?

Код:
C:\Users\GM\Desktop\SERVER SAMP\Server\gamemodes\TEST.pwn(256) : error 029: invalid expression, assumed zero
C:\Users\GM\Desktop\SERVER SAMP\Server\gamemodes\TEST.pwn(256) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
C:\Users\GM\Desktop\SERVER SAMP\Server\gamemodes\TEST.pwn(260) : warning 209: function "OnPlayerStateChange" should return a value
C:\Users\GM\Desktop\SERVER SAMP\Server\gamemodes\TEST.pwn(268) : warning 209: function "OnPlayerStateChange" should return a value
C:\Users\GM\Desktop\SERVER SAMP\Server\gamemodes\TEST.pwn(272) : error 030: compound statement not closed at the end of file (started at line 238)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase



Re: Help with errors - w00tNew - 16.05.2010

any help!


Re: Help with errors - coole210 - 17.05.2010

Your script seems pretty small, can you show me all your code? If you dont wanna show me all of it show parts (like the lines of your errors) (CTRL + G to search for lines)


Re: Help with errors - Nee - 17.05.2010

Implant OnPlayerEnterCheckpoint and check line 238.
Good luck


Re: Help with errors - w00tNew - 17.05.2010

heres my whole script

Код:
#include <a_samp>

#pragma tabsize 0


#define WHITE_COLOR 0xFFFFFFAA // white
#define BLUE_COLOR 0x0000BBAA // blue
#define COLOR_RED 0xAA3333AA //red


forward GameModeExitFunc();
forward Restart();

forward SetPlayerToTeamColor(playerid);
forward Finsh();


#define TEAM_1 0
#define TEAM_2 1


static gTeam[MAX_PLAYERS]; // Tracks the team assignment for each player
new Team[MAX_PLAYERS];
new gObjectiveGreenPlayer=(-1);
new gObjectiveTerriost=(-1);
new gObjectiveReached=0;
#define OBJECTIVE_PONY 1
#define OBJECTIVE_COLOR 0xAA0000FF
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;


#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("Terriost Business");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Terriost Business");



	//-------5 minutes-----------
	SetTimer("OVER", 600000, 0);



	AddPlayerClass(153,-596.0947,-1068.8480,23.4771,211.7135,27,100,32,200,30,300); // FACTORY CAR STEALING MISSIon SABRE SKINS
	AddPlayerClass(284,-580.9339,-499.1627,25.5234,283.1998,27,100,32,300,31,300); // PONY PROTECTOR SKIN MISSION FACTORY and wtf is illgeal ROFL


	AddStaticVehicle(475,-565.6738,-1042.0286,23.8060,235.5874,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 1
	AddStaticVehicle(475,-567.9216,-1044.5132,23.7499,233.9885,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 2
	AddStaticVehicle(475,-569.6974,-1048.1484,23.6728,234.6776,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 3
	AddStaticVehicle(475,-571.7986,-1051.1344,23.5991,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 4
	AddStaticVehicle(475,-574.1917,-1054.5111,23.5153,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 5
	AddStaticVehicle(475,-575.9990,-1057.0607,23.4520,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 7
	AddStaticVehicle(475,-577.9879,-1059.8668,23.3823,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 8
	AddStaticVehicle(475,-580.2786,-1063.0983,23.3021,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 9
	AddStaticVehicle(475,-582.1887,-1065.7932,23.2352,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 10
	AddStaticVehicle(475,-584.3939,-1068.9043,23.1580,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 11
	AddStaticVehicle(475,-586.7207,-1072.1868,23.0765,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 12
	AddStaticVehicle(475,-588.1549,-1075.1921,23.1024,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 13
	AddStaticVehicle(475,-590.1531,-1078.0150,23.4009,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 14
	AddStaticVehicle(475,-592.2417,-1080.9617,23.3278,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 15
	
	AddStaticVehicle(413,-569.3774,-502.4915,25.5321,359.0833,0,0); // OBJECTIVE_PONY


  Textdraw0 = TextDrawCreate(248.000000,431.000000,"UtD Server");
	TextDrawAlignment(Textdraw0,0);
	TextDrawBackgroundColor(Textdraw0,0x000000ff);
	TextDrawFont(Textdraw0,0);
	TextDrawLetterSize(Textdraw0,1.000000,1.500000);
	TextDrawColor(Textdraw0,0xffffffff);
	TextDrawSetProportional(Textdraw0,1);
	TextDrawSetShadow(Textdraw0,2);

	Textdraw2 = TextDrawCreate(1.000000,1.000000,"..");
	TextDrawUseBox(Textdraw2,1);
	TextDrawBoxColor(Textdraw2,0x000000ff);
	TextDrawTextSize(Textdraw2,690.000000,435.000000);
	TextDrawAlignment(Textdraw2,0);
	TextDrawBackgroundColor(Textdraw2,0x000000ff);
	TextDrawFont(Textdraw2,3);
	TextDrawLetterSize(Textdraw2,1.000000,12.600009);
	TextDrawColor(Textdraw2,0x000000ff);
	TextDrawSetOutline(Textdraw2,1);
	TextDrawSetProportional(Textdraw2,1);
	TextDrawSetShadow(Textdraw2,1);


	Textdraw1 = TextDrawCreate(1.000000,426.000000,"..");
	TextDrawUseBox(Textdraw1,1);
	TextDrawBoxColor(Textdraw1,0x000000ff);
	TextDrawTextSize(Textdraw1,674.000000,0.000000);
	TextDrawAlignment(Textdraw1,0);
	TextDrawBackgroundColor(Textdraw1,0x000000ff);
	TextDrawFont(Textdraw1,3);
	TextDrawLetterSize(Textdraw1,1.000000,2.200000);
	TextDrawColor(Textdraw1,0x000000ff);
	TextDrawSetOutline(Textdraw1,1);
	TextDrawSetProportional(Textdraw1,1);
	TextDrawSetShadow(Textdraw1,1);


	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1644.4078,-1133.8214,58.2172);
	SetPlayerCameraPos(playerid, 1647.6301,-1134.5725,58.2489);
	SetPlayerCameraLookAt(playerid, 1644.4078,-1133.8214,58.2172);
	SetPlayerFacingAngle(playerid,258.5584);

 	if(classid == 0)
	{
		GameTextForPlayer(playerid, "~r~ Terriosts", 9000, 3);
		Team[playerid] = TEAM_1;
	}
	else if(classid == 1)
	{
		GameTextForPlayer(playerid, "~b~FBI", 9000, 3);
		Team[playerid] = TEAM_2;
	}

	return 1;
}



public OnPlayerConnect(playerid)
{

	SendClientMessage(playerid,BLUE_COLOR, "Welcome to the server");
	SendClientMessage(playerid,WHITE_COLOR, "Mission: Terriost Business");


	GameTextForPlayer(playerid, " ~r~ 10 Min Left", 2500 , 0);

	TextDrawShowForPlayer(playerid, Textdraw0);
	TextDrawShowForPlayer(playerid, Textdraw1);
	TextDrawShowForPlayer(playerid, Textdraw2);
	return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}
public SetPlayerToTeamColor(playerid)
{
	if(gTeam[playerid] == TEAM_1) {
		SetPlayerColor(playerid,WHITE_COLOR); // green
	} else if(gTeam[playerid] == TEAM_2) {
	  SetPlayerColor(playerid,BLUE_COLOR); // blue
	}
}
public OnPlayerSpawn(playerid)
{
	if(Team[playerid] == TEAM_1)
	{
		
		SendClientMessage(playerid,WHITE_COLOR,"You Are a Terriost attack the factory and steal the van");
	}
	else if(Team[playerid] == TEAM_2)
	{
		
		SendClientMessage(playerid,WHITE_COLOR,"You Are a FBI Member Protect the van from the terriosts");
	}



	TextDrawHideForPlayer(playerid, Textdraw1);
	TextDrawHideForPlayer(playerid, Textdraw2);
	
	if(gTeam[playerid] == TEAM_1) {
		SetVehicleParamsForPlayer(OBJECTIVE_PONY,playerid,1,0); // objective; unlocked
		SetVehicleParamsForPlayer(OBJECTIVE_PONY,playerid,1,1); // objective; locked
	  SetPlayerCheckpoint(playerid,1513.3240,-1660.7247,13.6131,7.0);
		SetPlayerWorldBounds(playerid,2535.4392,1434.0455,-1581.9657,-1715.8713);
	  GameTextForPlayer(playerid,
		  "Capture the Van at the factory",
		  6000,5);
	}

	

	SetPlayerCheckpoint(playerid,-561.4668,-1054.3661,23.8782 , 16.0);

	return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
	SendDeathMessage(killerid, playerid, reason);
  SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
	return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vehicleid;

	if(newstate == PLAYER_STATE_DRIVER)
	{
		vehicleid = GetPlayerVehicleID(playerid);

		if(gTeam[playerid] == TEAM_1 && vehicleid == OBJECTIVE_PONY)
		{ // It's the objective vehicle
		  SetPlayerColor(playerid,OBJECTIVE_COLOR);
		  GameTextForPlayer(playerid,"~w~Take the ~r~van ~w~back to the spawn!",3000,5);
		  gObjectiveGreenPlayer = playerid;
		}

	else if(newstate == PLAYER_STATE_ONFOOT)
	{
	
		if(playerid == gObjectiveTerriost) {
		  gObjectiveTerriost = (-1);
		  SetPlayerToTeamColor(playerid);
	}
	return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
 	new playervehicleid = GetPlayerVehicleID(playerid);

 	if(gObjectiveReached) return;

	if(playervehicleid == OBJECTIVE_PONY && gTeam[playerid] == TEAM_1)
	{  // Blue OBJECTIVE REACHED.
	  GameTextForAll("~b~Terriost Wins",3000,5);
 	gObjectiveReached = 1;
 	SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
  	SetTimer("Finsh", 4000, 0); // Set up a timer to exit this mode.
 	return;
 	}
}



Re: Help with errors - w00tNew - 17.05.2010

any help?!


Re: Help with errors - Jefff - 17.05.2010

Код:
#include <a_samp>

#pragma tabsize 0


#define WHITE_COLOR 0xFFFFFFAA // white
#define BLUE_COLOR 0x0000BBAA // blue
#define COLOR_RED 0xAA3333AA //red


forward GameModeExitFunc();
forward Restart();

forward SetPlayerToTeamColor(playerid);
forward Finsh();


#define TEAM_1 0
#define TEAM_2 1


static gTeam[MAX_PLAYERS]; // Tracks the team assignment for each player
new Team[MAX_PLAYERS];
new gObjectiveGreenPlayer=(-1);
new gObjectiveTerriost=(-1);
new gObjectiveReached=0;
#define OBJECTIVE_PONY 1
#define OBJECTIVE_COLOR 0xAA0000FF
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;


#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("Terriost Business");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Terriost Business");



	//-------5 minutes-----------
	SetTimer("OVER", 600000, 0);



	AddPlayerClass(153,-596.0947,-1068.8480,23.4771,211.7135,27,100,32,200,30,300); // FACTORY CAR STEALING MISSIon SABRE SKINS
	AddPlayerClass(284,-580.9339,-499.1627,25.5234,283.1998,27,100,32,300,31,300); // PONY PROTECTOR SKIN MISSION FACTORY and wtf is illgeal ROFL


	AddStaticVehicle(475,-565.6738,-1042.0286,23.8060,235.5874,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 1
	AddStaticVehicle(475,-567.9216,-1044.5132,23.7499,233.9885,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 2
	AddStaticVehicle(475,-569.6974,-1048.1484,23.6728,234.6776,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 3
	AddStaticVehicle(475,-571.7986,-1051.1344,23.5991,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 4
	AddStaticVehicle(475,-574.1917,-1054.5111,23.5153,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 5
	AddStaticVehicle(475,-575.9990,-1057.0607,23.4520,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 7
	AddStaticVehicle(475,-577.9879,-1059.8668,23.3823,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 8
	AddStaticVehicle(475,-580.2786,-1063.0983,23.3021,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 9
	AddStaticVehicle(475,-582.1887,-1065.7932,23.2352,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 10
	AddStaticVehicle(475,-584.3939,-1068.9043,23.1580,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 11
	AddStaticVehicle(475,-586.7207,-1072.1868,23.0765,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 12
	AddStaticVehicle(475,-588.1549,-1075.1921,23.1024,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 13
	AddStaticVehicle(475,-590.1531,-1078.0150,23.4009,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 14
	AddStaticVehicle(475,-592.2417,-1080.9617,23.3278,234.6763,1,1); // SABRE FACTORY TRUCK STEAL MISSION SABRE 15

	AddStaticVehicle(413,-569.3774,-502.4915,25.5321,359.0833,0,0); // OBJECTIVE_PONY


  Textdraw0 = TextDrawCreate(248.000000,431.000000,"UtD Server");
	TextDrawAlignment(Textdraw0,0);
	TextDrawBackgroundColor(Textdraw0,0x000000ff);
	TextDrawFont(Textdraw0,0);
	TextDrawLetterSize(Textdraw0,1.000000,1.500000);
	TextDrawColor(Textdraw0,0xffffffff);
	TextDrawSetProportional(Textdraw0,1);
	TextDrawSetShadow(Textdraw0,2);

	Textdraw2 = TextDrawCreate(1.000000,1.000000,"..");
	TextDrawUseBox(Textdraw2,1);
	TextDrawBoxColor(Textdraw2,0x000000ff);
	TextDrawTextSize(Textdraw2,690.000000,435.000000);
	TextDrawAlignment(Textdraw2,0);
	TextDrawBackgroundColor(Textdraw2,0x000000ff);
	TextDrawFont(Textdraw2,3);
	TextDrawLetterSize(Textdraw2,1.000000,12.600009);
	TextDrawColor(Textdraw2,0x000000ff);
	TextDrawSetOutline(Textdraw2,1);
	TextDrawSetProportional(Textdraw2,1);
	TextDrawSetShadow(Textdraw2,1);


	Textdraw1 = TextDrawCreate(1.000000,426.000000,"..");
	TextDrawUseBox(Textdraw1,1);
	TextDrawBoxColor(Textdraw1,0x000000ff);
	TextDrawTextSize(Textdraw1,674.000000,0.000000);
	TextDrawAlignment(Textdraw1,0);
	TextDrawBackgroundColor(Textdraw1,0x000000ff);
	TextDrawFont(Textdraw1,3);
	TextDrawLetterSize(Textdraw1,1.000000,2.200000);
	TextDrawColor(Textdraw1,0x000000ff);
	TextDrawSetOutline(Textdraw1,1);
	TextDrawSetProportional(Textdraw1,1);
	TextDrawSetShadow(Textdraw1,1);


	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1644.4078,-1133.8214,58.2172);
	SetPlayerCameraPos(playerid, 1647.6301,-1134.5725,58.2489);
	SetPlayerCameraLookAt(playerid, 1644.4078,-1133.8214,58.2172);
	SetPlayerFacingAngle(playerid,258.5584);

 	if(classid == 0)
	{
		GameTextForPlayer(playerid, "~r~ Terriosts", 9000, 3);
		Team[playerid] = TEAM_1;
	}
	else if(classid == 1)
	{
		GameTextForPlayer(playerid, "~b~FBI", 9000, 3);
		Team[playerid] = TEAM_2;
	}

	return 1;
}



public OnPlayerConnect(playerid)
{

	SendClientMessage(playerid,BLUE_COLOR, "Welcome to the server");
	SendClientMessage(playerid,WHITE_COLOR, "Mission: Terriost Business");


	GameTextForPlayer(playerid, " ~r~ 10 Min Left", 2500 , 0);

	TextDrawShowForPlayer(playerid, Textdraw0);
	TextDrawShowForPlayer(playerid, Textdraw1);
	TextDrawShowForPlayer(playerid, Textdraw2);
	return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}
public SetPlayerToTeamColor(playerid)
{
	if(gTeam[playerid] == TEAM_1) {
		SetPlayerColor(playerid,WHITE_COLOR); // green
	} else if(gTeam[playerid] == TEAM_2) {
	  SetPlayerColor(playerid,BLUE_COLOR); // blue
	}
}
public OnPlayerSpawn(playerid)
{
	if(Team[playerid] == TEAM_1)
	{

		SendClientMessage(playerid,WHITE_COLOR,"You Are a Terriost attack the factory and steal the van");
	}
	else if(Team[playerid] == TEAM_2)
	{

		SendClientMessage(playerid,WHITE_COLOR,"You Are a FBI Member Protect the van from the terriosts");
	}



	TextDrawHideForPlayer(playerid, Textdraw1);
	TextDrawHideForPlayer(playerid, Textdraw2);

	if(gTeam[playerid] == TEAM_1) {
		SetVehicleParamsForPlayer(OBJECTIVE_PONY,playerid,1,0); // objective; unlocked
		SetVehicleParamsForPlayer(OBJECTIVE_PONY,playerid,1,1); // objective; locked
	  SetPlayerCheckpoint(playerid,1513.3240,-1660.7247,13.6131,7.0);
		SetPlayerWorldBounds(playerid,2535.4392,1434.0455,-1581.9657,-1715.8713);
	  GameTextForPlayer(playerid,
		  "Capture the Van at the factory",
		  6000,5);
	}



	SetPlayerCheckpoint(playerid,-561.4668,-1054.3661,23.8782 , 16.0);

	return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
	SendDeathMessage(killerid, playerid, reason);
  SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
	return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vehicleid;

	if(newstate == PLAYER_STATE_DRIVER)
	{
		vehicleid = GetPlayerVehicleID(playerid);

		if(gTeam[playerid] == TEAM_1 && vehicleid == OBJECTIVE_PONY)
		{ // It's the objective vehicle
		  SetPlayerColor(playerid,OBJECTIVE_COLOR);
		  GameTextForPlayer(playerid,"~w~Take the ~r~van ~w~back to the spawn!",3000,5);
		  gObjectiveGreenPlayer = playerid;
		}

	}else if(newstate == PLAYER_STATE_ONFOOT)
	{

		if(playerid == gObjectiveTerriost) {
		  gObjectiveTerriost = (-1);
		  SetPlayerToTeamColor(playerid);
		}
	}
	return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
 	new playervehicleid = GetPlayerVehicleID(playerid);

 	if(gObjectiveReached) return 1;

	if(playervehicleid == OBJECTIVE_PONY && gTeam[playerid] == TEAM_1)
	{  // Blue OBJECTIVE REACHED.
	  GameTextForAll("~b~Terriost Wins",3000,5);
 	gObjectiveReached = 1;
 	SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
  	SetTimer("Finsh", 4000, 0); // Set up a timer to exit this mode.
 	}
	return 1;
}