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