View difference between Paste ID: FS2cUVJh and f2f43ca9a
SHOW: | | - or go back to the newest paste.
1
/* Made by DutchDominator AKA H4rdc0r3.
2
#  Do not claim this as your own, if you use it, don't forget the credits.
3
#  Yes, you may change this script and republish it, but keep credits to me.*/
4
5
6
#include <a_samp>
7
8
#define FILTERSCRIPT
9
10
//These are the coordinates your player will spawn at if they are still alive at the end of a minigame:
11
12
#define spawnX 1310.000000
13
#define spawnY -1370.199951
14
#define spawnZ 13.500000
15
16
new playerinminigame[MAX_PLAYERS];
17
18
new bloodring[15],derbyon,derbyplaying,playercarid[MAX_PLAYERS],playerinderby[MAX_PLAYERS],derbyrank,reward,bloodringfull[15],playerinbloodring[MAX_PLAYERS];
19
20
new tdmon,tdmplaying,playerintdm[MAX_PLAYERS],tdmrank,redplayers,blueplayers,tdmcolor,oldplayercolor[MAX_PLAYERS];
21
22
new dmon,dmplaying,playerindm[MAX_PLAYERS],dmrank;
23
24
new qbloodring[15],qbloodringfull[15],playerinqderby[MAX_PLAYERS],playerinqbloodring[MAX_PLAYERS],qderbyrank,qderbyon,qderbyplaying;
25
26
new boxon,boxplaying,playerinbox[MAX_PLAYERS],boxrank;
27
28
new sdon,sdplaying,playerinsd[MAX_PLAYERS],sdrank,sdfirst;
29
30
new karts[15],kartfull[15],karton,kartplaying,playerinkartrace[MAX_PLAYERS],kartrank,playerinkart[MAX_PLAYERS],currentcheckpoint[MAX_PLAYERS],krtfirst;
31
32
new nrg[15],nrgfull[15],sron,srplaying,playerinsr[MAX_PLAYERS],srrank,playerinnrg[MAX_PLAYERS],currentracecheckpoint[MAX_PLAYERS],srfirst;
33
34
new startvar[8];
35
36
//Timers:
37
38
new dtimer,dmtimer,tdmtimer,qdtimer,boxtimer,sdtimer,krttimer,srtimer;
39
40
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
41
forward load();
42
43
forward Spawnbloodrings();// Derby
44
forward Destroybloodrings();
45
forward Respawnbloodrings();
46
forward StartDerby();
47
48
forward Starttdm();// TeamDM
49
50
forward Startdm();// LVDM
51
52
forward Spawnqbloodrings();// Quarry Derby
53
forward Destroyqbloodrings();
54
forward Respawnqbloodrings();
55
forward StartqDerby();
56
57
forward StartBox();// Boxing Fight
58
59
forward StartSd();// Skydive
60
forward EndSd();
61
forward SdFinish(playerid);
62
63
forward SpawnKarts();// KartRace
64
forward DestroyKarts();
65
forward RespawnKarts();
66
forward StartKart();
67
forward KrtFinish();
68
69
forward SpawnNrgs();// Stadium Race
70
forward DestroyNrgs();
71
forward RespawnNrgs();
72
forward StartSr();
73
forward SrFinish();
74
75
forward RewardCalc(playerid,min,max);// General reward calc.
76
77
78
// Derby cars:
79
new Float:derbycars[15][4] = {
80
{-1362.9799,932.8219,1036.0580,9.0890}, // 0
81
{-1346.4526,935.4996,1036.0889,13.6811}, // 1
82
{-1335.6995,938.2600,1036.1177,16.8043}, // 2
83
{-1320.8756,944.9904,1036.2062,27.0307}, // 3
84
{-1306.8385,953.5919,1036.3212,37.8366}, // 4
85
{-1353.9670,934.0486,1036.2421,11.5836}, // 5
86
{-1328.6377,941.0197,1036.3208,18.9670}, // 6
87
{-1313.9012,948.6513,1036.4198,29.5596}, // 7
88
{-1501.0956,960.3203,1036.9474,313.0457}, // 8
89
{-1506.8105,968.1082,1037.0840,304.3027}, // 9
90
{-1513.0317,976.8713,1037.2457,301.9500}, // 10
91
{-1516.0858,988.2343,1037.4362,274.5044}, // 11
92
{-1517.6569,995.6628,1037.5626,272.2782}, // 12
93
{-1515.1127,1004.8807,1037.6969,262.3869}, // 13
94
{-1510.7020,1014.6202,1037.8568,249.1825} // 14
95
};
96
97
98
// LVDM Spawn places:
99
new Float:lvdmspawns[15][3] = {
100
{2297.5220,2484.1804,3.2734}, // 0
101
{2271.5120,2474.2268,3.2734}, // 1
102
{2244.7441,2467.5762,3.2734}, // 2
103
{2248.0867,2448.3484,3.2734}, // 3
104
{2267.7366,2439.3997,3.2734}, // 4
105
{2286.3911,2434.0715,3.2734}, // 5
106
{2302.9141,2441.9189,3.2734}, // 6
107
{2265.5151,2494.8433,-0.3329}, // 7
108
{2300.1218,2483.3733,-7.4531}, // 8
109
{2281.1760,2480.1216,-7.4531}, // 9
110
{2251.8474,2473.7490,-7.4531}, // 10
111
{2227.2383,2460.1196,-7.4531}, // 11
112
{2250.4229,2440.2544,-7.4531}, // 12
113
{2293.2231,2438.4878,-7.4531}, // 13
114
{2301.3645,2452.4045,-7.4531} // 14
115
};
116
117
// Quarry derby cars:
118
new Float:qderbycars[15][4] = {
119
{605.7057,815.2199,-43.1692,350.9785}, // 0
120
{609.4918,814.6188,-43.1692,350.9785}, // 1
121
{613.3760,814.0021,-43.1692,350.9785}, // 2
122
{616.5115,813.5043,-43.1692,350.9785}, // 3
123
{619.8624,812.9723,-43.1691,350.9785}, // 4
124
{622.9971,812.4746,-43.1691,350.9785}, // 5
125
{678.2766,922.8008,-41.0451,115.3092}, // 6
126
{680.1019,918.9395,-41.0066,115.3092}, // 7
127
{681.3400,916.3724,-40.6739,115.2029}, // 8
128
{682.7889,913.2912,-40.3585,115.2062}, // 9
129
{491.2690,912.7574,-30.6622,248.8228}, // 10
130
{489.9630,909.3635,-30.6003,248.8228}, // 11
131
{488.5172,905.6060,-30.5318,248.8228}, // 12
132
{488.1009,902.4600,-30.4778,262.3300}, // 13
133
{487.7645,899.9181,-30.4341,262.3300} // 14
134
};
135
136
// Karts:
137
new Float:kartspawns[15][4] = {
138
{-1366.1909,906.8451,1040.5919,280.3004}, // 0
139
{-1366.4854,908.3992,1040.2843,280.3004}, // 1
140
{-1366.8508,910.3288,1039.9022,280.3004}, // 2
141
{-1367.2168,912.2613,1039.5195,280.3004}, // 3
142
{-1367.7562,915.1094,1038.9557,280.3004}, // 4
143
{-1368.4265,918.6667,1038.4503,280.3231}, // 5
144
{-1368.8036,920.6827,1038.1428,280.3231}, // 6
145
{-1369.1410,922.4866,1037.8677,280.3231}, // 7
146
{-1372.5338,921.9490,1037.9705,277.8816}, // 8
147
{-1372.2379,919.8677,1038.2872,277.8816}, // 9
148
{-1371.9086,917.5515,1038.6396,277.8816}, // 10
149
{-1371.6196,915.5192,1038.9486,277.8816}, // 11
150
{-1371.2595,912.9866,1039.3340,277.8816}, // 12
151
{-1371.0453,911.4792,1039.5632,277.8816}, // 13
152
{-1370.6086,908.9531,1040.1785,275.7079} // 14
153
};
154
155
new Float:nrgspawns[15][4] = {
156
{-1436.5146,-595.6609,1055.5591,86.0952},
157
{-1436.4534,-594.7911,1055.4529,86.1336},
158
{-1436.3988,-594.0178,1055.3585,86.1336},
159
{-1436.3256,-592.9784,1055.2316,86.1336},
160
{-1436.2520,-591.9318,1055.1398,86.1124},
161
{-1436.1643,-590.6272,1055.0952,86.1436},
162
{-1436.1060,-589.7750,1055.0508,86.1436},
163
{-1436.0160,-588.4620,1054.9822,86.1436},
164
{-1435.9694,-587.7808,1054.9465,86.1436},
165
{-1435.9060,-586.8561,1054.8982,86.1436},
166
{-1435.8304,-586.0049,1054.8535,85.9079},
167
{-1435.7190,-584.4737,1054.7749,85.9079},
168
{-1435.6482,-583.4991,1054.7249,85.9079},
169
{-1435.5737,-582.4772,1054.6724,85.9079},
170
{-1435.4778,-581.1537,1054.5422,85.8982}
171
};
172
173
// Kartrace checkpoints:
174
new Float:kcps[5][3] = {
175
{-1262.4230,1028.3113,1039.6948},
176
{-1433.8792,1083.7178,1039.0344},
177
{-1540.4967,1004.6923,1039.1409},
178
{-1392.7269,914.2321,1039.8306},
179
{-1392.7269,914.2321,1039.8306}
180
};
181
182
new Float:srcps[10][3] = {
183
{-1515.0345,-646.2552,1049.8767},
184
{-1379.9943,-743.5076,1051.6895},
185
{-1373.9252,-665.4581,1055.8362},
186
{-1477.3721,-616.7951,1053.4919},
187
{-1437.9470,-669.4881,1053.0645},
188
{-1382.3152,-722.2056,1055.6273},
189
{-1335.7629,-637.1422,1054.2230},
190
{-1386.6233,-589.4922,1056.3871},
191
{-1421.6000,-588.1021,1055.8623},
192
{-1421.6000,-588.1021,1055.8623}
193
};
194
195
196
#if defined FILTERSCRIPT
197
198
public OnFilterScriptInit()
199
{
200
	SetTimer("load",2000,0);
201
	return 1;
202
}
203
204
public OnFilterScriptExit()
205
{
206
    Destroybloodrings();
207
    Destroyqbloodrings();
208
    DestroyKarts();
209
    DestroyNrgs();
210
	return 1;
211
}
212
213
#endif
214
215
public OnGameModeInit()
216
{
217
	SetTimer("load",2000,0);
218
	return 1;
219
}
220
221
public OnGameModeExit()
222
{
223
    Destroybloodrings();
224
    Destroyqbloodrings();
225
    DestroyKarts();
226
    DestroyNrgs();
227
	return 1;
228
}
229
230
public OnPlayerRequestClass(playerid, classid)
231
{
232
	return 1;
233
}
234
235
public OnPlayerRequestSpawn(playerid)
236
{
237
	return 1;
238
}
239
240
public OnPlayerConnect(playerid)
241
{
242
	playerinminigame[playerid] = 0; // Checks if a player is in a minigame
243
	playercarid[playerid] = -1; // Car that player currently is in, used to check whether the player is in a derby/race car
244
	
245
	playerinderby[playerid] = 0; // Derby
246
	playerinbloodring[playerid] = -1;
247
	
248
	playerintdm[playerid] = 0; // TeamDM
249
	
250
	playerindm[playerid] = 0; // LVDM
251
	
252
	playerinqderby[playerid] = 0; // Quarry Derby
253
	playerinqbloodring[playerid] = -1;
254
	
255
	playerinbox[playerid] = 0; // Boxing Fight
256
	
257
	playerinkartrace[playerid] = 0; // Kart Race
258
	playerinkart[playerid] = -1;
259
	currentcheckpoint[playerid] = 0;
260
	return 1;
261
}
262
263
public OnPlayerDisconnect(playerid, reason)
264
{
265
    new string[256];
266
	if(playerinderby[playerid] == 1)
267
	{
268
	    new DerbyPlayerName[MAX_PLAYER_NAME];
269
	    GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
270
		format(string, sizeof(string), "%s has been dropped out of the derby, rank: %d", DerbyPlayerName, derbyrank);
271
		SendClientMessageToAll(0x33AA33AA, string);
272
		playerinderby[playerid] = 0;
273
		playerinminigame[playerid] = 0;
274
		bloodringfull[playerinbloodring[playerid]] = 0;
275
		playerinbloodring[playerid] = -1;
276
		if(derbyrank <= 2)
277
		{
278
			for(new i=0; i<MAX_PLAYERS; i++)
279
			{
280
				if (IsPlayerConnected(i) && playerinderby[i] == 1)
281
				{
282
				    new winnername[256];
283
					GetPlayerName(i,winnername, sizeof(winnername));
284
					RewardCalc(i,100,1000);
285
					format(string, sizeof(string), "%s has won the derby for $%d", winnername, reward);
286
					SendClientMessageToAll(0x33AA33AA, string);
287
					GivePlayerMoney(i,reward);
288
					playerinderby[i] = 0;
289
					playerinminigame[i] = 0;
290
					SetPlayerVirtualWorld(i,0);
291
					SetPlayerInterior(playerid, 0);
292
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
293
				}
294
			}
295
		    derbyplaying = 0;
296
		    derbyrank = 0;
297
		    derbyon = 0;
298
		    KillTimer(dtimer);
299
	    	Respawnbloodrings();
300
	    	return 1;
301
		}
302
		derbyrank--;
303
	} else if(playerintdm[playerid] == 1) {
304
	    new tdmPlayerName[MAX_PLAYER_NAME];
305
	    GetPlayerName(playerid, tdmPlayerName, sizeof(tdmPlayerName));
306
	    if(GetPlayerColor(playerid) == 0x0000BBAA)
307
	    {
308
			format(string, sizeof(string), "%s has been dropped out of the team DM, team blue", tdmPlayerName);
309
			blueplayers = blueplayers-1;
310
		} else {
311
		    format(string, sizeof(string), "%s has been dropped out of the team DM, team red", tdmPlayerName);
312
		    redplayers = redplayers-1;
313
  		}
314
		SendClientMessageToAll(0x33AA33AA, string);
315
		playerintdm[playerid] = 0;
316
		playerinminigame[playerid] = 0;
317
		if(tdmrank == 0)
318
		{
319
		    tdmplaying = 0;
320
		    tdmrank = 0;
321
		    tdmon = 0;
322
		    KillTimer(tdmtimer);
323
		    return 1;
324
		}
325
		if((blueplayers == 0 || redplayers == 0) && tdmplaying == 1)
326
		{
327
		    if(blueplayers == 0)
328
		    {
329
		    	format(string, sizeof(string), "Team red has won the team DM");
330
	   		} else if(redplayers == 0)
331
	   		{
332
	   		    format(string, sizeof(string), "Team blue has won the team DM");
333
	   		}
334
			SendClientMessageToAll(0x33AA33AA, string);
335
			for(new i=0; i<MAX_PLAYERS; i++)
336
			{
337
				if (IsPlayerConnected(i) && playerintdm[i] == 1)
338
				{
339
					playerintdm[i] = 0;
340
					playerinminigame[i] = 0;
341
					SetPlayerVirtualWorld(i,0);
342
					SetPlayerInterior(playerid, 0);
343
					SetPlayerColor(i,oldplayercolor[i]);
344
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
345
				}
346
			}
347
		    tdmplaying = 0;
348
		    tdmrank = 0;
349
		    tdmon = 0;
350
		    KillTimer(tdmtimer);
351
		    return 1;
352
		}
353
		tdmrank--;
354
	} else if(playerindm[playerid] == 1) {
355
	    new dmPlayerName[MAX_PLAYER_NAME];
356
	    GetPlayerName(playerid, dmPlayerName, sizeof(dmPlayerName));
357
		format(string, sizeof(string), "%s has been dropped out of the LVDM, rank: %d", dmPlayerName, dmrank);
358
		SendClientMessageToAll(0x33AA33AA, string);
359
		playerindm[playerid] = 0;
360
		playerinminigame[playerid] = 0;
361
		if(dmrank <= 2)
362
		{
363
			for(new i=0; i<MAX_PLAYERS; i++)
364
			{
365
				if (IsPlayerConnected(i) && playerindm[i] == 1)
366
				{
367
				    new dmwinnername[256];
368
					GetPlayerName(i,dmwinnername, sizeof(dmwinnername));
369
					RewardCalc(i,100,1000);
370
					format(string, sizeof(string), "%s has won the LVDM for $%d", dmwinnername, reward);
371
					SendClientMessageToAll(0x33AA33AA, string);
372
					GivePlayerMoney(i,reward);
373
					playerindm[i] = 0;
374
					playerinminigame[i] = 0;
375
					SetPlayerVirtualWorld(i,0);
376
					SetPlayerInterior(playerid, 0);
377
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
378
				}
379
			}
380
		    dmplaying = 0;
381
		    dmrank = 0;
382
		    dmon = 0;
383
		    KillTimer(dmtimer);
384
		    return 1;
385
		}
386
		dmrank--;
387
	} else if(playerinqderby[playerid] == 1)	{
388
	    new DerbyPlayerName[MAX_PLAYER_NAME];
389
	    GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
390
		format(string, sizeof(string), "%s has been dropped out of the quarry derby, rank: %d", DerbyPlayerName, qderbyrank);
391
		SendClientMessageToAll(0x33AA33AA, string);
392
		playerinqderby[playerid] = 0;
393
		playerinminigame[playerid] = 0;
394
		qbloodringfull[playerinqbloodring[playerid]] = 0;
395
		playerinqbloodring[playerid] = -1;
396
		if(qderbyrank <= 2)
397
		{
398
			for(new i=0; i<MAX_PLAYERS; i++)
399
			{
400
				if (IsPlayerConnected(i) && playerinqderby[i] == 1)
401
				{
402
				    new winnername[256];
403
					GetPlayerName(i,winnername, sizeof(winnername));
404
					RewardCalc(i,100,1000);
405
					format(string, sizeof(string), "%s has won the quarry derby for $%d", winnername, reward);
406
					SendClientMessageToAll(0x33AA33AA, string);
407
					GivePlayerMoney(i,reward);
408
					playerinqderby[i] = 0;
409
					playerinminigame[i] = 0;
410
					SetPlayerVirtualWorld(i,0);
411
					SetPlayerInterior(playerid, 0);
412
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
413
				}
414
			}
415
		    qderbyplaying = 0;
416
		    qderbyrank = 0;
417
		    qderbyon = 0;
418
		    KillTimer(qdtimer);
419
	    	Respawnqbloodrings();
420
	    	return 1;
421
		}
422
		qderbyrank--;
423
	} else if(playerinbox[playerid] == 1) {
424
	    new boxPlayerName[MAX_PLAYER_NAME];
425
	    GetPlayerName(playerid, boxPlayerName, sizeof(boxPlayerName));
426
		format(string, sizeof(string), "%s has been dropped out of the boxing fight, rank: %d", boxPlayerName, boxrank);
427
		SendClientMessageToAll(0x33AA33AA, string);
428
		playerinbox[playerid] = 0;
429
		playerinminigame[playerid] = 0;
430
		if(boxrank <= 2)
431
		{
432
			for(new i=0; i<MAX_PLAYERS; i++)
433
			{
434
				if (IsPlayerConnected(i) && playerinbox[i] == 1)
435
				{
436
				    new boxwinnername[256];
437
					GetPlayerName(i,boxwinnername, sizeof(boxwinnername));
438
					RewardCalc(i,100,1000);
439
					format(string, sizeof(string), "%s has won the boxing fight for $%d", boxwinnername, reward);
440
					SendClientMessageToAll(0x33AA33AA, string);
441
					GivePlayerMoney(i,reward);
442
					playerinbox[i] = 0;
443
					playerinminigame[i] = 0;
444
					SetPlayerVirtualWorld(i,0);
445
					SetPlayerInterior(playerid, 0);
446
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
447
				}
448
			}
449
		    boxplaying = 0;
450
		    boxrank = 0;
451
		    boxon = 0;
452
		    KillTimer(boxtimer);
453
		    return 1;
454
		}
455
		boxrank--;
456
	} else if(playerinsd[playerid] == 1) {
457
	    new SkydivePlayerName[MAX_PLAYER_NAME];
458
	    GetPlayerName(playerid, SkydivePlayerName, sizeof(SkydivePlayerName));
459
		format(string, sizeof(string), "%s has been dropped out of the skydive", SkydivePlayerName);
460
		SendClientMessageToAll(0x33AA33AA, string);
461
		playerinsd[playerid] = 0;
462
		playerinminigame[playerid] = 0;
463
		if(sdrank <= 1)
464
		{
465
			for(new i=0; i<MAX_PLAYERS; i++)
466
			{
467
				if (IsPlayerConnected(i) && playerinsd[i] == 1)
468
				{
469
					playerinsd[i] = 0;
470
					playerinminigame[i] = 0;
471
					SetPlayerVirtualWorld(i,0);
472
					SetPlayerInterior(playerid, 0);
473
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
474
				}
475
			}
476
		    sdplaying = 0;
477
		    sdrank = 0;
478
		    sdon = 0;
479
		    sdfirst = 0;
480
		    KillTimer(sdtimer);
481
	    	return 1;
482
		}
483
		sdrank--;
484
	} else if(playerinkartrace[playerid] == 1) {
485
	    new KartPlayerName[MAX_PLAYER_NAME];
486
	    GetPlayerName(playerid, KartPlayerName, sizeof(KartPlayerName));
487
		format(string, sizeof(string), "%s has been dropped out of the kart race", KartPlayerName);
488
		SendClientMessageToAll(0x33AA33AA, string);
489
		playerinkartrace[playerid] = 0;
490
		playerinminigame[playerid] = 0;
491
		kartfull[playerinkart[playerid]] = 0;
492
		playerinkart[playerid] = -1;
493
		if(kartrank <= 1)
494
		{
495
			for(new i=0; i<MAX_PLAYERS; i++)
496
			{
497
				if (IsPlayerConnected(i) && playerinkartrace[i] == 1)
498
				{
499
					playerinkartrace[i] = 0;
500
					playerinminigame[i] = 0;
501
					SetPlayerVirtualWorld(i,0);
502
					SetPlayerInterior(playerid, 0);
503
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
504
				}
505
			}
506
		    kartplaying = 0;
507
		    kartrank = 0;
508
		    karton = 0;
509
		    KillTimer(krttimer);
510
	    	RespawnKarts();
511
	    	return 1;
512
		}
513
		kartrank--;
514
	} else if(playerinsr[playerid] == 1) {
515
	    new SrPlayerName[MAX_PLAYER_NAME];
516
	    GetPlayerName(playerid, SrPlayerName, sizeof(SrPlayerName));
517
		format(string, sizeof(string), "%s has been dropped out of the stadium race", SrPlayerName);
518
		SendClientMessageToAll(0x33AA33AA, string);
519
		playerinsr[playerid] = 0;
520
		playerinminigame[playerid] = 0;
521
		nrgfull[playerinnrg[playerid]] = 0;
522
		playerinnrg[playerid] = -1;
523
		if(kartrank <= 1)
524
		{
525
			for(new i=0; i<MAX_PLAYERS; i++)
526
			{
527
				if (IsPlayerConnected(i) && playerinsr[i] == 1)
528
				{
529
					playerinsr[i] = 0;
530
					playerinminigame[i] = 0;
531
					SetPlayerVirtualWorld(i,0);
532
					SetPlayerInterior(playerid, 0);
533
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
534
				}
535
			}
536
		    kartplaying = 0;
537
		    kartrank = 0;
538
		    karton = 0;
539
		    KillTimer(srtimer);
540
	    	RespawnNrgs();
541
	    	return 1;
542
		}
543
		srrank--;
544
	}
545
	return 1;
546
}
547
548
public OnPlayerSpawn(playerid)
549
{
550
	return 1;
551
}
552
553
public OnPlayerDeath(playerid, killerid, reason)
554
{
555
    new string[256];
556
	if(playerinderby[playerid] == 1)
557
	{
558
	    new DerbyPlayerName[MAX_PLAYER_NAME];
559
	    GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
560
		format(string, sizeof(string), "%s has been dropped out of the derby, rank: %d", DerbyPlayerName, derbyrank);
561
		SendClientMessageToAll(0x33AA33AA, string);
562
		playerinderby[playerid] = 0;
563
		playerinminigame[playerid] = 0;
564
		bloodringfull[playerinbloodring[playerid]] = 0;
565
		playerinbloodring[playerid] = -1;
566
		if(derbyrank <= 2)
567
		{
568
			for(new i=0; i<MAX_PLAYERS; i++)
569
			{
570
				if (IsPlayerConnected(i) && playerinderby[i] == 1)
571
				{
572
				    new winnername[256];
573
					GetPlayerName(i,winnername, sizeof(winnername));
574
					RewardCalc(i,100,1000);
575
					format(string, sizeof(string), "%s has won the derby for $%d", winnername, reward);
576
					SendClientMessageToAll(0x33AA33AA, string);
577
					GivePlayerMoney(i,reward);
578
					playerinderby[i] = 0;
579
					playerinminigame[i] = 0;
580
					SetPlayerVirtualWorld(i,0);
581
					SetPlayerInterior(playerid, 0);
582
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
583
				}
584
			}
585
		    derbyplaying = 0;
586
		    derbyrank = 0;
587
		    derbyon = 0;
588
		    KillTimer(dtimer);
589
	    	Respawnbloodrings();
590
	    	return 1;
591
		}
592
		derbyrank--;
593
	} else if(playerintdm[playerid] == 1) {
594
	    new tdmPlayerName[MAX_PLAYER_NAME];
595
	    GetPlayerName(playerid, tdmPlayerName, sizeof(tdmPlayerName));
596
	    if(GetPlayerColor(playerid) == 0x0000BBAA)
597
	    {
598
			format(string, sizeof(string), "%s has been dropped out of the team DM, team blue", tdmPlayerName);
599
			blueplayers = blueplayers-1;
600
		} else {
601
		    format(string, sizeof(string), "%s has been dropped out of the team DM, team red", tdmPlayerName);
602
		    redplayers = redplayers-1;
603
  		}
604
		SendClientMessageToAll(0x33AA33AA, string);
605
		playerintdm[playerid] = 0;
606
		playerinminigame[playerid] = 0;
607
		if(tdmrank == 0)
608
		{
609
		    tdmplaying = 0;
610
		    tdmrank = 0;
611
		    tdmon = 0;
612
		    KillTimer(tdmtimer);
613
		    return 1;
614
		}
615
		if((blueplayers == 0 || redplayers == 0) && tdmplaying == 1)
616
		{
617
		    if(blueplayers == 0)
618
		    {
619
		    	format(string, sizeof(string), "Team red has won the team DM");
620
	   		} else if(redplayers == 0)
621
	   		{
622
	   		    format(string, sizeof(string), "Team blue has won the team DM");
623
	   		}
624
			SendClientMessageToAll(0x33AA33AA, string);
625
			for(new i=0; i<MAX_PLAYERS; i++)
626
			{
627
				if (IsPlayerConnected(i) && playerintdm[i] == 1)
628
				{
629
					playerintdm[i] = 0;
630
					playerinminigame[i] = 0;
631
					SetPlayerVirtualWorld(i,0);
632
					SetPlayerInterior(playerid, 0);
633
					SetPlayerColor(i,oldplayercolor[i]);
634
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
635
				}
636
			}
637
		    tdmplaying = 0;
638
		    tdmrank = 0;
639
		    tdmon = 0;
640
		    KillTimer(tdmtimer);
641
		    return 1;
642
		}
643
		tdmrank--;
644
	} else if(playerindm[playerid] == 1) {
645
	    new dmPlayerName[MAX_PLAYER_NAME];
646
	    GetPlayerName(playerid, dmPlayerName, sizeof(dmPlayerName));
647
		format(string, sizeof(string), "%s has been dropped out of the LVDM, rank: %d", dmPlayerName, dmrank);
648
		SendClientMessageToAll(0x33AA33AA, string);
649
		playerindm[playerid] = 0;
650
		playerinminigame[playerid] = 0;
651
		if(dmrank <= 2)
652
		{
653
			for(new i=0; i<MAX_PLAYERS; i++)
654
			{
655
				if (IsPlayerConnected(i) && playerindm[i] == 1)
656
				{
657
				    new dmwinnername[256];
658
					GetPlayerName(i,dmwinnername, sizeof(dmwinnername));
659
					RewardCalc(i,100,1000);
660
					format(string, sizeof(string), "%s has won the LVDM for $%d", dmwinnername, reward);
661
					SendClientMessageToAll(0x33AA33AA, string);
662
					GivePlayerMoney(i,reward);
663
					playerindm[i] = 0;
664
					playerinminigame[i] = 0;
665
					SetPlayerVirtualWorld(i,0);
666
					SetPlayerInterior(playerid, 0);
667
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
668
				}
669
			}
670
		    dmplaying = 0;
671
		    dmrank = 0;
672
		    dmon = 0;
673
		    KillTimer(dmtimer);
674
		    return 1;
675
		}
676
		dmrank--;
677
	} else if(playerinqderby[playerid] == 1)	{
678
	    new DerbyPlayerName[MAX_PLAYER_NAME];
679
	    GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
680
		format(string, sizeof(string), "%s has been dropped out of the quarry derby, rank: %d", DerbyPlayerName, qderbyrank);
681
		SendClientMessageToAll(0x33AA33AA, string);
682
		playerinqderby[playerid] = 0;
683
		playerinminigame[playerid] = 0;
684
		qbloodringfull[playerinqbloodring[playerid]] = 0;
685
		playerinqbloodring[playerid] = -1;
686
		if(qderbyrank <= 2)
687
		{
688
			for(new i=0; i<MAX_PLAYERS; i++)
689
			{
690
				if (IsPlayerConnected(i) && playerinqderby[i] == 1)
691
				{
692
				    new winnername[256];
693
					GetPlayerName(i,winnername, sizeof(winnername));
694
					RewardCalc(i,100,1000);
695
					format(string, sizeof(string), "%s has won the quarry derby for $%d", winnername, reward);
696
					SendClientMessageToAll(0x33AA33AA, string);
697
					GivePlayerMoney(i,reward);
698
					playerinqderby[i] = 0;
699
					playerinminigame[i] = 0;
700
					SetPlayerVirtualWorld(i,0);
701
					SetPlayerInterior(playerid, 0);
702
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
703
				}
704
			}
705
		    qderbyplaying = 0;
706
		    qderbyrank = 0;
707
		    qderbyon = 0;
708
		    KillTimer(qdtimer);
709
	    	Respawnqbloodrings();
710
	    	return 1;
711
		}
712
		qderbyrank--;
713
	} else if(playerinbox[playerid] == 1) {
714
	    new boxPlayerName[MAX_PLAYER_NAME];
715
	    GetPlayerName(playerid, boxPlayerName, sizeof(boxPlayerName));
716
		format(string, sizeof(string), "%s has been dropped out of the boxing fight, rank: %d", boxPlayerName, boxrank);
717
		SendClientMessageToAll(0x33AA33AA, string);
718
		playerinbox[playerid] = 0;
719
		playerinminigame[playerid] = 0;
720
		if(boxrank <= 2)
721
		{
722
			for(new i=0; i<MAX_PLAYERS; i++)
723
			{
724
				if (IsPlayerConnected(i) && playerinbox[i] == 1)
725
				{
726
				    new boxwinnername[256];
727
					GetPlayerName(i,boxwinnername, sizeof(boxwinnername));
728
					RewardCalc(i,100,1000);
729
					format(string, sizeof(string), "%s has won the boxing fight for $%d", boxwinnername, reward);
730
					SendClientMessageToAll(0x33AA33AA, string);
731
					GivePlayerMoney(i,reward);
732
					playerinbox[i] = 0;
733
					playerinminigame[i] = 0;
734
					SetPlayerVirtualWorld(i,0);
735
					SetPlayerInterior(playerid, 0);
736
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
737
				}
738
			}
739
		    boxplaying = 0;
740
		    boxrank = 0;
741
		    boxon = 0;
742
		    KillTimer(boxtimer);
743
		    return 1;
744
		}
745
		boxrank--;
746
	} else if(playerinsd[playerid] == 1) {
747
	    new SkydivePlayerName[MAX_PLAYER_NAME];
748
	    GetPlayerName(playerid, SkydivePlayerName, sizeof(SkydivePlayerName));
749
		format(string, sizeof(string), "%s has been dropped out of the skydive", SkydivePlayerName);
750
		SendClientMessageToAll(0x33AA33AA, string);
751
		playerinsd[playerid] = 0;
752
		playerinminigame[playerid] = 0;
753
		if(sdrank <= 1)
754
		{
755
			for(new i=0; i<MAX_PLAYERS; i++)
756
			{
757
				if (IsPlayerConnected(i) && playerinsd[i] == 1)
758
				{
759
					playerinsd[i] = 0;
760
					playerinminigame[i] = 0;
761
					SetPlayerVirtualWorld(i,0);
762
					SetPlayerInterior(playerid, 0);
763
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
764
				}
765
			}
766
		    sdplaying = 0;
767
		    sdrank = 0;
768
		    sdon = 0;
769
		    sdfirst = 0;
770
		    KillTimer(sdtimer);
771
	    	return 1;
772
		}
773
		sdrank--;
774
	} else if(playerinkartrace[playerid] == 1) {
775
	    new KartPlayerName[MAX_PLAYER_NAME];
776
	    GetPlayerName(playerid, KartPlayerName, sizeof(KartPlayerName));
777
		format(string, sizeof(string), "%s has been dropped out of the kart race", KartPlayerName);
778
		SendClientMessageToAll(0x33AA33AA, string);
779
		playerinkartrace[playerid] = 0;
780
		playerinminigame[playerid] = 0;
781
		kartfull[playerinkart[playerid]] = 0;
782
		playerinkart[playerid] = -1;
783
		if(kartrank <= 1)
784
		{
785
			for(new i=0; i<MAX_PLAYERS; i++)
786
			{
787
				if (IsPlayerConnected(i) && playerinkartrace[i] == 1)
788
				{
789
					playerinkartrace[i] = 0;
790
					playerinminigame[i] = 0;
791
					SetPlayerVirtualWorld(i,0);
792
					SetPlayerInterior(playerid, 0);
793
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
794
				}
795
			}
796
		    kartplaying = 0;
797
		    kartrank = 0;
798
		    karton = 0;
799
		    KillTimer(krttimer);
800
	    	RespawnKarts();
801
	    	return 1;
802
		}
803
		kartrank--;
804
	} else if(playerinsr[playerid] == 1) {
805
	    new SrPlayerName[MAX_PLAYER_NAME];
806
	    GetPlayerName(playerid, SrPlayerName, sizeof(SrPlayerName));
807
		format(string, sizeof(string), "%s has been dropped out of the stadium race", SrPlayerName);
808
		SendClientMessageToAll(0x33AA33AA, string);
809
		playerinsr[playerid] = 0;
810
		playerinminigame[playerid] = 0;
811
		nrgfull[playerinnrg[playerid]] = 0;
812
		playerinnrg[playerid] = -1;
813
		if(kartrank <= 1)
814
		{
815
			for(new i=0; i<MAX_PLAYERS; i++)
816
			{
817
				if (IsPlayerConnected(i) && playerinsr[i] == 1)
818
				{
819
					playerinsr[i] = 0;
820
					playerinminigame[i] = 0;
821
					SetPlayerVirtualWorld(i,0);
822
					SetPlayerInterior(playerid, 0);
823
					SetPlayerPos(i, spawnX, spawnY, spawnZ);
824
				}
825
			}
826
		    srplaying = 0;
827
		    srrank = 0;
828
		    sron = 0;
829
		    KillTimer(srtimer);
830
	    	RespawnNrgs();
831
	    	return 1;
832
		}
833
		srrank--;
834
	}
835
	return 1;
836
}
837
838
public OnVehicleSpawn(vehicleid)
839
{
840
	return 1;
841
}
842
843
public OnVehicleDeath(vehicleid, killerid)
844
{
845
	return 1;
846
}
847
848
public OnPlayerText(playerid, text[])
849
{
850
	return 1;
851
}
852
853
public OnPlayerPrivmsg(playerid, recieverid, text[])
854
{
855
	return 1;
856
}
857
858
public OnPlayerCommandText(playerid, cmdtext[])
859
{
860
	new cmd[256];
861
	new idx;
862
	new string[256];
863
	new tmp[256];
864
	cmd = strtok(cmdtext, idx);
865
	
866
	if(strcmp(cmd, "/mark", true) == 0)
867
	{
868
	    if(playerinminigame[playerid])
869
	    {
870
	    	SendClientMessage(playerid, 0x33AA33AA, "To prevent abuse, /mark and /gotomark are disabled in minigames.");
871
		    return 1;
872
	    }
873
	}
874
	
875
	if(strcmp(cmd, "/gotomark", true) == 0)
876
	{
877
	    if(playerinminigame[playerid])
878
	    {
879
	    	SendClientMessage(playerid, 0x33AA33AA, "To prevent abuse, /mark and /gotomark are disabled in minigames.");
880
		    return 1;
881
	    }
882
	}
883
	
884
	if(strcmp(cmd, "/minigames", true) == 0)
885
	{
886
	    SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
887
	    SendClientMessage(playerid, 0xFF0000FF, " ");
888
	    SendClientMessage(playerid, 0xFF0000FF, "These minigames are currently available:");
889
	    SendClientMessage(playerid, 0xFF0000FF, "/derby /teamdm /lvdm /qderby /boxing /sdive /kartrace /srace");
890
	    SendClientMessage(playerid, 0xFF0000FF, "Type /info for more information about seperate minigames.");
891
	    SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
892
	    return 1;
893
	}
894
	
895
	if(strcmp(cmd, "/info", true) == 0)
896
	{
897
	    tmp = strtok(cmdtext, idx);
898
	    if(!strlen(tmp))
899
		{
900
		    SendClientMessage(playerid,0xFFFF00AA, "Usage: /info [minigame command]");
901
		    SendClientMessage(playerid,0xFFFF00AA, "Minigame commands: derby teamdm lvdm qderby boxing sdive kartrace srace");
902
		    return 1;
903
  		}
904
  		
905
  		SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
906
	    SendClientMessage(playerid, 0xFF0000FF, " ");
907
  		if(strcmp(tmp, "derby", true) == 0){
908
			SendClientMessage(playerid, 0xFF0000FF, "Derby: A destruction derby in the Bloodbowl.");
909
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to destroy everyone other's car, and keep your own car intact.");
910
  		}else if(strcmp(tmp, "teamdm", true) == 0){
911
  			SendClientMessage(playerid, 0xFF0000FF, "TeamDM: A team deathmatch in area 51 with two teams, red and blue.");
912
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is kill everyone of the other team.");
913
  		}else if(strcmp(tmp, "lvdm", true) == 0){
914
  			SendClientMessage(playerid, 0xFF0000FF, "Lvdm: A deathmatch in the LVPD.");
915
			SendClientMessage(playerid, 0xFF0000FF, "Your goal kill other people, and stay alive.");
916
  		}else if(strcmp(tmp, "qderby", true) == 0){
917
  			SendClientMessage(playerid, 0xFF0000FF, "QDerby: A destruction derby in the Quarry.");
918
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to destroy everyone other's car, and keep your own car intact.");
919
  		}else if(strcmp(tmp, "boxing", true) == 0){
920
  			SendClientMessage(playerid, 0xFF0000FF, "Boxing: A deathmatch without weapons, only fisting.");
921
			SendClientMessage(playerid, 0xFF0000FF, "Your goal kill other people, and stay alive.");
922
  		}else if(strcmp(tmp, "sdive", true) == 0){
923
  			SendClientMessage(playerid, 0xFF0000FF, "SDive: A skydive minigame.");
924
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to land on the tower as first. You must stay alive for 2 seconds there.");
925
  		}else if(strcmp(tmp, "kartrace", true) == 0){
926
  			SendClientMessage(playerid, 0xFF0000FF, "Kartrace: A race with karts around the Bloodbowl.");
927
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to drive two laps in the fastest time.");
928
  		}else if(strcmp(tmp, "srace", true) == 0){
929
  			SendClientMessage(playerid, 0xFF0000FF, "SRace: A race in the Vice Stadium, with NRG's.");
930
			SendClientMessage(playerid, 0xFF0000FF, "Your goal is to drive one lap in the fastest time.");
931
  		}
932
	    SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
933
	    return 1;
934
	}
935
	
936
	if(strcmp(cmd, "/derby", true) == 0)
937
	{
938
	    if(derbyplaying == 1)
939
	    {
940
	        SendClientMessage(playerid, 0xB4B5B7AA, "The derby is already started");
941
	        return 1;
942
	    }
943
	    if(playerinminigame[playerid] == 1)
944
	    {
945
	        SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
946
	        return 1;
947
	    }
948
		new pname[256];
949
		GetPlayerName(playerid, pname, 256);
950
	    if(derbyon == 0)
951
	    {
952
	        derbyon = 1;
953
	        playerinminigame[playerid] = 1;
954
	        playerinderby[playerid] = 1;
955
	        derbyrank = 1;
956
	        SetPlayerInterior(playerid,15);
957
	        SetPlayerVirtualWorld(playerid,7);
958
	        SetVehicleVirtualWorld(bloodring[0],7);
959
	        bloodringfull[0] = 1;
960
	        PutPlayerInVehicle(playerid, bloodring[0], 0);
961
	        playerinbloodring[playerid] = 0;
962
	        TogglePlayerControllable(playerid, 0);
963
	        startvar[0] = 1;
964
	        dtimer = SetTimer("StartDerby", 60000, 0);
965
         	format(string, sizeof(string), "%s has started a derby, you have one minute to type /derby and join", pname);//
966
			SendClientMessageToAll(0x33AA33AA,string);
967
			return 1;
968
	    } else if(derbyon == 1 && derbyrank < 15) {
969
	        playerinminigame[playerid] = 1;
970
	        playerinderby[playerid] = 1;
971
	        derbyrank++;
972
	        SetPlayerInterior(playerid,15);
973
	        for(new i=0; i<15; i++)
974
    		{
975
	    		if(bloodringfull[i] == 0)
976
	    		{
977
	    		    SetPlayerVirtualWorld(playerid,7);
978
	    		    SetVehicleVirtualWorld(bloodring[i],7);
979
	    		    bloodringfull[i] = 1;
980
	    		    PutPlayerInVehicle(playerid, bloodring[i], 0);
981
	    		    TogglePlayerControllable(playerid, 0);
982
	    		    playerinbloodring[playerid] = i;
983
	    		    format(string, sizeof(string), "%s has joined the derby", pname);//
984
					SendClientMessageToAll(0x33AA33AA,string);
985
					return 1;
986
	    		}
987
			}
988
	    } else if(derbyon == 1 && derbyrank >= 15) {
989
		    format(string, sizeof(string), "The derby is full, wait for the next round", pname);//
990
		    SendClientMessage(playerid,0x33AA33AA,string);
991
		    return 1;
992
	    }
993
	}
994
	
995
	if(strcmp(cmd, "/teamdm", true) == 0)
996
	{
997
	    if(tdmplaying == 1)
998
	    {
999
	        SendClientMessage(playerid, 0xB4B5B7AA, "The team DM is already started");
1000
	        return 1;
1001
	    }
1002
	    if(playerinminigame[playerid] == 1)
1003
	    {
1004
	        SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
1005
	        return 1;
1006
	    }
1007
		new pname[256];
1008
		GetPlayerName(playerid, pname, 256);
1009
	    if(tdmon == 0)
1010
	    {
1011
	        tdmon = 1;
1012
	        playerintdm[playerid] = 1;
1013
	        playerinminigame[playerid] = 1;
1014
	        tdmrank = 1;
1015
	        TogglePlayerControllable(playerid, 0);
1016
	        SetPlayerInterior(playerid,0);
1017
	        SetPlayerVirtualWorld(playerid,7);
1018
	        SetPlayerPos(playerid,208.8376,1863.5388,13.1406);
1019
	        ResetPlayerWeapons(playerid);
1020
	        GivePlayerWeapon(playerid,26,50000);
1021
	        GivePlayerWeapon(playerid,31,50000);
1022
	        GivePlayerWeapon(playerid,32,50000);
1023
	        SetPlayerHealth(playerid,100);
1024
	        SetPlayerArmour(playerid,100);
1025
	        oldplayercolor[playerid] = GetPlayerColor(playerid);
1026
	        SetPlayerColor(playerid,0x0000BBAA);// BLUE
1027
	        blueplayers = 1;
1028
	        redplayers = 0;
1029
	        tdmcolor = 1;
1030
	        startvar[1] = 1;
1031
	        tdmtimer = SetTimer("Starttdm", 60000, 0);
1032
         	format(string, sizeof(string), "%s has started a team DM, team blue, you have one minute to type /teamdm and join", pname);//
1033
			SendClientMessageToAll(0x33AA33AA,string);
1034
			return 1;
1035
	    } else if(tdmon == 1 && tdmcolor == 1) {
1036
	        playerintdm[playerid] = 1;
1037
	        playerinminigame[playerid] = 1;
1038
	        tdmrank++;
1039
	        TogglePlayerControllable(playerid, 0);
1040
	        SetPlayerInterior(playerid,0);
1041
	        SetPlayerVirtualWorld(playerid,7);
1042
	        SetPlayerPos(playerid,268.6240,1882.8805,-30.0938);
1043
	        ResetPlayerWeapons(playerid);
1044
	        GivePlayerWeapon(playerid,26,50000);
1045
	        GivePlayerWeapon(playerid,31,50000);
1046
	        GivePlayerWeapon(playerid,32,50000);
1047
	        SetPlayerHealth(playerid,100);
1048
	        SetPlayerArmour(playerid,100);
1049
	        oldplayercolor[playerid] = GetPlayerColor(playerid);
1050
	        SetPlayerColor(playerid,0xAA3333AA);// RED
1051
	        redplayers++;
1052
	        tdmcolor = 0;
1053
	        format(string, sizeof(string), "%s has joined the team DM, team red", pname);//
1054
			SendClientMessageToAll(0x33AA33AA,string);
1055
			return 1;
1056
	    } else if(tdmon == 1 && tdmcolor == 0) {
1057
	        playerintdm[playerid] = 1;
1058
	        playerinminigame[playerid] = 1;
1059
	        tdmrank++;
1060
	        TogglePlayerControllable(playerid, 0);
1061
	        SetPlayerInterior(playerid,0);
1062
	        SetPlayerVirtualWorld(playerid,7);
1063
	        SetPlayerPos(playerid,208.8376,1863.5388,13.1406);
1064
	        ResetPlayerWeapons(playerid);
1065
	        GivePlayerWeapon(playerid,26,50000);
1066
	        GivePlayerWeapon(playerid,31,50000);
1067
	        GivePlayerWeapon(playerid,32,50000);
1068
	        SetPlayerHealth(playerid,100);
1069
	        SetPlayerArmour(playerid,100);
1070
	        oldplayercolor[playerid] = GetPlayerColor(playerid);
1071
	        SetPlayerColor(playerid,0x0000BBAA);// BLUE
1072
	        blueplayers++;
1073
	        tdmcolor = 1;
1074
	        format(string, sizeof(string), "%s has joined the team DM, team blue", pname);//
1075
			SendClientMessageToAll(0x33AA33AA,string);
1076
			return 1;
1077
	    }
1078
	}
1079
	if(strcmp(cmd, "/lvdm", true) == 0)
1080
	{
1081
	    if(dmplaying == 1)
1082
	    {
1083
	        SendClientMessage(playerid, 0xB4B5B7AA, "The LVDM is already started");
1084
	        return 1;
1085
	    }
1086
	    if(playerinminigame[playerid] == 1)
1087
	    {
1088
	        SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
1089
	        return 1;
1090
	    }
1091
		new pname[256];
1092
		GetPlayerName(playerid, pname, 256);
1093
	    if(dmon == 0)
1094
	    {
1095
	        dmon = 1;
1096
	        playerindm[playerid] = 1;
1097
   	        playerinminigame[playerid] = 1;
1098
	        dmrank = 1;
1099
	        TogglePlayerControllable(playerid, 0);
1100
	        SetPlayerInterior(playerid,0);
1101
	        SetPlayerVirtualWorld(playerid,7);
1102
	        SetPlayerPos(playerid,lvdmspawns[0][0],lvdmspawns[0][1],lvdmspawns[0][2]);
1103
	        ResetPlayerWeapons(playerid);
1104
	        GivePlayerWeapon(playerid,26,50000);
1105
	        GivePlayerWeapon(playerid,32,50000);
1106
	        GivePlayerWeapon(playerid,31,50000);
1107
	        SetPlayerHealth(playerid,100);
1108
	        SetPlayerArmour(playerid,100);
1109
	        startvar[2] = 1;
1110
	        dmtimer = SetTimer("Startdm", 60000, 0);
1111
         	format(string, sizeof(string), "%s has started a LVDM, you have one minute to type /lvdm and join", pname);//
1112
			SendClientMessageToAll(0x33AA33AA,string);
1113
			return 1;
1114
	    } else if(dmon == 1 && dmrank <= 15) {
1115
	        playerindm[playerid] = 1;
1116
	        TogglePlayerControllable(playerid, 0);
1117
	        SetPlayerInterior(playerid,0);
1118
	        SetPlayerVirtualWorld(playerid,7);
1119
         	SetPlayerPos(playerid,lvdmspawns[dmrank][0],lvdmspawns[dmrank][1],lvdmspawns[dmrank][2]);
1120
         	dmrank++;
1121
	        ResetPlayerWeapons(playerid);
1122
	        GivePlayerWeapon(playerid,26,50000);
1123
	        GivePlayerWeapon(playerid,32,50000);
1124
	        GivePlayerWeapon(playerid,31,50000);
1125
	        SetPlayerHealth(playerid,100);
1126
	        SetPlayerArmour(playerid,100);
1127
	        format(string, sizeof(string), "%s has joined the LVDM", pname);//
1128
			SendClientMessageToAll(0x33AA33AA,string);
1129
			return 1;
1130
	    } else if(dmon == 1 && dmrank == 16) {
1131
	        format(string, sizeof(string), "The LVDM is full, wait for the next LVDM");//
1132
			SendClientMessage(playerid,0x33AA33AA,string);
1133
	    }
1134
	}
1135
	
1136
	if(strcmp(cmd, "/qderby", true) == 0)
1137
	{
1138
	    if(qderbyplaying == 1)
1139
	    {
1140
	        SendClientMessage(playerid, 0xB4B5B7AA, "The derby is already started");
1141
	        return 1;
1142
	    }
1143
	    if(playerinminigame[playerid] == 1)
1144
	    {
1145
	        SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
1146
	        return 1;
1147
	    }
1148
		new pname[256];
1149
		GetPlayerName(playerid, pname, 256);
1150
	    if(qderbyon == 0)
1151
	    {
1152
	        Respawnqbloodrings();
1153
	        qderbyon = 1;
1154
	        playerinminigame[playerid] = 1;
1155
	        playerinqderby[playerid] = 1;
1156
	        qderbyrank = 1;
1157
	        SetPlayerInterior(playerid,0);
1158
	        SetPlayerVirtualWorld(playerid,7);
1159
	        SetVehicleVirtualWorld(qbloodring[0],7);
1160
	        qbloodringfull[0] = 1;
1161
	        PutPlayerInVehicle(playerid, qbloodring[0], 0);
1162
	        playerinqbloodring[playerid] = 0;
1163
	        TogglePlayerControllable(playerid, 0);
1164
	        startvar[3] = 1;
1165
	        qdtimer = SetTimer("StartqDerby", 60000, 0);
1166
         	format(string, sizeof(string), "%s has started a quarry derby, you have one minute to type /qderby and join", pname);//
1167
			SendClientMessageToAll(0x33AA33AA,string);
1168
			return 1;
1169
	    } else if(qderbyon == 1 && qderbyrank < 15) {
1170
	        playerinminigame[playerid] = 1;
1171
	        playerinqderby[playerid] = 1;
1172
	        qderbyrank++;
1173
	        SetPlayerInterior(playerid,0);
1174
	        for(new i=0; i<15; i++)
1175
    		{
1176
	    		if(qbloodringfull[i] == 0)
1177
	    		{
1178
	    		    SetPlayerVirtualWorld(playerid,7);
1179
	    		    SetVehicleVirtualWorld(qbloodring[i],7);
1180
	        		qbloodringfull[i] = 1;
1181
	    		    PutPlayerInVehicle(playerid, qbloodring[i], 0);
1182
	    		    TogglePlayerControllable(playerid, 0);
1183
	    		    playerinqbloodring[playerid] = i;
1184
	    		    format(string, sizeof(string), "%s has joined the quarry derby", pname);//
1185
					SendClientMessageToAll(0x33AA33AA,string);
1186
					return 1;
1187
	    		}
1188
			}
1189
	    } else if(qderbyon == 1 && qderbyrank >= 15) {
1190
		    format(string, sizeof(string), "The quarry derby is full, wait for the next round", pname);//
1191
		    SendClientMessage(playerid,0x33AA33AA,string);
1192
		    return 1;
1193
	    }
1194
	}
1195
	
1196
	if(strcmp(cmd, "/boxing", true) == 0)
1197
	{
1198
	    if(boxplaying == 1)
1199
	    {
1200
	        SendClientMessage(playerid, 0xB4B5B7AA, "The boxing fight is already started");
1201
	        return 1;
1202
	    }
1203
	    if(playerinminigame[playerid] == 1)
1204
	    {
1205
	        SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
1206
	        return 1;
1207
	    }
1208
		new pname[256];
1209
		GetPlayerName(playerid, pname, 256);
1210
	    if(boxon == 0)
1211
	    {
1212
	        boxon = 1;
1213
	        playerinbox[playerid] = 1;
1214
   	        playerinminigame[playerid] = 1;
1215
	        boxrank = 1;
1216
	        TogglePlayerControllable(playerid, 0);
1217
	        SetPlayerInterior(playerid,0);
1218
	        SetPlayerVirtualWorld(playerid,7);
1219
	        SetPlayerPos(playerid,2496.479,-1678.357,6997.348);
1220
	        ResetPlayerWeapons(playerid);
1221
	        SetPlayerHealth(playerid,50);
1222
	        startvar[4] = 1;
1223
	        boxtimer = SetTimer("StartBox", 60000, 0);
1224
         	format(string, sizeof(string), "%s has started a boxing fight, you have one minute to type /boxing and join", pname);//
1225
			SendClientMessageToAll(0x33AA33AA,string);
1226
			return 1;
1227
	    } else if(boxon == 1) {
1228
	        playerinbox[playerid] = 1;
1229
	        TogglePlayerControllable(playerid, 0);
1230
	        SetPlayerInterior(playerid,0);
1231
	        SetPlayerVirtualWorld(playerid,7);
1232
         	SetPlayerPos(playerid,2496.479,-1678.357,6997.348);
1233
         	boxrank++;
1234
	        ResetPlayerWeapons(playerid);
1235
	        SetPlayerHealth(playerid,50);
1236
	        format(string, sizeof(string), "%s has joined the boxing fight", pname);//
1237
			SendClientMessageToAll(0x33AA33AA,string);
1238
			return 1;
1239
	    }
1240
	}
1241
	if(strcmp(cmd, "/sdive", true) == 0)
1242
	{
1243
	    if(sdplaying == 1)
1244
	    {
1245
	        SendClientMessage(playerid, 0xB4B5B7AA, "The skydive is already started");
1246
	        return 1;
1247
	    }
1248
	    if(playerinminigame[playerid] == 1)
1249
	    {
1250
	        SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
1251
	        return 1;
1252
	    }
1253
		new pname[256];
1254
		GetPlayerName(playerid, pname, 256);
1255
	    if(sdon == 0)
1256
	    {
1257
	        sdon = 1;
1258
	        playerinsd[playerid] = 1;
1259
   	        playerinminigame[playerid] = 1;
1260
	        sdrank = 1;
1261
	        sdfirst = 1;
1262
	        TogglePlayerControllable(playerid, 0);
1263
	        SetPlayerInterior(playerid,0);
1264
	        SetPlayerVirtualWorld(playerid,7);
1265
	        SetPlayerPos(playerid,-1753.7169,884.6819,1000.000);
1266
	        GivePlayerWeapon(playerid,46,1);
1267
	        startvar[5] = 1;
1268
	        sdtimer = SetTimer("StartSd", 60000, 0);
1269
	        SetPlayerRaceCheckpoint(playerid,0,-1753.7169,884.6819,295.8750,-1753.7169,884.6819,290.8750,1);
1270
         	format(string, sizeof(string), "%s has started a skydive, you have one minute to type /sdive and join", pname);//
1271
			SendClientMessageToAll(0x33AA33AA,string);
1272
			return 1;
1273
	    } else if(sdon == 1) {
1274
	        playerinsd[playerid] = 1;
1275
	        TogglePlayerControllable(playerid, 0);
1276
	        SetPlayerInterior(playerid,0);
1277
	        SetPlayerVirtualWorld(playerid,7);
1278
         	SetPlayerPos(playerid,-1753.7169,884.6819,1000.000);
1279
         	sdrank++;
1280
         	GivePlayerWeapon(playerid,46,1);
1281
	        SetPlayerRaceCheckpoint(playerid,0,-1753.7169,884.6819,295.8750,-1753.7169,884.6819,290.8750,1);
1282
	        format(string, sizeof(string), "%s has joined the skydive", pname);//
1283
			SendClientMessageToAll(0x33AA33AA,string);
1284
			return 1;
1285
	    }
1286
	}
1287
	
1288
	if(strcmp(cmd, "/kartrace", true) == 0)
1289
	{
1290
	    if(kartplaying == 1)
1291
	    {
1292
	        SendClientMessage(playerid, 0xB4B5B7AA, "The kart race is already started");
1293
	        return 1;
1294
	    }
1295
	    if(playerinminigame[playerid] == 1)
1296
	    {
1297
	        SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
1298
	        return 1;
1299
	    }
1300
		new pname[256];
1301
		GetPlayerName(playerid, pname, 256);
1302
	    if(karton == 0)
1303
	    {
1304
	        karton = 1;
1305
	        playerinminigame[playerid] = 1;
1306
	        playerinkartrace[playerid] = 1;
1307
	        kartrank = 1;
1308
	        krtfirst = 1;
1309
	        currentcheckpoint[playerid] = 0;
1310
	        SetPlayerInterior(playerid,15);
1311
	        SetPlayerVirtualWorld(playerid,7);
1312
	        SetVehicleVirtualWorld(karts[0],7);
1313
	        kartfull[0] = 1;
1314
	        PutPlayerInVehicle(playerid, karts[0], 0);
1315
	        playerinkart[playerid] = 0;
1316
	        TogglePlayerControllable(playerid, 0);
1317
	        SetPlayerRaceCheckpoint(playerid,0,kcps[0][0],kcps[0][1],kcps[0][2],kcps[1][0],kcps[1][1],kcps[1][2],20);
1318
	        startvar[6] = 1;
1319
	        krttimer = SetTimer("StartKart", 60000, 0);
1320
         	format(string, sizeof(string), "%s has started a kart race, you have one minute to type /kartrace and join", pname);//
1321
			SendClientMessageToAll(0x33AA33AA,string);
1322
			return 1;
1323
	    } else if(karton == 1 && kartrank < 15) {
1324
	        playerinminigame[playerid] = 1;
1325
	        playerinkartrace[playerid] = 1;
1326
	        kartrank++;
1327
	        currentcheckpoint[playerid] = 0;
1328
	        SetPlayerInterior(playerid,15);
1329
	        for(new i=0; i<15; i++)
1330
    		{
1331
	    		if(kartfull[i] == 0)
1332
	    		{
1333
	    		    SetPlayerVirtualWorld(playerid,7);
1334
	    		    SetVehicleVirtualWorld(karts[i],7);
1335
	    		    kartfull[i] = 1;
1336
	    		    PutPlayerInVehicle(playerid, karts[i], 0);
1337
	    		    TogglePlayerControllable(playerid, 0);
1338
	    		    SetPlayerRaceCheckpoint(playerid,0,kcps[0][0],kcps[0][1],kcps[0][2],kcps[1][0],kcps[1][1],kcps[1][2],20);
1339
	    		    playerinkart[playerid] = i;
1340
	    		    format(string, sizeof(string), "%s has joined the kart race", pname);//
1341
					SendClientMessageToAll(0x33AA33AA,string);
1342
					return 1;
1343
	    		}
1344
			}
1345
	    } else if(karton == 1 && kartrank >= 15) {
1346
		    format(string, sizeof(string), "The kart race is full, wait for the next round", pname);//
1347
		    SendClientMessage(playerid,0x33AA33AA,string);
1348
		    return 1;
1349
	    }
1350
	}
1351
	
1352
	if(strcmp(cmd, "/srace", true) == 0)
1353
	{
1354
	    if(srplaying == 1)
1355
	    {
1356
	        SendClientMessage(playerid, 0xB4B5B7AA, "The stadium race is already started");
1357
	        return 1;
1358
	    }
1359
	    if(playerinminigame[playerid] == 1)
1360
	    {
1361
	        SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
1362
	        return 1;
1363
	    }
1364
		new pname[256];
1365
		GetPlayerName(playerid, pname, 256);
1366
	    if(sron == 0)
1367
	    {
1368
	        sron = 1;
1369
	        playerinminigame[playerid] = 1;
1370
	        playerinsr[playerid] = 1;
1371
	        srrank = 1;
1372
	        srfirst = 1;
1373
	        currentracecheckpoint[playerid] = 0;
1374
	        SetPlayerInterior(playerid,4);
1375
	        SetPlayerVirtualWorld(playerid,7);
1376
	        SetVehicleVirtualWorld(nrg[0],7);
1377
	        nrgfull[0] = 1;
1378
	        PutPlayerInVehicle(playerid, nrg[0], 0);
1379
	        playerinnrg[playerid] = 0;
1380
	        TogglePlayerControllable(playerid, 0);
1381
	        SetPlayerRaceCheckpoint(playerid,0,srcps[0][0],srcps[0][1],srcps[0][2],srcps[1][0],srcps[1][1],srcps[1][2],10);
1382
	        startvar[7] = 1;
1383
	        srtimer = SetTimer("StartSr", 60000, 0);
1384
         	format(string, sizeof(string), "%s has started a stadium race, you have one minute to type /srace and join", pname);//
1385
			SendClientMessageToAll(0x33AA33AA,string);
1386
			return 1;
1387
	    } else if(sron == 1 && srrank < 15) {
1388
	        playerinminigame[playerid] = 1;
1389
	        playerinsr[playerid] = 1;
1390
	        srrank++;
1391
	        currentracecheckpoint[playerid] = 0;
1392
	        SetPlayerInterior(playerid,4);
1393
	        for(new i=0; i<15; i++)
1394
    		{
1395
	    		if(nrgfull[i] == 0)
1396
	    		{
1397
	    		    SetPlayerVirtualWorld(playerid,7);
1398
	    		    SetVehicleVirtualWorld(nrg[i],7);
1399
	    		    nrgfull[i] = 1;
1400
	    		    PutPlayerInVehicle(playerid, nrg[i], 0);
1401
	    		    TogglePlayerControllable(playerid, 0);
1402
	    		    SetPlayerRaceCheckpoint(playerid,0,srcps[0][0],srcps[0][1],srcps[0][2],srcps[1][0],srcps[1][1],srcps[1][2],10);
1403
	    		    playerinnrg[playerid] = i;
1404
	    		    format(string, sizeof(string), "%s has joined the stadium race", pname);//
1405
					SendClientMessageToAll(0x33AA33AA,string);
1406
					return 1;
1407
	    		}
1408
			}
1409
	    } else if(sron == 1 && srrank >= 15) {
1410
		    format(string, sizeof(string), "The stadium race is full, wait for the next round", pname);//
1411
		    SendClientMessage(playerid,0x33AA33AA,string);
1412
		    return 1;
1413
	    }
1414
	}
1415
	
1416
	return 0;
1417
}
1418
1419
public OnPlayerInfoChange(playerid)
1420
{
1421
	return 1;
1422
}
1423
1424
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
1425
{
1426
	return 1;
1427
}
1428
1429
public OnPlayerExitVehicle(playerid, vehicleid)
1430
{
1431
	return 1;
1432
}
1433
1434
public OnPlayerStateChange(playerid, newstate, oldstate)
1435
{
1436
	if(newstate == 2)
1437
	{
1438
		playercarid[playerid] = GetPlayerVehicleID(playerid);
1439
	}
1440
	if(oldstate == 2)
1441
	{
1442
		if(playerinderby[playerid] || playerinqderby[playerid] || playerinkartrace[playerid] || playerinsr[playerid])
1443
		{
1444
			PutPlayerInVehicle(playerid,playercarid[playerid],0);
1445
		}
1446
	}
1447
	return 1;
1448
}
1449
1450
public OnPlayerEnterCheckpoint(playerid)
1451
{
1452
	return 1;
1453
}
1454
1455
public OnPlayerLeaveCheckpoint(playerid)
1456
{
1457
	return 1;
1458
}
1459
1460
public OnPlayerEnterRaceCheckpoint(playerid)
1461
{
1462
	if(playerinsd[playerid])
1463
	{
1464
		SetTimerEx("SdFinish",2000,0,"i",playerid);
1465
	} else if(playerinkartrace[playerid]) {
1466
        if(currentcheckpoint[playerid] <= 2)
1467
	    {
1468
			currentcheckpoint[playerid]++;
1469
			DisablePlayerRaceCheckpoint(playerid);
1470
			SetPlayerRaceCheckpoint(playerid,0,kcps[currentcheckpoint[playerid]][0],kcps[currentcheckpoint[playerid]][1],kcps[currentcheckpoint[playerid]][2],
1471
			kcps[currentcheckpoint[playerid]+1][0],kcps[currentcheckpoint[playerid]+1][1],kcps[currentcheckpoint[playerid]+1][2],20);
1472
		} else if(currentcheckpoint[playerid] >= 3 && currentcheckpoint[playerid] != 7) {
1473
			currentcheckpoint[playerid]++;
1474
			DisablePlayerRaceCheckpoint(playerid);
1475
			SetPlayerRaceCheckpoint(playerid,0,kcps[currentcheckpoint[playerid]-4][0],kcps[currentcheckpoint[playerid]-4][1],
1476
			kcps[currentcheckpoint[playerid]-4][2],kcps[currentcheckpoint[playerid]-3][0],kcps[currentcheckpoint[playerid]-3][1],
1477
			kcps[currentcheckpoint[playerid]-3][2],20);
1478
		} else if(currentcheckpoint[playerid] == 7) {
1479
		    if(krtfirst == 1)
1480
		    {
1481
				DisablePlayerRaceCheckpoint(playerid);
1482
			    new string[256];
1483
			    krtfirst++;
1484
			    kartrank--;
1485
			    new winnername[256];
1486
				GetPlayerName(playerid,winnername, sizeof(winnername));
1487
				RewardCalc(playerid,5000,10000);
1488
				format(string, sizeof(string), "%s has won the kart race for $%d", winnername, reward);
1489
				SendClientMessageToAll(0x33AA33AA, string);
1490
				GivePlayerMoney(playerid,reward);
1491
				playerinkartrace[playerid] = 0;
1492
				playerinminigame[playerid] = 0;
1493
				currentcheckpoint[playerid] = 0;
1494
				SetPlayerVirtualWorld(playerid,0);
1495
			    SetPlayerInterior(playerid, 0);
1496
				SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
1497
				if(kartrank == 0)
1498
				{
1499
				    KrtFinish();
1500
    			} else {
1501
					SetTimer("KrtFinish",60000,0);
1502
				}
1503
			} else {
1504
			    DisablePlayerRaceCheckpoint(playerid);
1505
		   		playerinkartrace[playerid] = 0;
1506
				playerinminigame[playerid] = 0;
1507
				currentcheckpoint[playerid] = 0;
1508
				SetPlayerVirtualWorld(playerid,0);
1509
				SetPlayerInterior(playerid, 0);
1510
				SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
1511
				if(kartrank == 0)
1512
				{
1513
				    KrtFinish();
1514
    			} else {
1515
					SetTimer("KrtFinish",60000,0);
1516
				}
1517
	    	}
1518
		}
1519
	} else if(playerinsr[playerid]) {
1520
        if(currentracecheckpoint[playerid] <= 7)
1521
	    {
1522
			currentracecheckpoint[playerid]++;
1523
			DisablePlayerRaceCheckpoint(playerid);
1524
			SetPlayerRaceCheckpoint(playerid,0,srcps[currentracecheckpoint[playerid]][0],srcps[currentracecheckpoint[playerid]][1],
1525
			srcps[currentracecheckpoint[playerid]][2],srcps[currentracecheckpoint[playerid]+1][0],srcps[currentracecheckpoint[playerid]+1][1],
1526
			srcps[currentracecheckpoint[playerid]+1][2],10);
1527
		} else if(currentracecheckpoint[playerid] == 8) {
1528
		    if(srfirst == 1)
1529
		    {
1530
				DisablePlayerRaceCheckpoint(playerid);
1531
				new string[256];
1532
			    srfirst++;
1533
			    srrank--;
1534
			    new winnername[256];
1535
				GetPlayerName(playerid,winnername, sizeof(winnername));
1536
				RewardCalc(playerid,5000,10000);
1537
				format(string, sizeof(string), "%s has won the stadium race for $%d", winnername, reward);
1538
				SendClientMessageToAll(0x33AA33AA, string);
1539
				GivePlayerMoney(playerid,reward);
1540
				playerinsr[playerid] = 0;
1541
				playerinminigame[playerid] = 0;
1542
				currentracecheckpoint[playerid] = 0;
1543
				SetPlayerVirtualWorld(playerid,0);
1544
				SetPlayerInterior(playerid, 0);
1545
				SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
1546
				if(srrank == 0)
1547
				{
1548
				    SrFinish();
1549
    			} else {
1550
					SetTimer("SrFinish",60000,0);
1551
				}
1552
			} else {
1553
			    DisablePlayerRaceCheckpoint(playerid);
1554
		   		playerinsr[playerid] = 0;
1555
				playerinminigame[playerid] = 0;
1556
				currentracecheckpoint[playerid] = 0;
1557
				SetPlayerVirtualWorld(playerid,0);
1558
				SetPlayerInterior(playerid, 0);
1559
				SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
1560
				if(srrank == 0)
1561
				{
1562
				    SrFinish();
1563
    			} else {
1564
					SetTimer("SrFinish",60000,0);
1565
				}
1566
	    	}
1567
		}
1568
	}
1569
	return 1;
1570
}
1571
1572
public OnPlayerLeaveRaceCheckpoint(playerid)
1573
{
1574
	return 1;
1575
}
1576
1577
public OnRconCommand(cmd[])
1578
{
1579
	return 1;
1580
}
1581
1582
public OnObjectMoved(objectid)
1583
{
1584
	return 1;
1585
}
1586
1587
public OnPlayerObjectMoved(playerid, objectid)
1588
{
1589
	return 1;
1590
}
1591
1592
public OnPlayerPickUpPickup(playerid, pickupid)
1593
{
1594
	return 1;
1595
}
1596
1597
public OnPlayerSelectedMenuRow(playerid, row)
1598
{
1599
	return 1;
1600
}
1601
1602
public OnPlayerExitedMenu(playerid)
1603
{
1604
	return 1;
1605
}
1606
1607
public Spawnbloodrings()
1608
{
1609
    for(new i=0; i<15; i++)
1610
    {
1611
		bloodring[i] = CreateVehicle(504,derbycars[i][0],derbycars[i][1],derbycars[i][2],derbycars[i][3],-1,-1,-1);
1612
		LinkVehicleToInterior(bloodring[i],15);
1613
		SetVehicleVirtualWorld(bloodring[i],1);
1614
	    bloodringfull[i] = 0;
1615
	}
1616
	return 1;
1617
}
1618
1619
public Destroybloodrings()
1620
{
1621
    for(new i=0; i<15; i++)
1622
    {
1623
    	DestroyVehicle(bloodring[i]);
1624
    	bloodringfull[i] = 0;
1625
    }
1626
}
1627
1628
public Respawnbloodrings()
1629
{
1630
	for(new i=0; i<15; i++)
1631
	{
1632
	    SetVehicleToRespawn(bloodring[i]);
1633
	    SetVehicleVirtualWorld(bloodring[i],1);
1634
	    bloodringfull[i] = 0;
1635
	}
1636
}
1637
1638
public Spawnqbloodrings()
1639
{
1640
    for(new i=0; i<15; i++)
1641
    {
1642
		qbloodring[i] = CreateVehicle(504,qderbycars[i][0],qderbycars[i][1],qderbycars[i][2],qderbycars[i][3],-1,-1,-1);
1643
		SetVehicleVirtualWorld(qbloodring[i],1);
1644
	    qbloodringfull[i] = 0;
1645
	}
1646
	return 1;
1647
}
1648
1649
public Destroyqbloodrings()
1650
{
1651
    for(new i=0; i<15; i++)
1652
    {
1653
    	DestroyVehicle(qbloodring[i]);
1654
    	qbloodringfull[i] = 0;
1655
    }
1656
}
1657
1658
public Respawnqbloodrings()
1659
{
1660
	for(new i=0; i<15; i++)
1661
	{
1662
    	SetVehicleToRespawn(qbloodring[i]);
1663
    	SetVehicleVirtualWorld(qbloodring[i],1);
1664
    	qbloodringfull[i] = 0;
1665
	}
1666
}
1667
1668
public SpawnKarts()
1669
{
1670
    for(new i=0; i<15; i++)
1671
    {
1672
		karts[i] = CreateVehicle(571,kartspawns[i][0],kartspawns[i][1],kartspawns[i][2],kartspawns[i][3],-1,-1,-1);
1673
		LinkVehicleToInterior(karts[i],15);
1674
		SetVehicleVirtualWorld(karts[i],1);
1675
	    kartfull[i] = 0;
1676
	}
1677
	return 1;
1678
}
1679
1680
public DestroyKarts()
1681
{
1682
    for(new i=0; i<15; i++)
1683
    {
1684
    	DestroyVehicle(karts[i]);
1685
    	kartfull[i] = 0;
1686
    }
1687
}
1688
1689
public RespawnKarts()
1690
{
1691
	for(new i=0; i<15; i++)
1692
	{
1693
    	SetVehicleToRespawn(karts[i]);
1694
    	SetVehicleVirtualWorld(karts[i],1);
1695
    	kartfull[i] = 0;
1696
	}
1697
}
1698
1699
public SpawnNrgs()
1700
{
1701
    for(new i=0; i<15; i++)
1702
    {
1703
		nrg[i] = CreateVehicle(522,nrgspawns[i][0],nrgspawns[i][1],nrgspawns[i][2],nrgspawns[i][3],-1,-1,-1);
1704
		LinkVehicleToInterior(nrg[i],4);
1705
		SetVehicleVirtualWorld(nrg[i],1);
1706
	    nrgfull[i] = 0;
1707
	}
1708
	return 1;
1709
}
1710
1711
public DestroyNrgs()
1712
{
1713
    for(new i=0; i<15; i++)
1714
    {
1715
    	DestroyVehicle(nrg[i]);
1716
    	nrgfull[i] = 0;
1717
    }
1718
}
1719
1720
public RespawnNrgs()
1721
{
1722
	for(new i=0; i<15; i++)
1723
	{
1724
    	SetVehicleToRespawn(nrg[i]);
1725
    	SetVehicleVirtualWorld(nrg[i],1);
1726
    	nrgfull[i] = 0;
1727
	}
1728
}
1729
1730
strtok(const string[], &index)
1731
{
1732
	new length = strlen(string);
1733
	while ((index < length) && (string[index] <= ' '))
1734
	{
1735
		index++;
1736
	}
1737
1738
	new offset = index;
1739
	new result[20];
1740
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
1741
	{
1742
		result[index - offset] = string[index];
1743
		index++;
1744
	}
1745
	result[index - offset] = EOS;
1746
	return result;
1747
}
1748
1749
public StartDerby()
1750
{
1751
	new delay = 1000;
1752
	new string[32];
1753
	if(startvar[0] == 1)
1754
	{
1755
		if( derbyrank <= 1 )
1756
		{
1757
		    SendClientMessageToAll(0x33AA33AA, "Derby canceled. Reason: Not enough players. (minimum = 2)");
1758
		    derbyplaying = 0;
1759
		    derbyrank = 0;
1760
		    derbyon = 0;
1761
		    startvar[0] = 0;
1762
		    Respawnbloodrings();
1763
	    	for(new i = 0; i <= MAX_PLAYERS; i++)
1764
			{
1765
				if(IsPlayerConnected(i))
1766
				{
1767
					if (playerinderby[i] == 1)
1768
					{
1769
					    playerinderby[i] = 0;
1770
					    playerinminigame[i] = 0;
1771
					    playerinbloodring[i] = -1;
1772
						SetPlayerVirtualWorld(i,0);
1773
						SetPlayerInterior(i, 0);
1774
					    SetPlayerPos(i, spawnX, spawnY, spawnZ);
1775
					    TogglePlayerControllable(i, 1);
1776
					}
1777
				}
1778
			}
1779
		    return 1;
1780
	 	}
1781
		format(string, sizeof(string), "~r~Ready");
1782
		derbyplaying = 1;
1783
		for(new i = 0; i <= MAX_PLAYERS; i++)
1784
		{
1785
			if(IsPlayerConnected(i))
1786
			{
1787
				if (playerinderby[i] == 1)
1788
				{
1789
					GameTextForPlayer(i, string, delay, 6);
1790
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
1791
				}
1792
			}
1793
		}
1794
		startvar[0] = 2;
1795
		SetTimer("StartDerby", delay, 0);
1796
	} else if(startvar[0] == 2) {
1797
		format(string, sizeof(string), "~r~Set");
1798
		for(new i = 0; i <= MAX_PLAYERS; i++)
1799
		{
1800
			if(IsPlayerConnected(i))
1801
			{
1802
				if (playerinderby[i] == 1)
1803
				{
1804
					GameTextForPlayer(i, string, delay, 6);
1805
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
1806
				}
1807
			}
1808
		}
1809
		startvar[0] = 3;
1810
		SetTimer("StartDerby", delay, 0);
1811
	} else if(startvar[0] == 3) {
1812
		format(string, sizeof(string), "~g~RAM!");
1813
		for(new i = 0; i <= MAX_PLAYERS; i++)
1814
		{
1815
			if(IsPlayerConnected(i))
1816
			{
1817
				if (playerinderby[i] == 1)
1818
				{
1819
					GameTextForPlayer(i, string, delay, 6);
1820
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
1821
					TogglePlayerControllable(i, 1);
1822
				}
1823
			}
1824
		}
1825
		startvar[0] = 0;
1826
	}
1827
	return 1;
1828
}
1829
1830
public Starttdm()
1831
{
1832
	new delay=1000;
1833
	new string[32];
1834
	if(startvar[1] == 1)
1835
	{
1836
		if( tdmrank <= 1 )
1837
		{
1838
		    SendClientMessageToAll(0x33AA33AA, "Team DM canceled. Reason: Not enough players. (minimum = 2)");
1839
		    tdmplaying = 0;
1840
		    tdmrank = 0;
1841
		    tdmon = 0;
1842
		    startvar[1] = 0;
1843
	    	for(new i = 0; i <= MAX_PLAYERS; i++)
1844
			{
1845
				if(IsPlayerConnected(i))
1846
				{
1847
					if (playerintdm[i] == 1)
1848
					{
1849
					    playerintdm[i] = 0;
1850
					    playerinminigame[i] = 0;
1851
						SetPlayerVirtualWorld(i,0);
1852
						SetPlayerInterior(i, 0);
1853
					    SetPlayerPos(i, spawnX, spawnY, spawnZ);
1854
					    TogglePlayerControllable(i, 1);
1855
					}
1856
				}
1857
			}
1858
			return 1;
1859
	 	}
1860
		format(string, sizeof(string), "~r~Ready");
1861
		tdmplaying = 1;
1862
		for(new i = 0; i <= MAX_PLAYERS; i++)
1863
		{
1864
			if(IsPlayerConnected(i))
1865
			{
1866
				if (playerintdm[i] == 1)
1867
				{
1868
					GameTextForPlayer(i, string, delay, 6);
1869
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
1870
				}
1871
			}
1872
		}
1873
		startvar[1] = 2;
1874
		SetTimer("Starttdm", delay, 0);
1875
	} else if(startvar[1] == 2) {
1876
		format(string, sizeof(string), "~r~Set");
1877
		for(new i = 0; i <= MAX_PLAYERS; i++)
1878
		{
1879
			if(IsPlayerConnected(i))
1880
			{
1881
				if (playerintdm[i] == 1)
1882
				{
1883
					GameTextForPlayer(i, string, delay, 6);
1884
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
1885
				}
1886
			}
1887
		}
1888
        startvar[1] = 3;
1889
		SetTimer("Starttdm", delay, 0);
1890
	} else if(startvar[1] == 3) {
1891
		format(string, sizeof(string), "~g~FIGHT!");
1892
		for(new i = 0; i <= MAX_PLAYERS; i++)
1893
		{
1894
			if(IsPlayerConnected(i))
1895
			{
1896
				if (playerintdm[i] == 1)
1897
				{
1898
					GameTextForPlayer(i, string, delay, 6);
1899
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
1900
					TogglePlayerControllable(i, 1);
1901
				}
1902
			}
1903
		}
1904
		startvar[1] = 0;
1905
	}
1906
	return 1;
1907
}
1908
1909
public Startdm()
1910
{
1911
	if(startvar[2] == 1)
1912
	{
1913
		if( dmrank <= 1 )
1914
		{
1915
		    SendClientMessageToAll(0x33AA33AA, "LVDM canceled. Reason: Not enough players. (minimum = 2)");
1916
		    dmplaying = 0;
1917
		    dmrank = 0;
1918
		    dmon = 0;
1919
		    startvar[2] = 0;
1920
	    	for(new i = 0; i <= MAX_PLAYERS; i++)
1921
			{
1922
				if(IsPlayerConnected(i))
1923
				{
1924
					if (playerindm[i] == 1)
1925
					{
1926
					    playerindm[i] = 0;
1927
					    playerinminigame[i] = 0;
1928
						SetPlayerVirtualWorld(i,0);
1929
						SetPlayerInterior(i, 0);
1930
					    SetPlayerPos(i, spawnX, spawnY, spawnZ);
1931
					    TogglePlayerControllable(i, 1);
1932
					}
1933
				}
1934
			}
1935
		    return 1;
1936
	 	}
1937
		new string[32];
1938
		format(string, sizeof(string), "~r~Ready");
1939
		new gdelay=1000;
1940
		dmplaying = 1;
1941
		for(new i = 0; i <= MAX_PLAYERS; i++)
1942
		{
1943
			if(IsPlayerConnected(i))
1944
			{
1945
				if (playerindm[i] == 1)
1946
				{
1947
					GameTextForPlayer(i, string, gdelay, 6);
1948
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
1949
				}
1950
			}
1951
		}
1952
		startvar[2] = 2;
1953
		SetTimer("Startdm", gdelay, 0);
1954
	} else if(startvar[2] == 2) {
1955
		new string[32];
1956
		format(string, sizeof(string), "~r~Set");
1957
		new hdelay=1000;
1958
		for(new i = 0; i <= MAX_PLAYERS; i++)
1959
		{
1960
			if(IsPlayerConnected(i))
1961
			{
1962
				if (playerindm[i] == 1)
1963
				{
1964
					GameTextForPlayer(i, string, hdelay, 6);
1965
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
1966
				}
1967
			}
1968
		}
1969
		startvar[2] = 3;
1970
		SetTimer("Startdm", hdelay, 0);
1971
	} else if(startvar[2] == 3) {
1972
		new rdelay=1000;
1973
		new string[32];
1974
		format(string, sizeof(string), "~g~FIGHT!");
1975
		for(new i = 0; i <= MAX_PLAYERS; i++)
1976
		{
1977
			if(IsPlayerConnected(i))
1978
			{
1979
				if (playerindm[i] == 1)
1980
				{
1981
					GameTextForPlayer(i, string, rdelay, 6);
1982
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
1983
					TogglePlayerControllable(i, 1);
1984
				}
1985
			}
1986
		}
1987
		startvar[2] = 0;
1988
	}
1989
	return 1;
1990
}
1991
1992
public StartqDerby()
1993
{
1994
	if(startvar[3] == 1)
1995
	{
1996
		if( qderbyrank <= 1 )
1997
		{
1998
		    SendClientMessageToAll(0x33AA33AA, "Quarry derby canceled. Reason: Not enough players. (minimum = 2)");
1999
		    qderbyplaying = 0;
2000
		    qderbyrank = 0;
2001
		    qderbyon = 0;
2002
		    startvar[3] = 0;
2003
		    Respawnqbloodrings();
2004
	    	for(new i = 0; i <= MAX_PLAYERS; i++)
2005
			{
2006
				if(IsPlayerConnected(i))
2007
				{
2008
					if (playerinqderby[i] == 1)
2009
					{
2010
					    playerinqderby[i] = 0;
2011
					    playerinminigame[i] = 0;
2012
					    playerinqbloodring[i] = -1;
2013
						SetPlayerVirtualWorld(i,0);
2014
						SetPlayerInterior(i, 0);
2015
					    SetPlayerPos(i, spawnX, spawnY, spawnZ);
2016
					    TogglePlayerControllable(i, 1);
2017
					}
2018
				}
2019
			}
2020
		    return 1;
2021
	 	}
2022
		new string[32];
2023
		format(string, sizeof(string), "~r~Ready");
2024
		new gdelay=1000;
2025
		qderbyplaying = 1;
2026
		for(new i = 0; i <= MAX_PLAYERS; i++)
2027
		{
2028
			if(IsPlayerConnected(i))
2029
			{
2030
				if (playerinqderby[i] == 1)
2031
				{
2032
					GameTextForPlayer(i, string, gdelay, 6);
2033
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2034
				}
2035
			}
2036
		}
2037
		startvar[3] = 2;
2038
		SetTimer("StartqDerby", gdelay, 0);
2039
	} else if(startvar[3] == 2) {
2040
		new string[32];
2041
		format(string, sizeof(string), "~r~Set");
2042
		new hdelay=1000;
2043
		for(new i = 0; i <= MAX_PLAYERS; i++)
2044
		{
2045
			if(IsPlayerConnected(i))
2046
			{
2047
				if (playerinqderby[i] == 1)
2048
				{
2049
					GameTextForPlayer(i, string, hdelay, 6);
2050
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2051
				}
2052
			}
2053
		}
2054
		startvar[3] = 3;
2055
		SetTimer("StartqDerby", hdelay, 0);
2056
	} else if(startvar[3] == 3) {
2057
		new rdelay=1000;
2058
		new string[32];
2059
		format(string, sizeof(string), "~g~RAM!");
2060
		for(new i = 0; i <= MAX_PLAYERS; i++)
2061
		{
2062
			if(IsPlayerConnected(i))
2063
			{
2064
				if (playerinqderby[i] == 1)
2065
				{
2066
					GameTextForPlayer(i, string, rdelay, 6);
2067
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
2068
					TogglePlayerControllable(i, 1);
2069
				}
2070
			}
2071
		}
2072
		startvar[3] = 0;
2073
	}
2074
	return 1;
2075
}
2076
2077
public StartBox()
2078
{
2079
	if(startvar[4] == 1)
2080
	{
2081
		if( boxrank <= 1 )
2082
		{
2083
		    SendClientMessageToAll(0x33AA33AA, "boxing fight canceled. Reason: Not enough players. (minimum = 2)");
2084
		    boxplaying = 0;
2085
		    boxrank = 0;
2086
		    boxon = 0;
2087
		    startvar[4] = 0;
2088
	    	for(new i = 0; i <= MAX_PLAYERS; i++)
2089
			{
2090
				if(IsPlayerConnected(i))
2091
				{
2092
					if (playerinbox[i] == 1)
2093
					{
2094
					    playerinbox[i] = 0;
2095
					    playerinminigame[i] = 0;
2096
						SetPlayerVirtualWorld(i,0);
2097
						SetPlayerInterior(i, 0);
2098
					    SetPlayerPos(i, spawnX, spawnY, spawnZ);
2099
					    TogglePlayerControllable(i, 1);
2100
					}
2101
				}
2102
			}
2103
		    return 1;
2104
	 	}
2105
		new string[32];
2106
		format(string, sizeof(string), "~r~Ready");
2107
		new gdelay=1000;
2108
		boxplaying = 1;
2109
		for(new i = 0; i <= MAX_PLAYERS; i++)
2110
		{
2111
			if(IsPlayerConnected(i))
2112
			{
2113
				if (playerinbox[i] == 1)
2114
				{
2115
					GameTextForPlayer(i, string, gdelay, 6);
2116
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2117
				}
2118
			}
2119
		}
2120
		startvar[4] = 2;
2121
		SetTimer("StartBox", gdelay, 0);
2122
	} else if(startvar[4] == 2) {
2123
		new string[32];
2124
		format(string, sizeof(string), "~r~Set");
2125
		new hdelay=1000;
2126
		for(new i = 0; i <= MAX_PLAYERS; i++)
2127
		{
2128
			if(IsPlayerConnected(i))
2129
			{
2130
				if (playerinbox[i] == 1)
2131
				{
2132
					GameTextForPlayer(i, string, hdelay, 6);
2133
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2134
				}
2135
			}
2136
		}
2137
		startvar[4] = 3;
2138
		SetTimer("StartBox", hdelay, 0);
2139
	} else if(startvar[4] == 3) {
2140
		new rdelay=1000;
2141
		new string[32];
2142
		format(string, sizeof(string), "~g~FIGHT!");
2143
		for(new i = 0; i <= MAX_PLAYERS; i++)
2144
		{
2145
			if(IsPlayerConnected(i))
2146
			{
2147
				if (playerinbox[i] == 1)
2148
				{
2149
					GameTextForPlayer(i, string, rdelay, 6);
2150
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
2151
					TogglePlayerControllable(i, 1);
2152
				}
2153
			}
2154
		}
2155
		startvar[4] = 0;
2156
	}
2157
	return 1;
2158
}
2159
2160
public StartSd()
2161
{
2162
	if(startvar[5] == 1)
2163
	{
2164
		if( sdrank <= 1 )
2165
		{
2166
		    SendClientMessageToAll(0x33AA33AA, "Skydive canceled. Reason: Not enough players. (minimum = 2)");
2167
		    sdplaying = 0;
2168
		    sdrank = 0;
2169
		    sdon = 0;
2170
		    startvar[5] = 0;
2171
	    	for(new i = 0; i <= MAX_PLAYERS; i++)
2172
			{
2173
				if(IsPlayerConnected(i))
2174
				{
2175
					if (playerinsd[i] == 1)
2176
					{
2177
					    playerinsd[i] = 0;
2178
					    playerinminigame[i] = 0;
2179
						SetPlayerVirtualWorld(i,0);
2180
						SetPlayerInterior(i, 0);
2181
					    SetPlayerPos(i, spawnX, spawnY, spawnZ);
2182
					    TogglePlayerControllable(i, 1);
2183
					}
2184
				}
2185
			}
2186
		    return 1;
2187
	 	}
2188
		new string[32];
2189
		format(string, sizeof(string), "~r~Ready");
2190
		new gdelay=1000;
2191
		sdplaying = 1;
2192
		for(new i = 0; i <= MAX_PLAYERS; i++)
2193
		{
2194
			if(IsPlayerConnected(i))
2195
			{
2196
				if (playerinsd[i] == 1)
2197
				{
2198
					GameTextForPlayer(i, string, gdelay, 6);
2199
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2200
				}
2201
			}
2202
		}
2203
		startvar[5] = 2;
2204
		SetTimer("StartSd", gdelay, 0);
2205
	} else if(startvar[5] == 2) {
2206
		new string[32];
2207
		format(string, sizeof(string), "~r~Set");
2208
		new hdelay=1000;
2209
		for(new i = 0; i <= MAX_PLAYERS; i++)
2210
		{
2211
			if(IsPlayerConnected(i))
2212
			{
2213
				if (playerinsd[i] == 1)
2214
				{
2215
					GameTextForPlayer(i, string, hdelay, 6);
2216
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2217
				}
2218
			}
2219
		}
2220
		startvar[5] = 3;
2221
		SetTimer("StartSd", hdelay, 0);
2222
	} else if(startvar[5] == 3) {
2223
		new rdelay=1000;
2224
		new string[32];
2225
		format(string, sizeof(string), "~g~GO!");
2226
		for(new i = 0; i <= MAX_PLAYERS; i++)
2227
		{
2228
			if(IsPlayerConnected(i))
2229
			{
2230
				if (playerinsd[i] == 1)
2231
				{
2232
					GameTextForPlayer(i, string, rdelay, 6);
2233
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
2234
					TogglePlayerControllable(i, 1);
2235
				}
2236
			}
2237
		}
2238
		SetTimer("EndSd",180000,0);
2239
		startvar[5] = 0;
2240
	}
2241
	return 1;
2242
}
2243
2244
public EndSd()
2245
{
2246
	for(new i = 0; i <= MAX_PLAYERS; i++)
2247
	{
2248
		if(IsPlayerConnected(i))
2249
		{
2250
			if (playerinsd[i] == 1)
2251
			{
2252
   				playerinsd[i] = 0;
2253
				playerinminigame[i] = 0;
2254
				SetPlayerVirtualWorld(i,0);
2255
				SetPlayerInterior(i, 0);
2256
				SetPlayerPos(i, spawnX, spawnY, spawnZ);
2257
			}
2258
		}
2259
	}
2260
	sdplaying = 0;
2261
	sdrank = 0;
2262
	sdon = 0;
2263
	startvar[5] = 0;
2264
	SendClientMessageToAll(0x33AA33AA, "The skydive has ended");
2265
	return 1;
2266
}
2267
2268
public StartKart()
2269
{
2270
	if(startvar[6] == 1) {
2271
		if( kartrank <= 1 )
2272
		{
2273
		    SendClientMessageToAll(0x33AA33AA, "Kart race canceled. Reason: Not enough players. (minimum = 2)");
2274
		    kartplaying = 0;
2275
		    kartrank = 0;
2276
		    karton = 0;
2277
		    startvar[6] = 0;
2278
		    RespawnKarts();
2279
	    	for(new i = 0; i <= MAX_PLAYERS; i++)
2280
			{
2281
				if(IsPlayerConnected(i))
2282
				{
2283
					if (playerinkartrace[i] == 1)
2284
					{
2285
					    playerinkartrace[i] = 0;
2286
					    playerinminigame[i] = 0;
2287
					    playerinkart[i] = -1;
2288
						SetPlayerVirtualWorld(i,0);
2289
						SetPlayerInterior(i, 0);
2290
					    SetPlayerPos(i, spawnX, spawnY, spawnZ);
2291
					    TogglePlayerControllable(i, 1);
2292
					}
2293
				}
2294
			}
2295
		    return 1;
2296
	 	}
2297
		new string[32];
2298
		format(string, sizeof(string), "~r~Ready");
2299
		new gdelay=1000;
2300
		kartplaying = 1;
2301
		for(new i = 0; i <= MAX_PLAYERS; i++)
2302
		{
2303
			if(IsPlayerConnected(i))
2304
			{
2305
				if (playerinkartrace[i] == 1)
2306
				{
2307
					GameTextForPlayer(i, string, gdelay, 6);
2308
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2309
				}
2310
			}
2311
		}
2312
		startvar[6] = 2;
2313
		SetTimer("StartKart", gdelay, 0);
2314
	} else if(startvar[6] == 2) {
2315
		new string[32];
2316
		format(string, sizeof(string), "~r~Set");
2317
		new hdelay=1000;
2318
		for(new i = 0; i <= MAX_PLAYERS; i++)
2319
		{
2320
			if(IsPlayerConnected(i))
2321
			{
2322
				if (playerinkartrace[i] == 1)
2323
				{
2324
					GameTextForPlayer(i, string, hdelay, 6);
2325
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2326
				}
2327
			}
2328
		}
2329
		startvar[6] = 3;
2330
		SetTimer("StartKart", hdelay, 0);
2331
	} else if(startvar[6] == 3) {
2332
		new rdelay=1000;
2333
		new string[32];
2334
		format(string, sizeof(string), "~g~GO!");
2335
		for(new i = 0; i <= MAX_PLAYERS; i++)
2336
		{
2337
			if(IsPlayerConnected(i))
2338
			{
2339
				if (playerinkartrace[i] == 1)
2340
				{
2341
					GameTextForPlayer(i, string, rdelay, 6);
2342
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
2343
					TogglePlayerControllable(i, 1);
2344
				}
2345
			}
2346
		}
2347
		SetTimer("KrtFinish",300000,0);
2348
		startvar[6] = 0;
2349
	}
2350
	return 1;
2351
}
2352
2353
public StartSr()
2354
{
2355
	if(startvar[7] == 1)
2356
	{
2357
		if( srrank <= 1 )
2358
		{
2359
		    SendClientMessageToAll(0x33AA33AA, "Stadium race canceled. Reason: Not enough players. (minimum = 2)");
2360
		    srplaying = 0;
2361
		    srrank = 0;
2362
		    sron = 0;
2363
		    startvar[7] = 0;
2364
		    RespawnNrgs();
2365
	    	for(new i = 0; i <= MAX_PLAYERS; i++)
2366
			{
2367
				if(IsPlayerConnected(i))
2368
				{
2369
					if (playerinsr[i] == 1)
2370
					{
2371
					    playerinsr[i] = 0;
2372
					    playerinminigame[i] = 0;
2373
					    playerinnrg[i] = -1;
2374
						SetPlayerVirtualWorld(i,0);
2375
						SetPlayerInterior(i, 0);
2376
					    SetPlayerPos(i, spawnX, spawnY, spawnZ);
2377
					    TogglePlayerControllable(i, 1);
2378
					}
2379
				}
2380
			}
2381
		    return 1;
2382
	 	}
2383
		new string[32];
2384
		format(string, sizeof(string), "~r~Ready");
2385
		new gdelay=1000;
2386
		kartplaying = 1;
2387
		for(new i = 0; i <= MAX_PLAYERS; i++)
2388
		{
2389
			if(IsPlayerConnected(i))
2390
			{
2391
				if (playerinsr[i] == 1)
2392
				{
2393
					GameTextForPlayer(i, string, gdelay, 6);
2394
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2395
				}
2396
			}
2397
		}
2398
		startvar[7] = 2;
2399
		SetTimer("StartSr", gdelay, 0);
2400
	} else if(startvar[7] == 2) {
2401
		new string[32];
2402
		format(string, sizeof(string), "~r~Set");
2403
		new hdelay=1000;
2404
		for(new i = 0; i <= MAX_PLAYERS; i++)
2405
		{
2406
			if(IsPlayerConnected(i))
2407
			{
2408
				if (playerinsr[i] == 1)
2409
				{
2410
					GameTextForPlayer(i, string, hdelay, 6);
2411
					PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
2412
				}
2413
			}
2414
		}
2415
		startvar[7] = 3;
2416
		SetTimer("StartSr", hdelay, 0);
2417
	} else if(startvar[7] == 3) {
2418
		new rdelay=1000;
2419
		new string[32];
2420
		format(string, sizeof(string), "~g~GO!");
2421
		for(new i = 0; i <= MAX_PLAYERS; i++)
2422
		{
2423
			if(IsPlayerConnected(i))
2424
			{
2425
				if (playerinsr[i] == 1)
2426
				{
2427
					GameTextForPlayer(i, string, rdelay, 6);
2428
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
2429
					TogglePlayerControllable(i, 1);
2430
				}
2431
			}
2432
		}
2433
		SetTimer("SrFinish",300000,0);
2434
		startvar[7] = 0;
2435
	}
2436
	return 1;
2437
}
2438
2439
public RewardCalc(playerid,min,max)//Originally from PenLS
2440
{
2441
	reward = (min + (random(max-min)));
2442
}
2443
2444
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
2445
{
2446
    if(IsPlayerConnected(playerid))
2447
	{
2448
		new Float:oldposx, Float:oldposy, Float:oldposz;
2449
		new Float:tempposx, Float:tempposy, Float:tempposz;
2450
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
2451
		tempposx = (oldposx -x);
2452
		tempposy = (oldposy -y);
2453
		tempposz = (oldposz -z);
2454
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
2455
		{
2456
			return 1;
2457
		}
2458
	}
2459
	return 0;
2460
}
2461
2462
public SdFinish(playerid)
2463
{
2464
	if(playerinsd[playerid] == 1 && PlayerToPoint(5,playerid,-1753.7169,884.6819,295.8750))
2465
	{
2466
	    if(sdfirst == 1)
2467
	    {
2468
		    DisablePlayerRaceCheckpoint(playerid);
2469
	        new string[256];
2470
	        sdfirst = 0;
2471
	        new winnername[256];
2472
			GetPlayerName(playerid,winnername, sizeof(winnername));
2473
			RewardCalc(playerid,5000,10000);
2474
			format(string, sizeof(string), "%s has won the skydive for $%d", winnername, reward);
2475
			SendClientMessageToAll(0x33AA33AA, string);
2476
			GivePlayerMoney(playerid,reward);
2477
			playerinsd[playerid] = 0;
2478
			playerinminigame[playerid] = 0;
2479
			SetPlayerVirtualWorld(playerid,0);
2480
			SetPlayerInterior(playerid, 0);
2481
			SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
2482
			SetTimer("EndSd",60000,0);
2483
	    } else {
2484
	        DisablePlayerRaceCheckpoint(playerid);
2485
   			playerinsd[playerid] = 0;
2486
			playerinminigame[playerid] = 0;
2487
			SetPlayerVirtualWorld(playerid,0);
2488
			SetPlayerInterior(playerid, 0);
2489
			SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
2490
	    }
2491
	}
2492
}
2493
2494
public load()
2495
{
2496
	Spawnbloodrings();
2497
	Spawnqbloodrings();
2498
	SpawnKarts();
2499
	SpawnNrgs();
2500
2501
	CreateObject(975, 213.7231, 1875.3864, 13.8800, 0.0000, 0.0000, 180);// area 51 gate for TeamDM
2502
2503
	// LVDM zone:
2504
	CreateObject(975,2237.232,2453.272,11.353,0.0,0.0,90.000);//Gates
2505
	CreateObject(975,2293.831,2499.356,4.016,0.0,0.0,90.000);
2506
	CreateObject(975,2335.095,2443.816,6.436,0.0,0.0,56.250);
2507
	CreateObject(1225,2242.148,2481.337,2.679,0.0,0.0,0.0);//Explosive barrels
2508
	CreateObject(1225,2249.003,2476.099,2.679,0.0,0.0,0.0);
2509
	CreateObject(1225,2269.786,2485.744,2.679,0.0,0.0,0.0);
2510
	CreateObject(1225,2309.837,2472.542,2.679,0.0,0.0,0.0);
2511
	CreateObject(1225,2296.421,2456.946,2.679,0.0,0.0,0.0);
2512
	CreateObject(1225,2276.625,2436.773,2.679,0.0,0.0,0.0);
2513
	CreateObject(1225,2251.733,2443.828,2.679,0.0,0.0,0.0);
2514
	CreateObject(1225,2335.119,2447.098,5.029,0.0,0.0,0.0);
2515
	CreateObject(1225,2334.300,2446.371,4.971,0.0,0.0,0.0);
2516
	CreateObject(1225,2332.263,2444.455,4.774,0.0,0.0,0.0);
2517
	CreateObject(1225,2333.340,2443.961,5.007,0.0,0.0,0.0);
2518
	CreateObject(1225,2332.409,2441.871,5.056,0.0,0.0,0.0);
2519
	CreateObject(1225,2329.335,2443.138,4.298,0.0,0.0,0.0);
2520
	CreateObject(1225,2328.618,2445.822,4.055,0.0,0.0,0.0);
2521
	CreateObject(1225,2330.095,2446.103,4.320,0.0,0.0,0.0);
2522
	CreateObject(1225,2329.184,2444.807,4.575,0.0,0.0,0.0);
2523
	CreateObject(1556,2294.025,2494.454,3.789,0.0,0.0,-90.000);//Door
2524
2525
	CreateObject(16681,2494.841,-1676.981,7000.000,0.0,0.0,0.0);//Boxing Arena
2526
	
2527
	SendClientMessageToAll(0xFFFF00AA,"Minigames filterscript loaded. Type /minigames for more information.");
2528
}
2529
2530
public KrtFinish()
2531
{
2532
	for(new i = 0; i <= MAX_PLAYERS; i++)
2533
	{
2534
		if(IsPlayerConnected(i))
2535
		{
2536
			if (playerinkartrace[i] == 1)
2537
			{
2538
   				playerinkartrace[i] = 0;
2539
				playerinminigame[i] = 0;
2540
				SetPlayerVirtualWorld(i,0);
2541
				SetPlayerInterior(i, 0);
2542
				SetPlayerPos(i, spawnX, spawnY, spawnZ);
2543
			}
2544
		}
2545
	}
2546
	kartplaying = 0;
2547
	kartrank = 0;
2548
	karton = 0;
2549
	RespawnKarts();
2550
	SendClientMessageToAll(0x33AA33AA, "The kart race has ended");
2551
	return 1;
2552
}
2553
2554
public SrFinish()
2555
{
2556
	for(new i = 0; i <= MAX_PLAYERS; i++)
2557
	{
2558
		if(IsPlayerConnected(i))
2559
		{
2560
			if (playerinsr[i] == 1)
2561
			{
2562
   				playerinsr[i] = 0;
2563
				playerinminigame[i] = 0;
2564
				SetPlayerVirtualWorld(i,0);
2565
				SetPlayerInterior(i, 0);
2566
				SetPlayerPos(i, spawnX, spawnY, spawnZ);
2567
			}
2568
		}
2569
	}
2570
	srplaying = 0;
2571
	srrank = 0;
2572
	sron = 0;
2573
	RespawnNrgs();
2574
	SendClientMessageToAll(0x33AA33AA, "The stadium race has ended");
2575
	return 1;
2576
}