errors again ><
#1

Hello there how to fix there errors it minigames for my server
Код:
C:\Users\Kimo Computer\Desktop\NeX EvolutioN Freeroam R2\minigamesr2.pwn(853) : warning 235: public function lacks forward declaration (symbol "OnPlayerPrivmsg")
C:\Users\Kimo Computer\Desktop\NeX EvolutioN Freeroam R2\minigamesr2.pwn(1419) : warning 235: public function lacks forward declaration (symbol "OnPlayerInfoChange")
Код:
/* Made by DutchDominator AKA H4rdc0r3.
#  Do not claim this as your own, if you use it, don't forget the credits.
#  Yes, you may change this script and republish it, but keep credits to me.*/


#include <a_samp>

#define FILTERSCRIPT

//These are the coordinates your player will spawn at if they are still alive at the end of a minigame:

#define spawnX 1310.000000
#define spawnY -1370.199951
#define spawnZ 13.500000

new playerinminigame[MAX_PLAYERS];

new bloodring[15],derbyon,derbyplaying,playercarid[MAX_PLAYERS],playerinderby[MAX_PLAYERS],derbyrank,reward,bloodringfull[15],playerinbloodring[MAX_PLAYERS];

new tdmon,tdmplaying,playerintdm[MAX_PLAYERS],tdmrank,redplayers,blueplayers,tdmcolor,oldplayercolor[MAX_PLAYERS];

new dmon,dmplaying,playerindm[MAX_PLAYERS],dmrank;

new qbloodring[15],qbloodringfull[15],playerinqderby[MAX_PLAYERS],playerinqbloodring[MAX_PLAYERS],qderbyrank,qderbyon,qderbyplaying;

new boxon,boxplaying,playerinbox[MAX_PLAYERS],boxrank;

new sdon,sdplaying,playerinsd[MAX_PLAYERS],sdrank,sdfirst;

new karts[15],kartfull[15],karton,kartplaying,playerinkartrace[MAX_PLAYERS],kartrank,playerinkart[MAX_PLAYERS],currentcheckpoint[MAX_PLAYERS],krtfirst;

new nrg[15],nrgfull[15],sron,srplaying,playerinsr[MAX_PLAYERS],srrank,playerinnrg[MAX_PLAYERS],currentracecheckpoint[MAX_PLAYERS],srfirst;

new startvar[8];

//Timers:

new dtimer,dmtimer,tdmtimer,qdtimer,boxtimer,sdtimer,krttimer,srtimer;

forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward load();

forward Spawnbloodrings();// Derby
forward Destroybloodrings();
forward Respawnbloodrings();
forward StartDerby();

forward Starttdm();// TeamDM

forward Startdm();// LVDM

forward Spawnqbloodrings();// Quarry Derby
forward Destroyqbloodrings();
forward Respawnqbloodrings();
forward StartqDerby();

forward StartBox();// Boxing Fight

forward StartSd();// Skydive
forward EndSd();
forward SdFinish(playerid);

forward SpawnKarts();// KartRace
forward DestroyKarts();
forward RespawnKarts();
forward StartKart();
forward KrtFinish();

forward SpawnNrgs();// Stadium Race
forward DestroyNrgs();
forward RespawnNrgs();
forward StartSr();
forward SrFinish();

forward RewardCalc(playerid,min,max);// General reward calc.


// Derby cars:
new Float:derbycars[15][4] = {
	{-1362.9799,932.8219,1036.0580,9.0890}, // 0
	{-1346.4526,935.4996,1036.0889,13.6811}, // 1
	{-1335.6995,938.2600,1036.1177,16.8043}, // 2
	{-1320.8756,944.9904,1036.2062,27.0307}, // 3
	{-1306.8385,953.5919,1036.3212,37.8366}, // 4
	{-1353.9670,934.0486,1036.2421,11.5836}, // 5
	{-1328.6377,941.0197,1036.3208,18.9670}, // 6
	{-1313.9012,948.6513,1036.4198,29.5596}, // 7
	{-1501.0956,960.3203,1036.9474,313.0457}, // 8
	{-1506.8105,968.1082,1037.0840,304.3027}, // 9
	{-1513.0317,976.8713,1037.2457,301.9500}, // 10
	{-1516.0858,988.2343,1037.4362,274.5044}, // 11
	{-1517.6569,995.6628,1037.5626,272.2782}, // 12
	{-1515.1127,1004.8807,1037.6969,262.3869}, // 13
	{-1510.7020,1014.6202,1037.8568,249.1825} // 14
};


// LVDM Spawn places:
new Float:lvdmspawns[15][3] = {
	{2297.5220,2484.1804,3.2734}, // 0
	{2271.5120,2474.2268,3.2734}, // 1
	{2244.7441,2467.5762,3.2734}, // 2
	{2248.0867,2448.3484,3.2734}, // 3
	{2267.7366,2439.3997,3.2734}, // 4
	{2286.3911,2434.0715,3.2734}, // 5
	{2302.9141,2441.9189,3.2734}, // 6
	{2265.5151,2494.8433,-0.3329}, // 7
	{2300.1218,2483.3733,-7.4531}, // 8
	{2281.1760,2480.1216,-7.4531}, // 9
	{2251.8474,2473.7490,-7.4531}, // 10
	{2227.2383,2460.1196,-7.4531}, // 11
	{2250.4229,2440.2544,-7.4531}, // 12
	{2293.2231,2438.4878,-7.4531}, // 13
	{2301.3645,2452.4045,-7.4531} // 14
};

// Quarry derby cars:
new Float:qderbycars[15][4] = {
	{605.7057,815.2199,-43.1692,350.9785}, // 0
	{609.4918,814.6188,-43.1692,350.9785}, // 1
	{613.3760,814.0021,-43.1692,350.9785}, // 2
	{616.5115,813.5043,-43.1692,350.9785}, // 3
	{619.8624,812.9723,-43.1691,350.9785}, // 4
	{622.9971,812.4746,-43.1691,350.9785}, // 5
	{678.2766,922.8008,-41.0451,115.3092}, // 6
	{680.1019,918.9395,-41.0066,115.3092}, // 7
	{681.3400,916.3724,-40.6739,115.2029}, // 8
	{682.7889,913.2912,-40.3585,115.2062}, // 9
	{491.2690,912.7574,-30.6622,248.8228}, // 10
	{489.9630,909.3635,-30.6003,248.8228}, // 11
	{488.5172,905.6060,-30.5318,248.8228}, // 12
	{488.1009,902.4600,-30.4778,262.3300}, // 13
	{487.7645,899.9181,-30.4341,262.3300} // 14
};

// Karts:
new Float:kartspawns[15][4] = {
	{-1366.1909,906.8451,1040.5919,280.3004}, // 0
	{-1366.4854,908.3992,1040.2843,280.3004}, // 1
	{-1366.8508,910.3288,1039.9022,280.3004}, // 2
	{-1367.2168,912.2613,1039.5195,280.3004}, // 3
	{-1367.7562,915.1094,1038.9557,280.3004}, // 4
	{-1368.4265,918.6667,1038.4503,280.3231}, // 5
	{-1368.8036,920.6827,1038.1428,280.3231}, // 6
	{-1369.1410,922.4866,1037.8677,280.3231}, // 7
	{-1372.5338,921.9490,1037.9705,277.8816}, // 8
	{-1372.2379,919.8677,1038.2872,277.8816}, // 9
	{-1371.9086,917.5515,1038.6396,277.8816}, // 10
	{-1371.6196,915.5192,1038.9486,277.8816}, // 11
	{-1371.2595,912.9866,1039.3340,277.8816}, // 12
	{-1371.0453,911.4792,1039.5632,277.8816}, // 13
	{-1370.6086,908.9531,1040.1785,275.7079} // 14
};

new Float:nrgspawns[15][4] = {
	{-1436.5146,-595.6609,1055.5591,86.0952},
	{-1436.4534,-594.7911,1055.4529,86.1336},
	{-1436.3988,-594.0178,1055.3585,86.1336},
	{-1436.3256,-592.9784,1055.2316,86.1336},
	{-1436.2520,-591.9318,1055.1398,86.1124},
	{-1436.1643,-590.6272,1055.0952,86.1436},
	{-1436.1060,-589.7750,1055.0508,86.1436},
	{-1436.0160,-588.4620,1054.9822,86.1436},
	{-1435.9694,-587.7808,1054.9465,86.1436},
	{-1435.9060,-586.8561,1054.8982,86.1436},
	{-1435.8304,-586.0049,1054.8535,85.9079},
	{-1435.7190,-584.4737,1054.7749,85.9079},
	{-1435.6482,-583.4991,1054.7249,85.9079},
	{-1435.5737,-582.4772,1054.6724,85.9079},
	{-1435.4778,-581.1537,1054.5422,85.8982}
};

// Kartrace checkpoints:
new Float:kcps[5][3] = {
	{-1262.4230,1028.3113,1039.6948},
	{-1433.8792,1083.7178,1039.0344},
	{-1540.4967,1004.6923,1039.1409},
	{-1392.7269,914.2321,1039.8306},
	{-1392.7269,914.2321,1039.8306}
};

new Float:srcps[10][3] = {
	{-1515.0345,-646.2552,1049.8767},
	{-1379.9943,-743.5076,1051.6895},
	{-1373.9252,-665.4581,1055.8362},
	{-1477.3721,-616.7951,1053.4919},
	{-1437.9470,-669.4881,1053.0645},
	{-1382.3152,-722.2056,1055.6273},
	{-1335.7629,-637.1422,1054.2230},
	{-1386.6233,-589.4922,1056.3871},
	{-1421.6000,-588.1021,1055.8623},
	{-1421.6000,-588.1021,1055.8623}
};


#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	SetTimer("load",2000,0);
	return 1;
}

public OnFilterScriptExit()
{
	Destroybloodrings();
	Destroyqbloodrings();
	DestroyKarts();
	DestroyNrgs();
	return 1;
}

#endif

public OnGameModeInit()
{
	SetTimer("load",2000,0);
	return 1;
}

public OnGameModeExit()
{
	Destroybloodrings();
	Destroyqbloodrings();
	DestroyKarts();
	DestroyNrgs();
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	playerinminigame[playerid] = 0; // Checks if a player is in a minigame
	playercarid[playerid] = -1; // Car that player currently is in, used to check whether the player is in a derby/race car

	playerinderby[playerid] = 0; // Derby
	playerinbloodring[playerid] = -1;

	playerintdm[playerid] = 0; // TeamDM

	playerindm[playerid] = 0; // LVDM

	playerinqderby[playerid] = 0; // Quarry Derby
	playerinqbloodring[playerid] = -1;

	playerinbox[playerid] = 0; // Boxing Fight

	playerinkartrace[playerid] = 0; // Kart Race
	playerinkart[playerid] = -1;
	currentcheckpoint[playerid] = 0;
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new string[256];
	if(playerinderby[playerid] == 1)
	{
		new DerbyPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the derby, rank: %d", DerbyPlayerName, derbyrank);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinderby[playerid] = 0;
		playerinminigame[playerid] = 0;
		bloodringfull[playerinbloodring[playerid]] = 0;
		playerinbloodring[playerid] = -1;
		if(derbyrank <= 2)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinderby[i] == 1)
				{
					new winnername[256];
					GetPlayerName(i,winnername, sizeof(winnername));
					RewardCalc(i,100,1000);
					format(string, sizeof(string), "%s has won the derby for $%d", winnername, reward);
					SendClientMessageToAll(0x33AA33AA, string);
					GivePlayerMoney(i,reward);
					playerinderby[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			derbyplaying = 0;
			derbyrank = 0;
			derbyon = 0;
			KillTimer(dtimer);
			Respawnbloodrings();
			return 1;
		}
		derbyrank--;
		} else if(playerintdm[playerid] == 1) {
		new tdmPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, tdmPlayerName, sizeof(tdmPlayerName));
		if(GetPlayerColor(playerid) == 0x0000BBAA)
		{
			format(string, sizeof(string), "%s has been dropped out of the team DM, team blue", tdmPlayerName);
			blueplayers = blueplayers-1;
			} else {
			format(string, sizeof(string), "%s has been dropped out of the team DM, team red", tdmPlayerName);
			redplayers = redplayers-1;
		}
		SendClientMessageToAll(0x33AA33AA, string);
		playerintdm[playerid] = 0;
		playerinminigame[playerid] = 0;
		if(tdmrank == 0)
		{
			tdmplaying = 0;
			tdmrank = 0;
			tdmon = 0;
			KillTimer(tdmtimer);
			return 1;
		}
		if((blueplayers == 0 || redplayers == 0) && tdmplaying == 1)
		{
			if(blueplayers == 0)
			{
				format(string, sizeof(string), "Team red has won the team DM");
			} else if(redplayers == 0)
			{
				format(string, sizeof(string), "Team blue has won the team DM");
			}
			SendClientMessageToAll(0x33AA33AA, string);
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerintdm[i] == 1)
				{
					playerintdm[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerColor(i,oldplayercolor[i]);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			tdmplaying = 0;
			tdmrank = 0;
			tdmon = 0;
			KillTimer(tdmtimer);
			return 1;
		}
		tdmrank--;
		} else if(playerindm[playerid] == 1) {
		new dmPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, dmPlayerName, sizeof(dmPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the LVDM, rank: %d", dmPlayerName, dmrank);
		SendClientMessageToAll(0x33AA33AA, string);
		playerindm[playerid] = 0;
		playerinminigame[playerid] = 0;
		if(dmrank <= 2)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerindm[i] == 1)
				{
					new dmwinnername[256];
					GetPlayerName(i,dmwinnername, sizeof(dmwinnername));
					RewardCalc(i,100,1000);
					format(string, sizeof(string), "%s has won the LVDM for $%d", dmwinnername, reward);
					SendClientMessageToAll(0x33AA33AA, string);
					GivePlayerMoney(i,reward);
					playerindm[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			dmplaying = 0;
			dmrank = 0;
			dmon = 0;
			KillTimer(dmtimer);
			return 1;
		}
		dmrank--;
		} else if(playerinqderby[playerid] == 1)        {
		new DerbyPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the quarry derby, rank: %d", DerbyPlayerName, qderbyrank);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinqderby[playerid] = 0;
		playerinminigame[playerid] = 0;
		qbloodringfull[playerinqbloodring[playerid]] = 0;
		playerinqbloodring[playerid] = -1;
		if(qderbyrank <= 2)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinqderby[i] == 1)
				{
					new winnername[256];
					GetPlayerName(i,winnername, sizeof(winnername));
					RewardCalc(i,100,1000);
					format(string, sizeof(string), "%s has won the quarry derby for $%d", winnername, reward);
					SendClientMessageToAll(0x33AA33AA, string);
					GivePlayerMoney(i,reward);
					playerinqderby[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			qderbyplaying = 0;
			qderbyrank = 0;
			qderbyon = 0;
			KillTimer(qdtimer);
			Respawnqbloodrings();
			return 1;
		}
		qderbyrank--;
		} else if(playerinbox[playerid] == 1) {
		new boxPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, boxPlayerName, sizeof(boxPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the boxing fight, rank: %d", boxPlayerName, boxrank);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinbox[playerid] = 0;
		playerinminigame[playerid] = 0;
		if(boxrank <= 2)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinbox[i] == 1)
				{
					new boxwinnername[256];
					GetPlayerName(i,boxwinnername, sizeof(boxwinnername));
					RewardCalc(i,100,1000);
					format(string, sizeof(string), "%s has won the boxing fight for $%d", boxwinnername, reward);
					SendClientMessageToAll(0x33AA33AA, string);
					GivePlayerMoney(i,reward);
					playerinbox[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			boxplaying = 0;
			boxrank = 0;
			boxon = 0;
			KillTimer(boxtimer);
			return 1;
		}
		boxrank--;
		} else if(playerinsd[playerid] == 1) {
		new SkydivePlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, SkydivePlayerName, sizeof(SkydivePlayerName));
		format(string, sizeof(string), "%s has been dropped out of the skydive", SkydivePlayerName);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinsd[playerid] = 0;
		playerinminigame[playerid] = 0;
		if(sdrank <= 1)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinsd[i] == 1)
				{
					playerinsd[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			sdplaying = 0;
			sdrank = 0;
			sdon = 0;
			sdfirst = 0;
			KillTimer(sdtimer);
			return 1;
		}
		sdrank--;
		} else if(playerinkartrace[playerid] == 1) {
		new KartPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, KartPlayerName, sizeof(KartPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the kart race", KartPlayerName);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinkartrace[playerid] = 0;
		playerinminigame[playerid] = 0;
		kartfull[playerinkart[playerid]] = 0;
		playerinkart[playerid] = -1;
		if(kartrank <= 1)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinkartrace[i] == 1)
				{
					playerinkartrace[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			kartplaying = 0;
			kartrank = 0;
			karton = 0;
			KillTimer(krttimer);
			RespawnKarts();
			return 1;
		}
		kartrank--;
		} else if(playerinsr[playerid] == 1) {
		new SrPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, SrPlayerName, sizeof(SrPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the stadium race", SrPlayerName);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinsr[playerid] = 0;
		playerinminigame[playerid] = 0;
		nrgfull[playerinnrg[playerid]] = 0;
		playerinnrg[playerid] = -1;
		if(kartrank <= 1)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinsr[i] == 1)
				{
					playerinsr[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			kartplaying = 0;
			kartrank = 0;
			karton = 0;
			KillTimer(srtimer);
			RespawnNrgs();
			return 1;
		}
		srrank--;
	}
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	new string[256];
	if(playerinderby[playerid] == 1)
	{
		new DerbyPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the derby, rank: %d", DerbyPlayerName, derbyrank);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinderby[playerid] = 0;
		playerinminigame[playerid] = 0;
		bloodringfull[playerinbloodring[playerid]] = 0;
		playerinbloodring[playerid] = -1;
		if(derbyrank <= 2)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinderby[i] == 1)
				{
					new winnername[256];
					GetPlayerName(i,winnername, sizeof(winnername));
					RewardCalc(i,100,1000);
					format(string, sizeof(string), "%s has won the derby for $%d", winnername, reward);
					SendClientMessageToAll(0x33AA33AA, string);
					GivePlayerMoney(i,reward);
					playerinderby[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			derbyplaying = 0;
			derbyrank = 0;
			derbyon = 0;
			KillTimer(dtimer);
			Respawnbloodrings();
			return 1;
		}
		derbyrank--;
		} else if(playerintdm[playerid] == 1) {
		new tdmPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, tdmPlayerName, sizeof(tdmPlayerName));
		if(GetPlayerColor(playerid) == 0x0000BBAA)
		{
			format(string, sizeof(string), "%s has been dropped out of the team DM, team blue", tdmPlayerName);
			blueplayers = blueplayers-1;
			} else {
			format(string, sizeof(string), "%s has been dropped out of the team DM, team red", tdmPlayerName);
			redplayers = redplayers-1;
		}
		SendClientMessageToAll(0x33AA33AA, string);
		playerintdm[playerid] = 0;
		playerinminigame[playerid] = 0;
		if(tdmrank == 0)
		{
			tdmplaying = 0;
			tdmrank = 0;
			tdmon = 0;
			KillTimer(tdmtimer);
			return 1;
		}
		if((blueplayers == 0 || redplayers == 0) && tdmplaying == 1)
		{
			if(blueplayers == 0)
			{
				format(string, sizeof(string), "Team red has won the team DM");
			} else if(redplayers == 0)
			{
				format(string, sizeof(string), "Team blue has won the team DM");
			}
			SendClientMessageToAll(0x33AA33AA, string);
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerintdm[i] == 1)
				{
					playerintdm[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerColor(i,oldplayercolor[i]);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			tdmplaying = 0;
			tdmrank = 0;
			tdmon = 0;
			KillTimer(tdmtimer);
			return 1;
		}
		tdmrank--;
		} else if(playerindm[playerid] == 1) {
		new dmPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, dmPlayerName, sizeof(dmPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the LVDM, rank: %d", dmPlayerName, dmrank);
		SendClientMessageToAll(0x33AA33AA, string);
		playerindm[playerid] = 0;
		playerinminigame[playerid] = 0;
		if(dmrank <= 2)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerindm[i] == 1)
				{
					new dmwinnername[256];
					GetPlayerName(i,dmwinnername, sizeof(dmwinnername));
					RewardCalc(i,100,1000);
					format(string, sizeof(string), "%s has won the LVDM for $%d", dmwinnername, reward);
					SendClientMessageToAll(0x33AA33AA, string);
					GivePlayerMoney(i,reward);
					playerindm[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			dmplaying = 0;
			dmrank = 0;
			dmon = 0;
			KillTimer(dmtimer);
			return 1;
		}
		dmrank--;
		} else if(playerinqderby[playerid] == 1)        {
		new DerbyPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the quarry derby, rank: %d", DerbyPlayerName, qderbyrank);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinqderby[playerid] = 0;
		playerinminigame[playerid] = 0;
		qbloodringfull[playerinqbloodring[playerid]] = 0;
		playerinqbloodring[playerid] = -1;
		if(qderbyrank <= 2)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinqderby[i] == 1)
				{
					new winnername[256];
					GetPlayerName(i,winnername, sizeof(winnername));
					RewardCalc(i,100,1000);
					format(string, sizeof(string), "%s has won the quarry derby for $%d", winnername, reward);
					SendClientMessageToAll(0x33AA33AA, string);
					GivePlayerMoney(i,reward);
					playerinqderby[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			qderbyplaying = 0;
			qderbyrank = 0;
			qderbyon = 0;
			KillTimer(qdtimer);
			Respawnqbloodrings();
			return 1;
		}
		qderbyrank--;
		} else if(playerinbox[playerid] == 1) {
		new boxPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, boxPlayerName, sizeof(boxPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the boxing fight, rank: %d", boxPlayerName, boxrank);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinbox[playerid] = 0;
		playerinminigame[playerid] = 0;
		if(boxrank <= 2)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinbox[i] == 1)
				{
					new boxwinnername[256];
					GetPlayerName(i,boxwinnername, sizeof(boxwinnername));
					RewardCalc(i,100,1000);
					format(string, sizeof(string), "%s has won the boxing fight for $%d", boxwinnername, reward);
					SendClientMessageToAll(0x33AA33AA, string);
					GivePlayerMoney(i,reward);
					playerinbox[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			boxplaying = 0;
			boxrank = 0;
			boxon = 0;
			KillTimer(boxtimer);
			return 1;
		}
		boxrank--;
		} else if(playerinsd[playerid] == 1) {
		new SkydivePlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, SkydivePlayerName, sizeof(SkydivePlayerName));
		format(string, sizeof(string), "%s has been dropped out of the skydive", SkydivePlayerName);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinsd[playerid] = 0;
		playerinminigame[playerid] = 0;
		if(sdrank <= 1)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinsd[i] == 1)
				{
					playerinsd[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			sdplaying = 0;
			sdrank = 0;
			sdon = 0;
			sdfirst = 0;
			KillTimer(sdtimer);
			return 1;
		}
		sdrank--;
		} else if(playerinkartrace[playerid] == 1) {
		new KartPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, KartPlayerName, sizeof(KartPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the kart race", KartPlayerName);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinkartrace[playerid] = 0;
		playerinminigame[playerid] = 0;
		kartfull[playerinkart[playerid]] = 0;
		playerinkart[playerid] = -1;
		if(kartrank <= 1)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinkartrace[i] == 1)
				{
					playerinkartrace[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			kartplaying = 0;
			kartrank = 0;
			karton = 0;
			KillTimer(krttimer);
			RespawnKarts();
			return 1;
		}
		kartrank--;
		} else if(playerinsr[playerid] == 1) {
		new SrPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, SrPlayerName, sizeof(SrPlayerName));
		format(string, sizeof(string), "%s has been dropped out of the stadium race", SrPlayerName);
		SendClientMessageToAll(0x33AA33AA, string);
		playerinsr[playerid] = 0;
		playerinminigame[playerid] = 0;
		nrgfull[playerinnrg[playerid]] = 0;
		playerinnrg[playerid] = -1;
		if(kartrank <= 1)
		{
			for(new i=0; i<MAX_PLAYERS; i++)
			{
				if (IsPlayerConnected(i) && playerinsr[i] == 1)
				{
					playerinsr[i] = 0;
					playerinminigame[i] = 0;
					SetPlayerVirtualWorld(i,0);
					SetPlayerInterior(playerid, 0);
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
				}
			}
			srplaying = 0;
			srrank = 0;
			sron = 0;
			KillTimer(srtimer);
			RespawnNrgs();
			return 1;
		}
		srrank--;
	}
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256];
	new idx;
	new string[256];
	new tmp[256];
	cmd = strtok(cmdtext, idx);

	if(strcmp(cmd, "/mark", true) == 0)
	{
		if(playerinminigame[playerid])
		{
			SendClientMessage(playerid, 0x33AA33AA, "To prevent abuse, /mark and /gotomark are disabled in minigames.");
			return 1;
		}
	}

	if(strcmp(cmd, "/gotomark", true) == 0)
	{
		if(playerinminigame[playerid])
		{
			SendClientMessage(playerid, 0x33AA33AA, "To prevent abuse, /mark and /gotomark are disabled in minigames.");
			return 1;
		}
	}

	if(strcmp(cmd, "/minigames", true) == 0)
	{
		SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
		SendClientMessage(playerid, 0xFF0000FF, " ");
		SendClientMessage(playerid, 0xFF0000FF, "These minigames are currently available:");
		SendClientMessage(playerid, 0xFF0000FF, "/derby /teamdm /lvdm /qderby /boxing /sdive /kartrace /srace");
		SendClientMessage(playerid, 0xFF0000FF, "Type /info for more information about seperate minigames.");
		SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
		return 1;
	}

	if(strcmp(cmd, "/info", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid,0xFFFF00AA, "Usage: /info [minigame command]");
			SendClientMessage(playerid,0xFFFF00AA, "Minigame commands: derby teamdm lvdm qderby boxing sdive kartrace srace");
			return 1;
		}

		SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
		SendClientMessage(playerid, 0xFF0000FF, " ");
		if(strcmp(tmp, "derby", true) == 0){
			SendClientMessage(playerid, 0xFF0000FF, "Derby: A destruction derby in the Bloodbowl.");
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to destroy everyone other's car, and keep your own car intact.");
			}else if(strcmp(tmp, "teamdm", true) == 0){
			SendClientMessage(playerid, 0xFF0000FF, "TeamDM: A team deathmatch in area 51 with two teams, red and blue.");
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is kill everyone of the other team.");
			}else if(strcmp(tmp, "lvdm", true) == 0){
			SendClientMessage(playerid, 0xFF0000FF, "Lvdm: A deathmatch in the LVPD.");
			SendClientMessage(playerid, 0xFF0000FF, "Your goal kill other people, and stay alive.");
			}else if(strcmp(tmp, "qderby", true) == 0){
			SendClientMessage(playerid, 0xFF0000FF, "QDerby: A destruction derby in the Quarry.");
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to destroy everyone other's car, and keep your own car intact.");
			}else if(strcmp(tmp, "boxing", true) == 0){
			SendClientMessage(playerid, 0xFF0000FF, "Boxing: A deathmatch without weapons, only fisting.");
			SendClientMessage(playerid, 0xFF0000FF, "Your goal kill other people, and stay alive.");
			}else if(strcmp(tmp, "sdive", true) == 0){
			SendClientMessage(playerid, 0xFF0000FF, "SDive: A skydive minigame.");
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to land on the tower as first. You must stay alive for 2 seconds there.");
			}else if(strcmp(tmp, "kartrace", true) == 0){
			SendClientMessage(playerid, 0xFF0000FF, "Kartrace: A race with karts around the Bloodbowl.");
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to drive two laps in the fastest time.");
			}else if(strcmp(tmp, "srace", true) == 0){
			SendClientMessage(playerid, 0xFF0000FF, "SRace: A race in the Vice Stadium, with NRG's.");
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to drive one lap in the fastest time.");
		}
		SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
		return 1;
	}

	if(strcmp(cmd, "/derby", true) == 0)
	{
		if(derbyplaying == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "The derby is already started");
			return 1;
		}
		if(playerinminigame[playerid] == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
			return 1;
		}
		new pname[256];
		GetPlayerName(playerid, pname, 256);
		if(derbyon == 0)
		{
			derbyon = 1;
			playerinminigame[playerid] = 1;
			playerinderby[playerid] = 1;
			derbyrank = 1;
			SetPlayerInterior(playerid,15);
			SetPlayerVirtualWorld(playerid,7);
			SetVehicleVirtualWorld(bloodring[0],7);
			bloodringfull[0] = 1;
			PutPlayerInVehicle(playerid, bloodring[0], 0);
			playerinbloodring[playerid] = 0;
			TogglePlayerControllable(playerid, 0);
			startvar[0] = 1;
			dtimer = SetTimer("StartDerby", 60000, 0);
			format(string, sizeof(string), "%s has started a derby, you have one minute to type /derby and join", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(derbyon == 1 && derbyrank < 15) {
			playerinminigame[playerid] = 1;
			playerinderby[playerid] = 1;
			derbyrank++;
			SetPlayerInterior(playerid,15);
			for(new i=0; i<15; i++)
			{
				if(bloodringfull[i] == 0)
				{
					SetPlayerVirtualWorld(playerid,7);
					SetVehicleVirtualWorld(bloodring[i],7);
					bloodringfull[i] = 1;
					PutPlayerInVehicle(playerid, bloodring[i], 0);
					TogglePlayerControllable(playerid, 0);
					playerinbloodring[playerid] = i;
					format(string, sizeof(string), "%s has joined the derby", pname);//
					SendClientMessageToAll(0x33AA33AA,string);
					return 1;
				}
			}
			} else if(derbyon == 1 && derbyrank >= 15) {
			format(string, sizeof(string), "The derby is full, wait for the next round", pname);//
			SendClientMessage(playerid,0x33AA33AA,string);
			return 1;
		}
	}

	if(strcmp(cmd, "/teamdm", true) == 0)
	{
		if(tdmplaying == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "The team DM is already started");
			return 1;
		}
		if(playerinminigame[playerid] == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
			return 1;
		}
		new pname[256];
		GetPlayerName(playerid, pname, 256);
		if(tdmon == 0)
		{
			tdmon = 1;
			playerintdm[playerid] = 1;
			playerinminigame[playerid] = 1;
			tdmrank = 1;
			TogglePlayerControllable(playerid, 0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetPlayerPos(playerid,208.8376,1863.5388,13.1406);
			ResetPlayerWeapons(playerid);
			GivePlayerWeapon(playerid,26,50000);
			GivePlayerWeapon(playerid,31,50000);
			GivePlayerWeapon(playerid,32,50000);
			SetPlayerHealth(playerid,100);
			SetPlayerArmour(playerid,100);
			oldplayercolor[playerid] = GetPlayerColor(playerid);
			SetPlayerColor(playerid,0x0000BBAA);// BLUE
			blueplayers = 1;
			redplayers = 0;
			tdmcolor = 1;
			startvar[1] = 1;
			tdmtimer = SetTimer("Starttdm", 60000, 0);
			format(string, sizeof(string), "%s has started a team DM, team blue, you have one minute to type /teamdm and join", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(tdmon == 1 && tdmcolor == 1) {
			playerintdm[playerid] = 1;
			playerinminigame[playerid] = 1;
			tdmrank++;
			TogglePlayerControllable(playerid, 0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetPlayerPos(playerid,268.6240,1882.8805,-30.0938);
			ResetPlayerWeapons(playerid);
			GivePlayerWeapon(playerid,26,50000);
			GivePlayerWeapon(playerid,31,50000);
			GivePlayerWeapon(playerid,32,50000);
			SetPlayerHealth(playerid,100);
			SetPlayerArmour(playerid,100);
			oldplayercolor[playerid] = GetPlayerColor(playerid);
			SetPlayerColor(playerid,0xAA3333AA);// RED
			redplayers++;
			tdmcolor = 0;
			format(string, sizeof(string), "%s has joined the team DM, team red", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(tdmon == 1 && tdmcolor == 0) {
			playerintdm[playerid] = 1;
			playerinminigame[playerid] = 1;
			tdmrank++;
			TogglePlayerControllable(playerid, 0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetPlayerPos(playerid,208.8376,1863.5388,13.1406);
			ResetPlayerWeapons(playerid);
			GivePlayerWeapon(playerid,26,50000);
			GivePlayerWeapon(playerid,31,50000);
			GivePlayerWeapon(playerid,32,50000);
			SetPlayerHealth(playerid,100);
			SetPlayerArmour(playerid,100);
			oldplayercolor[playerid] = GetPlayerColor(playerid);
			SetPlayerColor(playerid,0x0000BBAA);// BLUE
			blueplayers++;
			tdmcolor = 1;
			format(string, sizeof(string), "%s has joined the team DM, team blue", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
		}
	}
	if(strcmp(cmd, "/lvdm", true) == 0)
	{
		if(dmplaying == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "The LVDM is already started");
			return 1;
		}
		if(playerinminigame[playerid] == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
			return 1;
		}
		new pname[256];
		GetPlayerName(playerid, pname, 256);
		if(dmon == 0)
		{
			dmon = 1;
			playerindm[playerid] = 1;
			playerinminigame[playerid] = 1;
			dmrank = 1;
			TogglePlayerControllable(playerid, 0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetPlayerPos(playerid,lvdmspawns[0][0],lvdmspawns[0][1],lvdmspawns[0][2]);
			ResetPlayerWeapons(playerid);
			GivePlayerWeapon(playerid,26,50000);
			GivePlayerWeapon(playerid,32,50000);
			GivePlayerWeapon(playerid,31,50000);
			SetPlayerHealth(playerid,100);
			SetPlayerArmour(playerid,100);
			startvar[2] = 1;
			dmtimer = SetTimer("Startdm", 60000, 0);
			format(string, sizeof(string), "%s has started a LVDM, you have one minute to type /lvdm and join", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(dmon == 1 && dmrank <= 15) {
			playerindm[playerid] = 1;
			TogglePlayerControllable(playerid, 0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetPlayerPos(playerid,lvdmspawns[dmrank][0],lvdmspawns[dmrank][1],lvdmspawns[dmrank][2]);
			dmrank++;
			ResetPlayerWeapons(playerid);
			GivePlayerWeapon(playerid,26,50000);
			GivePlayerWeapon(playerid,32,50000);
			GivePlayerWeapon(playerid,31,50000);
			SetPlayerHealth(playerid,100);
			SetPlayerArmour(playerid,100);
			format(string, sizeof(string), "%s has joined the LVDM", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(dmon == 1 && dmrank == 16) {
			format(string, sizeof(string), "The LVDM is full, wait for the next LVDM");//
			SendClientMessage(playerid,0x33AA33AA,string);
		}
	}

	if(strcmp(cmd, "/qderby", true) == 0)
	{
		if(qderbyplaying == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "The derby is already started");
			return 1;
		}
		if(playerinminigame[playerid] == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
			return 1;
		}
		new pname[256];
		GetPlayerName(playerid, pname, 256);
		if(qderbyon == 0)
		{
			Respawnqbloodrings();
			qderbyon = 1;
			playerinminigame[playerid] = 1;
			playerinqderby[playerid] = 1;
			qderbyrank = 1;
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetVehicleVirtualWorld(qbloodring[0],7);
			qbloodringfull[0] = 1;
			PutPlayerInVehicle(playerid, qbloodring[0], 0);
			playerinqbloodring[playerid] = 0;
			TogglePlayerControllable(playerid, 0);
			startvar[3] = 1;
			qdtimer = SetTimer("StartqDerby", 60000, 0);
			format(string, sizeof(string), "%s has started a quarry derby, you have one minute to type /qderby and join", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(qderbyon == 1 && qderbyrank < 15) {
			playerinminigame[playerid] = 1;
			playerinqderby[playerid] = 1;
			qderbyrank++;
			SetPlayerInterior(playerid,0);
			for(new i=0; i<15; i++)
			{
				if(qbloodringfull[i] == 0)
				{
					SetPlayerVirtualWorld(playerid,7);
					SetVehicleVirtualWorld(qbloodring[i],7);
					qbloodringfull[i] = 1;
					PutPlayerInVehicle(playerid, qbloodring[i], 0);
					TogglePlayerControllable(playerid, 0);
					playerinqbloodring[playerid] = i;
					format(string, sizeof(string), "%s has joined the quarry derby", pname);//
					SendClientMessageToAll(0x33AA33AA,string);
					return 1;
				}
			}
			} else if(qderbyon == 1 && qderbyrank >= 15) {
			format(string, sizeof(string), "The quarry derby is full, wait for the next round", pname);//
			SendClientMessage(playerid,0x33AA33AA,string);
			return 1;
		}
	}

	if(strcmp(cmd, "/boxing", true) == 0)
	{
		if(boxplaying == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "The boxing fight is already started");
			return 1;
		}
		if(playerinminigame[playerid] == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
			return 1;
		}
		new pname[256];
		GetPlayerName(playerid, pname, 256);
		if(boxon == 0)
		{
			boxon = 1;
			playerinbox[playerid] = 1;
			playerinminigame[playerid] = 1;
			boxrank = 1;
			TogglePlayerControllable(playerid, 0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetPlayerPos(playerid,2496.479,-1678.357,6997.348);
			ResetPlayerWeapons(playerid);
			SetPlayerHealth(playerid,50);
			startvar[4] = 1;
			boxtimer = SetTimer("StartBox", 60000, 0);
			format(string, sizeof(string), "%s has started a boxing fight, you have one minute to type /boxing and join", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(boxon == 1) {
			playerinbox[playerid] = 1;
			TogglePlayerControllable(playerid, 0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetPlayerPos(playerid,2496.479,-1678.357,6997.348);
			boxrank++;
			ResetPlayerWeapons(playerid);
			SetPlayerHealth(playerid,50);
			format(string, sizeof(string), "%s has joined the boxing fight", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
		}
	}
	if(strcmp(cmd, "/sdive", true) == 0)
	{
		if(sdplaying == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "The skydive is already started");
			return 1;
		}
		if(playerinminigame[playerid] == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
			return 1;
		}
		new pname[256];
		GetPlayerName(playerid, pname, 256);
		if(sdon == 0)
		{
			sdon = 1;
			playerinsd[playerid] = 1;
			playerinminigame[playerid] = 1;
			sdrank = 1;
			sdfirst = 1;
			TogglePlayerControllable(playerid, 0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetPlayerPos(playerid,-1753.7169,884.6819,1000.000);
			GivePlayerWeapon(playerid,46,1);
			startvar[5] = 1;
			sdtimer = SetTimer("StartSd", 60000, 0);
			SetPlayerRaceCheckpoint(playerid,0,-1753.7169,884.6819,295.8750,-1753.7169,884.6819,290.8750,1);
			format(string, sizeof(string), "%s has started a skydive, you have one minute to type /sdive and join", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(sdon == 1) {
			playerinsd[playerid] = 1;
			TogglePlayerControllable(playerid, 0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,7);
			SetPlayerPos(playerid,-1753.7169,884.6819,1000.000);
			sdrank++;
			GivePlayerWeapon(playerid,46,1);
			SetPlayerRaceCheckpoint(playerid,0,-1753.7169,884.6819,295.8750,-1753.7169,884.6819,290.8750,1);
			format(string, sizeof(string), "%s has joined the skydive", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
		}
	}

	if(strcmp(cmd, "/kartrace", true) == 0)
	{
		if(kartplaying == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "The kart race is already started");
			return 1;
		}
		if(playerinminigame[playerid] == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
			return 1;
		}
		new pname[256];
		GetPlayerName(playerid, pname, 256);
		if(karton == 0)
		{
			karton = 1;
			playerinminigame[playerid] = 1;
			playerinkartrace[playerid] = 1;
			kartrank = 1;
			krtfirst = 1;
			currentcheckpoint[playerid] = 0;
			SetPlayerInterior(playerid,15);
			SetPlayerVirtualWorld(playerid,7);
			SetVehicleVirtualWorld(karts[0],7);
			kartfull[0] = 1;
			PutPlayerInVehicle(playerid, karts[0], 0);
			playerinkart[playerid] = 0;
			TogglePlayerControllable(playerid, 0);
			SetPlayerRaceCheckpoint(playerid,0,kcps[0][0],kcps[0][1],kcps[0][2],kcps[1][0],kcps[1][1],kcps[1][2],20);
			startvar[6] = 1;
			krttimer = SetTimer("StartKart", 60000, 0);
			format(string, sizeof(string), "%s has started a kart race, you have one minute to type /kartrace and join", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(karton == 1 && kartrank < 15) {
			playerinminigame[playerid] = 1;
			playerinkartrace[playerid] = 1;
			kartrank++;
			currentcheckpoint[playerid] = 0;
			SetPlayerInterior(playerid,15);
			for(new i=0; i<15; i++)
			{
				if(kartfull[i] == 0)
				{
					SetPlayerVirtualWorld(playerid,7);
					SetVehicleVirtualWorld(karts[i],7);
					kartfull[i] = 1;
					PutPlayerInVehicle(playerid, karts[i], 0);
					TogglePlayerControllable(playerid, 0);
					SetPlayerRaceCheckpoint(playerid,0,kcps[0][0],kcps[0][1],kcps[0][2],kcps[1][0],kcps[1][1],kcps[1][2],20);
					playerinkart[playerid] = i;
					format(string, sizeof(string), "%s has joined the kart race", pname);//
					SendClientMessageToAll(0x33AA33AA,string);
					return 1;
				}
			}
			} else if(karton == 1 && kartrank >= 15) {
			format(string, sizeof(string), "The kart race is full, wait for the next round", pname);//
			SendClientMessage(playerid,0x33AA33AA,string);
			return 1;
		}
	}

	if(strcmp(cmd, "/srace", true) == 0)
	{
		if(srplaying == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "The stadium race is already started");
			return 1;
		}
		if(playerinminigame[playerid] == 1)
		{
			SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
			return 1;
		}
		new pname[256];
		GetPlayerName(playerid, pname, 256);
		if(sron == 0)
		{
			sron = 1;
			playerinminigame[playerid] = 1;
			playerinsr[playerid] = 1;
			srrank = 1;
			srfirst = 1;
			currentracecheckpoint[playerid] = 0;
			SetPlayerInterior(playerid,4);
			SetPlayerVirtualWorld(playerid,7);
			SetVehicleVirtualWorld(nrg[0],7);
			nrgfull[0] = 1;
			PutPlayerInVehicle(playerid, nrg[0], 0);
			playerinnrg[playerid] = 0;
			TogglePlayerControllable(playerid, 0);
			SetPlayerRaceCheckpoint(playerid,0,srcps[0][0],srcps[0][1],srcps[0][2],srcps[1][0],srcps[1][1],srcps[1][2],10);
			startvar[7] = 1;
			srtimer = SetTimer("StartSr", 60000, 0);
			format(string, sizeof(string), "%s has started a stadium race, you have one minute to type /srace and join", pname);//
			SendClientMessageToAll(0x33AA33AA,string);
			return 1;
			} else if(sron == 1 && srrank < 15) {
			playerinminigame[playerid] = 1;
			playerinsr[playerid] = 1;
			srrank++;
			currentracecheckpoint[playerid] = 0;
			SetPlayerInterior(playerid,4);
			for(new i=0; i<15; i++)
			{
				if(nrgfull[i] == 0)
				{
					SetPlayerVirtualWorld(playerid,7);
					SetVehicleVirtualWorld(nrg[i],7);
					nrgfull[i] = 1;
					PutPlayerInVehicle(playerid, nrg[i], 0);
					TogglePlayerControllable(playerid, 0);
					SetPlayerRaceCheckpoint(playerid,0,srcps[0][0],srcps[0][1],srcps[0][2],srcps[1][0],srcps[1][1],srcps[1][2],10);
					playerinnrg[playerid] = i;
					format(string, sizeof(string), "%s has joined the stadium race", pname);//
					SendClientMessageToAll(0x33AA33AA,string);
					return 1;
				}
			}
			} else if(sron == 1 && srrank >= 15) {
			format(string, sizeof(string), "The stadium race is full, wait for the next round", pname);//
			SendClientMessage(playerid,0x33AA33AA,string);
			return 1;
		}
	}

	return 0;
}

public OnPlayerInfoChange(playerid)
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == 2)
	{
		playercarid[playerid] = GetPlayerVehicleID(playerid);
	}
	if(oldstate == 2)
	{
		if(playerinderby[playerid] || playerinqderby[playerid] || playerinkartrace[playerid] || playerinsr[playerid])
		{
			PutPlayerInVehicle(playerid,playercarid[playerid],0);
		}
	}
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	if(playerinsd[playerid])
	{
		SetTimerEx("SdFinish",2000,0,"i",playerid);
		} else if(playerinkartrace[playerid]) {
		if(currentcheckpoint[playerid] <= 2)
		{
			currentcheckpoint[playerid]++;
			DisablePlayerRaceCheckpoint(playerid);
			SetPlayerRaceCheckpoint(playerid,0,kcps[currentcheckpoint[playerid]][0],kcps[currentcheckpoint[playerid]][1],kcps[currentcheckpoint[playerid]][2],
			kcps[currentcheckpoint[playerid]+1][0],kcps[currentcheckpoint[playerid]+1][1],kcps[currentcheckpoint[playerid]+1][2],20);
			} else if(currentcheckpoint[playerid] >= 3 && currentcheckpoint[playerid] != 7) {
			currentcheckpoint[playerid]++;
			DisablePlayerRaceCheckpoint(playerid);
			SetPlayerRaceCheckpoint(playerid,0,kcps[currentcheckpoint[playerid]-4][0],kcps[currentcheckpoint[playerid]-4][1],
			kcps[currentcheckpoint[playerid]-4][2],kcps[currentcheckpoint[playerid]-3][0],kcps[currentcheckpoint[playerid]-3][1],
			kcps[currentcheckpoint[playerid]-3][2],20);
			} else if(currentcheckpoint[playerid] == 7) {
			if(krtfirst == 1)
			{
				DisablePlayerRaceCheckpoint(playerid);
				new string[256];
				krtfirst++;
				kartrank--;
				new winnername[256];
				GetPlayerName(playerid,winnername, sizeof(winnername));
				RewardCalc(playerid,5000,10000);
				format(string, sizeof(string), "%s has won the kart race for $%d", winnername, reward);
				SendClientMessageToAll(0x33AA33AA, string);
				GivePlayerMoney(playerid,reward);
				playerinkartrace[playerid] = 0;
				playerinminigame[playerid] = 0;
				currentcheckpoint[playerid] = 0;
				SetPlayerVirtualWorld(playerid,0);
				SetPlayerInterior(playerid, 0);
				SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
				if(kartrank == 0)
				{
					KrtFinish();
					} else {
					SetTimer("KrtFinish",60000,0);
				}
				} else {
				DisablePlayerRaceCheckpoint(playerid);
				playerinkartrace[playerid] = 0;
				playerinminigame[playerid] = 0;
				currentcheckpoint[playerid] = 0;
				SetPlayerVirtualWorld(playerid,0);
				SetPlayerInterior(playerid, 0);
				SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
				if(kartrank == 0)
				{
					KrtFinish();
					} else {
					SetTimer("KrtFinish",60000,0);
				}
			}
		}
		} else if(playerinsr[playerid]) {
		if(currentracecheckpoint[playerid] <= 7)
		{
			currentracecheckpoint[playerid]++;
			DisablePlayerRaceCheckpoint(playerid);
			SetPlayerRaceCheckpoint(playerid,0,srcps[currentracecheckpoint[playerid]][0],srcps[currentracecheckpoint[playerid]][1],
			srcps[currentracecheckpoint[playerid]][2],srcps[currentracecheckpoint[playerid]+1][0],srcps[currentracecheckpoint[playerid]+1][1],
			srcps[currentracecheckpoint[playerid]+1][2],10);
			} else if(currentracecheckpoint[playerid] == 8) {
			if(srfirst == 1)
			{
				DisablePlayerRaceCheckpoint(playerid);
				new string[256];
				srfirst++;
				srrank--;
				new winnername[256];
				GetPlayerName(playerid,winnername, sizeof(winnername));
				RewardCalc(playerid,5000,10000);
				format(string, sizeof(string), "%s has won the stadium race for $%d", winnername, reward);
				SendClientMessageToAll(0x33AA33AA, string);
				GivePlayerMoney(playerid,reward);
				playerinsr[playerid] = 0;
				playerinminigame[playerid] = 0;
				currentracecheckpoint[playerid] = 0;
				SetPlayerVirtualWorld(playerid,0);
				SetPlayerInterior(playerid, 0);
				SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
				if(srrank == 0)
				{
					SrFinish();
					} else {
					SetTimer("SrFinish",60000,0);
				}
				} else {
				DisablePlayerRaceCheckpoint(playerid);
				playerinsr[playerid] = 0;
				playerinminigame[playerid] = 0;
				currentracecheckpoint[playerid] = 0;
				SetPlayerVirtualWorld(playerid,0);
				SetPlayerInterior(playerid, 0);
				SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
				if(srrank == 0)
				{
					SrFinish();
					} else {
					SetTimer("SrFinish",60000,0);
				}
			}
		}
	}
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public Spawnbloodrings()
{
	for(new i=0; i<15; i++)
	{
		bloodring[i] = CreateVehicle(504,derbycars[i][0],derbycars[i][1],derbycars[i][2],derbycars[i][3],-1,-1,-1);
		LinkVehicleToInterior(bloodring[i],15);
		SetVehicleVirtualWorld(bloodring[i],1);
		bloodringfull[i] = 0;
	}
	return 1;
}

public Destroybloodrings()
{
	for(new i=0; i<15; i++)
	{
		DestroyVehicle(bloodring[i]);
		bloodringfull[i] = 0;
	}
}

public Respawnbloodrings()
{
	for(new i=0; i<15; i++)
	{
		SetVehicleToRespawn(bloodring[i]);
		SetVehicleVirtualWorld(bloodring[i],1);
		bloodringfull[i] = 0;
	}
}

public Spawnqbloodrings()
{
	for(new i=0; i<15; i++)
	{
		qbloodring[i] = CreateVehicle(504,qderbycars[i][0],qderbycars[i][1],qderbycars[i][2],qderbycars[i][3],-1,-1,-1);
		SetVehicleVirtualWorld(qbloodring[i],1);
		qbloodringfull[i] = 0;
	}
	return 1;
}

public Destroyqbloodrings()
{
	for(new i=0; i<15; i++)
	{
		DestroyVehicle(qbloodring[i]);
		qbloodringfull[i] = 0;
	}
}

public Respawnqbloodrings()
{
	for(new i=0; i<15; i++)
	{
		SetVehicleToRespawn(qbloodring[i]);
		SetVehicleVirtualWorld(qbloodring[i],1);
		qbloodringfull[i] = 0;
	}
}

public SpawnKarts()
{
	for(new i=0; i<15; i++)
	{
		karts[i] = CreateVehicle(571,kartspawns[i][0],kartspawns[i][1],kartspawns[i][2],kartspawns[i][3],-1,-1,-1);
		LinkVehicleToInterior(karts[i],15);
		SetVehicleVirtualWorld(karts[i],1);
		kartfull[i] = 0;
	}
	return 1;
}

public DestroyKarts()
{
	for(new i=0; i<15; i++)
	{
		DestroyVehicle(karts[i]);
		kartfull[i] = 0;
	}
}

public RespawnKarts()
{
	for(new i=0; i<15; i++)
	{
		SetVehicleToRespawn(karts[i]);
		SetVehicleVirtualWorld(karts[i],1);
		kartfull[i] = 0;
	}
}

public SpawnNrgs()
{
	for(new i=0; i<15; i++)
	{
		nrg[i] = CreateVehicle(522,nrgspawns[i][0],nrgspawns[i][1],nrgspawns[i][2],nrgspawns[i][3],-1,-1,-1);
		LinkVehicleToInterior(nrg[i],4);
		SetVehicleVirtualWorld(nrg[i],1);
		nrgfull[i] = 0;
	}
	return 1;
}

public DestroyNrgs()
{
	for(new i=0; i<15; i++)
	{
		DestroyVehicle(nrg[i]);
		nrgfull[i] = 0;
	}
}

public RespawnNrgs()
{
	for(new i=0; i<15; i++)
	{
		SetVehicleToRespawn(nrg[i]);
		SetVehicleVirtualWorld(nrg[i],1);
		nrgfull[i] = 0;
	}
}

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}

public StartDerby()
{
	new delay = 1000;
	new string[32];
	if(startvar[0] == 1)
	{
		if( derbyrank <= 1 )
		{
			SendClientMessageToAll(0x33AA33AA, "Derby canceled. Reason: Not enough players. (minimum = 2)");
			derbyplaying = 0;
			derbyrank = 0;
			derbyon = 0;
			startvar[0] = 0;
			Respawnbloodrings();
			for(new i = 0; i <= MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if (playerinderby[i] == 1)
					{
						playerinderby[i] = 0;
						playerinminigame[i] = 0;
						playerinbloodring[i] = -1;
						SetPlayerVirtualWorld(i,0);
						SetPlayerInterior(i, 0);
						SetPlayerPos(i, spawnX, spawnY, spawnZ);
						TogglePlayerControllable(i, 1);
					}
				}
			}
			return 1;
		}
		format(string, sizeof(string), "~r~Ready");
		derbyplaying = 1;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinderby[i] == 1)
				{
					GameTextForPlayer(i, string, delay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[0] = 2;
		SetTimer("StartDerby", delay, 0);
		} else if(startvar[0] == 2) {
		format(string, sizeof(string), "~r~Set");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinderby[i] == 1)
				{
					GameTextForPlayer(i, string, delay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[0] = 3;
		SetTimer("StartDerby", delay, 0);
		} else if(startvar[0] == 3) {
		format(string, sizeof(string), "~g~RAM!");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinderby[i] == 1)
				{
					GameTextForPlayer(i, string, delay, 6);
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					TogglePlayerControllable(i, 1);
				}
			}
		}
		startvar[0] = 0;
	}
	return 1;
}

public Starttdm()
{
	new delay=1000;
	new string[32];
	if(startvar[1] == 1)
	{
		if( tdmrank <= 1 )
		{
			SendClientMessageToAll(0x33AA33AA, "Team DM canceled. Reason: Not enough players. (minimum = 2)");
			tdmplaying = 0;
			tdmrank = 0;
			tdmon = 0;
			startvar[1] = 0;
			for(new i = 0; i <= MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if (playerintdm[i] == 1)
					{
						playerintdm[i] = 0;
						playerinminigame[i] = 0;
						SetPlayerVirtualWorld(i,0);
						SetPlayerInterior(i, 0);
						SetPlayerPos(i, spawnX, spawnY, spawnZ);
						TogglePlayerControllable(i, 1);
					}
				}
			}
			return 1;
		}
		format(string, sizeof(string), "~r~Ready");
		tdmplaying = 1;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerintdm[i] == 1)
				{
					GameTextForPlayer(i, string, delay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[1] = 2;
		SetTimer("Starttdm", delay, 0);
		} else if(startvar[1] == 2) {
		format(string, sizeof(string), "~r~Set");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerintdm[i] == 1)
				{
					GameTextForPlayer(i, string, delay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[1] = 3;
		SetTimer("Starttdm", delay, 0);
		} else if(startvar[1] == 3) {
		format(string, sizeof(string), "~g~FIGHT!");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerintdm[i] == 1)
				{
					GameTextForPlayer(i, string, delay, 6);
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					TogglePlayerControllable(i, 1);
				}
			}
		}
		startvar[1] = 0;
	}
	return 1;
}

public Startdm()
{
	if(startvar[2] == 1)
	{
		if( dmrank <= 1 )
		{
			SendClientMessageToAll(0x33AA33AA, "LVDM canceled. Reason: Not enough players. (minimum = 2)");
			dmplaying = 0;
			dmrank = 0;
			dmon = 0;
			startvar[2] = 0;
			for(new i = 0; i <= MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if (playerindm[i] == 1)
					{
						playerindm[i] = 0;
						playerinminigame[i] = 0;
						SetPlayerVirtualWorld(i,0);
						SetPlayerInterior(i, 0);
						SetPlayerPos(i, spawnX, spawnY, spawnZ);
						TogglePlayerControllable(i, 1);
					}
				}
			}
			return 1;
		}
		new string[32];
		format(string, sizeof(string), "~r~Ready");
		new gdelay=1000;
		dmplaying = 1;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerindm[i] == 1)
				{
					GameTextForPlayer(i, string, gdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[2] = 2;
		SetTimer("Startdm", gdelay, 0);
		} else if(startvar[2] == 2) {
		new string[32];
		format(string, sizeof(string), "~r~Set");
		new hdelay=1000;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerindm[i] == 1)
				{
					GameTextForPlayer(i, string, hdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[2] = 3;
		SetTimer("Startdm", hdelay, 0);
		} else if(startvar[2] == 3) {
		new rdelay=1000;
		new string[32];
		format(string, sizeof(string), "~g~FIGHT!");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerindm[i] == 1)
				{
					GameTextForPlayer(i, string, rdelay, 6);
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					TogglePlayerControllable(i, 1);
				}
			}
		}
		startvar[2] = 0;
	}
	return 1;
}

public StartqDerby()
{
	if(startvar[3] == 1)
	{
		if( qderbyrank <= 1 )
		{
			SendClientMessageToAll(0x33AA33AA, "Quarry derby canceled. Reason: Not enough players. (minimum = 2)");
			qderbyplaying = 0;
			qderbyrank = 0;
			qderbyon = 0;
			startvar[3] = 0;
			Respawnqbloodrings();
			for(new i = 0; i <= MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if (playerinqderby[i] == 1)
					{
						playerinqderby[i] = 0;
						playerinminigame[i] = 0;
						playerinqbloodring[i] = -1;
						SetPlayerVirtualWorld(i,0);
						SetPlayerInterior(i, 0);
						SetPlayerPos(i, spawnX, spawnY, spawnZ);
						TogglePlayerControllable(i, 1);
					}
				}
			}
			return 1;
		}
		new string[32];
		format(string, sizeof(string), "~r~Ready");
		new gdelay=1000;
		qderbyplaying = 1;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinqderby[i] == 1)
				{
					GameTextForPlayer(i, string, gdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[3] = 2;
		SetTimer("StartqDerby", gdelay, 0);
		} else if(startvar[3] == 2) {
		new string[32];
		format(string, sizeof(string), "~r~Set");
		new hdelay=1000;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinqderby[i] == 1)
				{
					GameTextForPlayer(i, string, hdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[3] = 3;
		SetTimer("StartqDerby", hdelay, 0);
		} else if(startvar[3] == 3) {
		new rdelay=1000;
		new string[32];
		format(string, sizeof(string), "~g~RAM!");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinqderby[i] == 1)
				{
					GameTextForPlayer(i, string, rdelay, 6);
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					TogglePlayerControllable(i, 1);
				}
			}
		}
		startvar[3] = 0;
	}
	return 1;
}

public StartBox()
{
	if(startvar[4] == 1)
	{
		if( boxrank <= 1 )
		{
			SendClientMessageToAll(0x33AA33AA, "boxing fight canceled. Reason: Not enough players. (minimum = 2)");
			boxplaying = 0;
			boxrank = 0;
			boxon = 0;
			startvar[4] = 0;
			for(new i = 0; i <= MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if (playerinbox[i] == 1)
					{
						playerinbox[i] = 0;
						playerinminigame[i] = 0;
						SetPlayerVirtualWorld(i,0);
						SetPlayerInterior(i, 0);
						SetPlayerPos(i, spawnX, spawnY, spawnZ);
						TogglePlayerControllable(i, 1);
					}
				}
			}
			return 1;
		}
		new string[32];
		format(string, sizeof(string), "~r~Ready");
		new gdelay=1000;
		boxplaying = 1;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinbox[i] == 1)
				{
					GameTextForPlayer(i, string, gdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[4] = 2;
		SetTimer("StartBox", gdelay, 0);
		} else if(startvar[4] == 2) {
		new string[32];
		format(string, sizeof(string), "~r~Set");
		new hdelay=1000;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinbox[i] == 1)
				{
					GameTextForPlayer(i, string, hdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[4] = 3;
		SetTimer("StartBox", hdelay, 0);
		} else if(startvar[4] == 3) {
		new rdelay=1000;
		new string[32];
		format(string, sizeof(string), "~g~FIGHT!");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinbox[i] == 1)
				{
					GameTextForPlayer(i, string, rdelay, 6);
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					TogglePlayerControllable(i, 1);
				}
			}
		}
		startvar[4] = 0;
	}
	return 1;
}

public StartSd()
{
	if(startvar[5] == 1)
	{
		if( sdrank <= 1 )
		{
			SendClientMessageToAll(0x33AA33AA, "Skydive canceled. Reason: Not enough players. (minimum = 2)");
			sdplaying = 0;
			sdrank = 0;
			sdon = 0;
			startvar[5] = 0;
			for(new i = 0; i <= MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if (playerinsd[i] == 1)
					{
						playerinsd[i] = 0;
						playerinminigame[i] = 0;
						SetPlayerVirtualWorld(i,0);
						SetPlayerInterior(i, 0);
						SetPlayerPos(i, spawnX, spawnY, spawnZ);
						TogglePlayerControllable(i, 1);
					}
				}
			}
			return 1;
		}
		new string[32];
		format(string, sizeof(string), "~r~Ready");
		new gdelay=1000;
		sdplaying = 1;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinsd[i] == 1)
				{
					GameTextForPlayer(i, string, gdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[5] = 2;
		SetTimer("StartSd", gdelay, 0);
		} else if(startvar[5] == 2) {
		new string[32];
		format(string, sizeof(string), "~r~Set");
		new hdelay=1000;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinsd[i] == 1)
				{
					GameTextForPlayer(i, string, hdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[5] = 3;
		SetTimer("StartSd", hdelay, 0);
		} else if(startvar[5] == 3) {
		new rdelay=1000;
		new string[32];
		format(string, sizeof(string), "~g~GO!");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinsd[i] == 1)
				{
					GameTextForPlayer(i, string, rdelay, 6);
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					TogglePlayerControllable(i, 1);
				}
			}
		}
		SetTimer("EndSd",180000,0);
		startvar[5] = 0;
	}
	return 1;
}

public EndSd()
{
	for(new i = 0; i <= MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if (playerinsd[i] == 1)
			{
				playerinsd[i] = 0;
				playerinminigame[i] = 0;
				SetPlayerVirtualWorld(i,0);
				SetPlayerInterior(i, 0);
				SetPlayerPos(i, spawnX, spawnY, spawnZ);
			}
		}
	}
	sdplaying = 0;
	sdrank = 0;
	sdon = 0;
	startvar[5] = 0;
	SendClientMessageToAll(0x33AA33AA, "The skydive has ended");
	return 1;
}

public StartKart()
{
	if(startvar[6] == 1) {
		if( kartrank <= 1 )
		{
			SendClientMessageToAll(0x33AA33AA, "Kart race canceled. Reason: Not enough players. (minimum = 2)");
			kartplaying = 0;
			kartrank = 0;
			karton = 0;
			startvar[6] = 0;
			RespawnKarts();
			for(new i = 0; i <= MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if (playerinkartrace[i] == 1)
					{
						playerinkartrace[i] = 0;
						playerinminigame[i] = 0;
						playerinkart[i] = -1;
						SetPlayerVirtualWorld(i,0);
						SetPlayerInterior(i, 0);
						SetPlayerPos(i, spawnX, spawnY, spawnZ);
						TogglePlayerControllable(i, 1);
					}
				}
			}
			return 1;
		}
		new string[32];
		format(string, sizeof(string), "~r~Ready");
		new gdelay=1000;
		kartplaying = 1;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinkartrace[i] == 1)
				{
					GameTextForPlayer(i, string, gdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[6] = 2;
		SetTimer("StartKart", gdelay, 0);
		} else if(startvar[6] == 2) {
		new string[32];
		format(string, sizeof(string), "~r~Set");
		new hdelay=1000;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinkartrace[i] == 1)
				{
					GameTextForPlayer(i, string, hdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[6] = 3;
		SetTimer("StartKart", hdelay, 0);
		} else if(startvar[6] == 3) {
		new rdelay=1000;
		new string[32];
		format(string, sizeof(string), "~g~GO!");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinkartrace[i] == 1)
				{
					GameTextForPlayer(i, string, rdelay, 6);
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					TogglePlayerControllable(i, 1);
				}
			}
		}
		SetTimer("KrtFinish",300000,0);
		startvar[6] = 0;
	}
	return 1;
}

public StartSr()
{
	if(startvar[7] == 1)
	{
		if( srrank <= 1 )
		{
			SendClientMessageToAll(0x33AA33AA, "Stadium race canceled. Reason: Not enough players. (minimum = 2)");
			srplaying = 0;
			srrank = 0;
			sron = 0;
			startvar[7] = 0;
			RespawnNrgs();
			for(new i = 0; i <= MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if (playerinsr[i] == 1)
					{
						playerinsr[i] = 0;
						playerinminigame[i] = 0;
						playerinnrg[i] = -1;
						SetPlayerVirtualWorld(i,0);
						SetPlayerInterior(i, 0);
						SetPlayerPos(i, spawnX, spawnY, spawnZ);
						TogglePlayerControllable(i, 1);
					}
				}
			}
			return 1;
		}
		new string[32];
		format(string, sizeof(string), "~r~Ready");
		new gdelay=1000;
		kartplaying = 1;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinsr[i] == 1)
				{
					GameTextForPlayer(i, string, gdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[7] = 2;
		SetTimer("StartSr", gdelay, 0);
		} else if(startvar[7] == 2) {
		new string[32];
		format(string, sizeof(string), "~r~Set");
		new hdelay=1000;
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinsr[i] == 1)
				{
					GameTextForPlayer(i, string, hdelay, 6);
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		startvar[7] = 3;
		SetTimer("StartSr", hdelay, 0);
		} else if(startvar[7] == 3) {
		new rdelay=1000;
		new string[32];
		format(string, sizeof(string), "~g~GO!");
		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if (playerinsr[i] == 1)
				{
					GameTextForPlayer(i, string, rdelay, 6);
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					TogglePlayerControllable(i, 1);
				}
			}
		}
		SetTimer("SrFinish",300000,0);
		startvar[7] = 0;
	}
	return 1;
}

public RewardCalc(playerid,min,max)//Originally from PenLS
{
	reward = (min + (random(max-min)));
}

public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
	if(IsPlayerConnected(playerid))
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		tempposx = (oldposx -x);
		tempposy = (oldposy -y);
		tempposz = (oldposz -z);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}

public SdFinish(playerid)
{
	if(playerinsd[playerid] == 1 && PlayerToPoint(5,playerid,-1753.7169,884.6819,295.8750))
	{
		if(sdfirst == 1)
		{
			DisablePlayerRaceCheckpoint(playerid);
			new string[256];
			sdfirst = 0;
			new winnername[256];
			GetPlayerName(playerid,winnername, sizeof(winnername));
			RewardCalc(playerid,5000,10000);
			format(string, sizeof(string), "%s has won the skydive for $%d", winnername, reward);
			SendClientMessageToAll(0x33AA33AA, string);
			GivePlayerMoney(playerid,reward);
			playerinsd[playerid] = 0;
			playerinminigame[playerid] = 0;
			SetPlayerVirtualWorld(playerid,0);
			SetPlayerInterior(playerid, 0);
			SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
			SetTimer("EndSd",60000,0);
			} else {
			DisablePlayerRaceCheckpoint(playerid);
			playerinsd[playerid] = 0;
			playerinminigame[playerid] = 0;
			SetPlayerVirtualWorld(playerid,0);
			SetPlayerInterior(playerid, 0);
			SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
		}
	}
}

public load()
{
	Spawnbloodrings();
	Spawnqbloodrings();
	SpawnKarts();
	SpawnNrgs();

	CreateObject(975, 213.7231, 1875.3864, 13.8800, 0.0000, 0.0000, 180);// area 51 gate for TeamDM

	// LVDM zone:
	CreateObject(975,2237.232,2453.272,11.353,0.0,0.0,90.000);//Gates
	CreateObject(975,2293.831,2499.356,4.016,0.0,0.0,90.000);
	CreateObject(975,2335.095,2443.816,6.436,0.0,0.0,56.250);
	CreateObject(1225,2242.148,2481.337,2.679,0.0,0.0,0.0);//Explosive barrels
	CreateObject(1225,2249.003,2476.099,2.679,0.0,0.0,0.0);
	CreateObject(1225,2269.786,2485.744,2.679,0.0,0.0,0.0);
	CreateObject(1225,2309.837,2472.542,2.679,0.0,0.0,0.0);
	CreateObject(1225,2296.421,2456.946,2.679,0.0,0.0,0.0);
	CreateObject(1225,2276.625,2436.773,2.679,0.0,0.0,0.0);
	CreateObject(1225,2251.733,2443.828,2.679,0.0,0.0,0.0);
	CreateObject(1225,2335.119,2447.098,5.029,0.0,0.0,0.0);
	CreateObject(1225,2334.300,2446.371,4.971,0.0,0.0,0.0);
	CreateObject(1225,2332.263,2444.455,4.774,0.0,0.0,0.0);
	CreateObject(1225,2333.340,2443.961,5.007,0.0,0.0,0.0);
	CreateObject(1225,2332.409,2441.871,5.056,0.0,0.0,0.0);
	CreateObject(1225,2329.335,2443.138,4.298,0.0,0.0,0.0);
	CreateObject(1225,2328.618,2445.822,4.055,0.0,0.0,0.0);
	CreateObject(1225,2330.095,2446.103,4.320,0.0,0.0,0.0);
	CreateObject(1225,2329.184,2444.807,4.575,0.0,0.0,0.0);
	CreateObject(1556,2294.025,2494.454,3.789,0.0,0.0,-90.000);//Door

	CreateObject(16681,2494.841,-1676.981,7000.000,0.0,0.0,0.0);//Boxing Arena

	SendClientMessageToAll(0xFFFF00AA,"Minigames filterscript loaded. Type /minigames for more information.");
}

public KrtFinish()
{
	for(new i = 0; i <= MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if (playerinkartrace[i] == 1)
			{
				playerinkartrace[i] = 0;
				playerinminigame[i] = 0;
				SetPlayerVirtualWorld(i,0);
				SetPlayerInterior(i, 0);
				SetPlayerPos(i, spawnX, spawnY, spawnZ);
			}
		}
	}
	kartplaying = 0;
	kartrank = 0;
	karton = 0;
	RespawnKarts();
	SendClientMessageToAll(0x33AA33AA, "The kart race has ended");
	return 1;
}

public SrFinish()
{
	for(new i = 0; i <= MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if (playerinsr[i] == 1)
			{
				playerinsr[i] = 0;
				playerinminigame[i] = 0;
				SetPlayerVirtualWorld(i,0);
				SetPlayerInterior(i, 0);
				SetPlayerPos(i, spawnX, spawnY, spawnZ);
			}
		}
	}
	srplaying = 0;
	srrank = 0;
	sron = 0;
	RespawnNrgs();
	SendClientMessageToAll(0x33AA33AA, "The stadium race has ended");
	return 1;
}
Thank you
Reply
#2

fixed thanks
Reply
#3

You need to add a forward for those two functions.
Reply
#4

fixed thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)