· 7 years ago · Jan 15, 2019, 01:54 PM
1
2
3/*
4 Knogles Last Bed Standing Masterpiece for SA-MP
5 Fork of Minecrafts Bedwars
6 Little TDM Gamemode
7 Published under GNU GPL Public License.
8 Copyright (C) 2017 Fabian Druschke
9 Contact: webmaster@knogleinsi.de
10 Mail: Postfach 32 22 50147 Kerpen Germany
11
12 This program is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 3 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see http://www.gnu.org/licenses/
24
25*/
26
27#include <a_samp>
28#include <sscanf2>
29#include <a_mysql>
30#include <YSI\y_ini>
31
32#define MYSQL_HOST "debian" // Change this to your MySQL Remote IP or "localhost".
33#define MYSQL_USER "server" // Change this to your MySQL Database username.
34#define MYSQL_PASS "R^Rk6-bd1mvWGtIqF>,3{cAX9`8t#W}o8Qvh_[h,Ja}.WH!9g-Ld-)X`i,V(cU47C,;$g&JNgI\@rws[AB[NKOJQ["sZr)r7PI;SOe=8J5r>/h5PF,:-[dxRfnIZ3W-}" // Change this to your MySQL Database password.
35#define MYSQL_DATABASE "samp" // Change this to your MySQL Database name.
36
37
38#define DIALOG_REGISTER (0)
39#define DIALOG_LOGIN (1)
40
41
42new MySQL: Database, Corrupt_Check[MAX_PLAYERS];
43
44enum
45{
46 CHILLIAD,
47 SAN_FIERRO_DOCKS,
48 BONE_COUNTY,
49 MAD_DOGGS,
50 COUNTRYSIDE_1,
51 GREEN_PALMS,
52 COUNTRYSIDE_2
53};
54
55
56enum pInfo
57{
58 ID,
59 pName[25],
60
61 pPass[65],
62 Salt[11],
63 pAdmin,
64 pPassFails,
65
66 pKills,
67 pDeaths,
68
69 pBeds,
70 pBombs,
71
72Cache: Player_Cache,
73bool:LoggedIn
74}
75
76new playerdataInfo[MAX_PLAYERS][pInfo];
77
78enum
79{
80 INVALID_PICKUP_TYPE,
81 MONEY_TYPE,
82 ACTOR_TYPE,
83 INFO_TYPE
84};
85enum weather_info
86{
87 wt_id,
88 wt_text[255]
89};
90
91#define MAPTYPE BONE_COUNTY
92
93#define PATH "/Users/%s.ini"
94#define PRESSED(%0) \
95 (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
96
97#define FIRST_TEAM 0
98#define SECOND_TEAM 1
99#define THIRD_TEAM 2
100#define FOURTH_TEAM 3
101#define FIFTH_TEAM 4
102#define SIXTH_TEAM 5
103#define TEAM_SPECTATOR 6
104
105#define ADMIN_SPEC_TYPE_NONE 0
106#define ADMIN_SPEC_TYPE_PLAYER 1
107#define ADMIN_SPEC_TYPE_VEHICLE 2
108#define COLOR_WHITE 0xFFFFFFFF
109#define COLOR_NORMAL_PLAYER 0xFFBB7777
110#define COLOR_GREY 0xAFAFAFAA
111#define COLOR_RED 0xAA3333AA
112#define COLOR_GREEN 0x33AA33AA
113#define COLOR_YELLOW 0xFFFF0055
114#define COLOR_BLUE 0x0000BBAA
115#define COLOR_NAVY 0x000080AA
116
117#define SPECTATOR_TEAM_COLOR_TAG "{FFFFFF}SPECTATOR"
118
119#define MoneyVal 1000
120#define UnusedVehTimer 300000 //time in ms to respawn unoccupied vehicles
121#define BEDSSYSTEM 1
122
123
124
125
126#define DIALOG_REGISTER (0)
127#define DIALOG_LOGIN (1)
128
129//Register/Login system is enabled by default
130
131
132
133
134//----------------------------------------------------------
135forward WeatherTimer();
136forward GMX();
137forward RespawnAllVehicles();
138forward RandomWeather();
139forward SaveUser_data(playerid);
140forward OnPlayerDataSave(playerid);
141forward ResetPlayerData(playerid);
142forward warpcount(playerid);
143forward TeleportPlayerToBase(playerid);
144forward reveal(playerid);
145forward quickSort(array[], left, right);
146forward PrepareToBlowUp(playerid);
147forward GetPickupType(pickupid, &index);
148forward Float:frandom(Float:max, Float:min = 0.0, dp = 4);
149forward GetXYInFrontOfActor(actorid, &Float:x, &Float:y, Float:distance);
150forward GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);
151forward Float:GetDistance( Float:a1, Float:b1, Float:c1, Float:a2, Float:b2, Float:c2 );
152forward GenerateRandomPickup(modelid,type,Float:x_max,Float:x_min,Float:y_max,Float:y_min,Float:z_max,Float:z_min,virtualworld);
153forward LoadUser_data(playerid,name[],value[]);
154forward MONEY_MAIN();
155forward TEAM_MONEY();
156forward BlowUpThisBed();
157forward SendTeamMessage(teamid, color, const message[]);
158forward SellPlayerFightingStyle(playerid,cost,style);
159forward SellPlayerWeapon(playerid,cost,weaponid,ammo);
160forward SpecPlayer(playerid,targetplayer);
161forward UpdateTimeAndWeather();
162forward CountDown();
163forward StartCountdown();
164//----------------------------------------------------------
165new GameHasStarted;
166new CountDownTimer2;
167new Warppowder[MAX_PLAYERS];
168new PBeds[MAX_PLAYERS];
169new PKills[MAX_PLAYERS];
170new PSkill[MAX_PLAYERS];
171new PBomb[MAX_PLAYERS];
172new LastMoney[MAX_PLAYERS];
173new PStealth[MAX_PLAYERS];
174new Float:SpecX[MAX_PLAYERS], Float:SpecY[MAX_PLAYERS], Float:SpecZ[MAX_PLAYERS], vWorld[MAX_PLAYERS], Inter[MAX_PLAYERS];
175new IsSpecing[MAX_PLAYERS], Name[MAX_PLAYER_NAME], IsBeingSpeced[MAX_PLAYERS],spectatorid[MAX_PLAYERS];
176new Float:pX[MAX_PLAYERS];
177new Float:pY[MAX_PLAYERS];
178new Float:pZ[MAX_PLAYERS];
179new Float:wX[MAX_PLAYERS];
180new Float:wY[MAX_PLAYERS];
181new Float:wZ[MAX_PLAYERS];
182new SpectatingPlayer[MAX_PLAYERS];
183new PBombID[MAX_PLAYERS];
184new Beam[MAX_PLAYERS];
185new gPlayerTeamSelection[MAX_PLAYERS];
186new gPlayerHasTeamSelected[MAX_PLAYERS];
187new gPlayerLastTeamSelectionTick[MAX_PLAYERS];
188new PlayerInfo[MAX_PLAYERS][pInfo];
189new Helmet[MAX_PLAYERS];
190new BombObject[MAX_PLAYERS];
191new timestr[32];
192new timestrex[32];
193new delay=1000;// only allow new selection every ~1000 ms; may differ due to server load
194new bombtimer=5000;// time in ms to blow up closest bed
195new MoneyDropTimer=2500;// Time to generate new moneypickups
196new Shop_Counter;
197
198//--------------------------------------------------------------
199
200new totaltime;
201new gRandomWeatherIDs[][weather_info] =
202{
203 {1,"Sunny"},
204 {8,"Stormy"},
205 {9,"Foggy Sky"},
206 {11,"Extreme Sunny"},
207 {16,"Rainy"},
208 {19,"Thunderstorm"},
209 {20,"Foggy"}
210};
211
212
213
214//--------------------------------------------------------------
215new Menu:infomenu;
216new Menu:fightstyles;
217new Menu:shotguns;
218new Menu:items;
219new Menu:smg;
220new Menu:rifles;
221new Menu:yesno;
222new Menu:assaultrifle;
223new Menu:Grenades;
224new Menu:melee;
225new Menu:special;
226new Menu:shopmenu;
227new Menu:ammunation;
228new Menu:pistols;
229new Menu:microsmg;
230//--------------------------------------------------------------
231new Text:txtSpectatorHelper;
232new Text:txtClassSelHelper;
233new Text:txtTimeDisp;
234new Text:Textcover;
235new PlayerText:TeamCover[MAX_PLAYERS];
236new PlayerText:TeamText[MAX_PLAYERS];
237new PlayerText:LocText[MAX_PLAYERS];
238//--------------------------------------------------------------
239new moneyval;
240new maxmoney;
241new Float:x1, Float:y1, Float:z1;
242new running;
243new CountDownVar = 4;
244new WarpVar[MAX_PLAYERS];
245new WarpTimer;
246new CountDownTimer;
247new hour, minute;
248//--------------------------------------------------------------
249stock udb_hash(buf[]) {
250 new length=strlen(buf);
251 new s1 = 1;
252 new s2 = 0;
253 new n;
254 for (n=0; n<length; n++)
255 {
256 s1 = (s1 + buf[n]) % 65521;
257 s2 = (s2 + s1) % 65521;
258 }
259 return (s2 << 16) + s1;
260}
261
262#if defined MAPTYPE
263#if MAPTYPE==CHILLIAD
264#include <chilliad.pwn>
265#elseif MAPTYPE==BONE_COUNTY
266#include <bone_county.pwn>
267#elseif MAPTYPE==SAN_FIERRO_DOCKS
268#include <../../gamemodes/san_fierro_docks.pwn>
269#elseif MAPTYPE==MAD_DOGGS
270#include <mad_doggs.pwn>
271#elseif MAPTYPE==GREEN_PALMS
272#include <green_palms.pwn>
273#elseif MAPTYPE==COUNTRYSIDE_1
274#include <countryside_1.pwn>
275#elseif MAPTYPE==COUNTRYSIDE_2
276#include <countryside_2.pwn>
277#endif
278#endif
279
280#if defined TEAMSIZE
281#if TEAMSIZE > 6
282#error Amount of Teams is limited to 6!
283#endif
284#if TEAMSIZE < 2
285#error Minimum Amount of Teams is limited to 2!
286#endif
287#endif
288#if defined BEDSSYSTEM
289#if BEDSSYSTEM > 1
290#error Scoresystem val must be 0 or 1 (false true)
291#endif
292#if BEDSSYSTEM < 0
293#error Scoresystem val must be 0 or 1 (false true)
294#endif
295#endif
296
297#define getInv(%0) (((%0)>>8)<<8)
298
299#define COLOR_TEAM_ONE_STEALTH getInv(COLOR_TEAM_ONE) //Brown
300#define COLOR_TEAM_TWO_STEALTH getInv(COLOR_TEAM_TWO) //Jade
301#define COLOR_TEAM_THREE_STEALTH getInv(COLOR_TEAM_THREE) //Olive
302#define COLOR_TEAM_FOUR_STEALTH getInv(COLOR_TEAM_FOUR) //Aqua
303#define COLOR_TEAM_FIVE_STEALTH getInv(COLOR_TEAM_FIVE) //Olive
304#define COLOR_TEAM_SIX_STEALTH getInv(COLOR_TEAM_SIX) //Aqua
305
306//Never change these lines below if you don't know what to do
307new ActorPickups[sizeof(GlobalActors)];
308new InfoPickups[sizeof(PlayerInfoPickups)];
309new MoneyPickups[MAX_PICKUPS-sizeof(ActorPickups)-sizeof(InfoPickups)-1];
310//
311
312#define BYTECOUNT (cellbits / 8)
313
314stock binarysearch(a[],key,l,r)
315{
316 new k;
317 while(r >=l)
318 {
319 k = (l+r)/2;
320 if(key == a[k])
321 {
322 return k;
323 }
324 if(key < a[k])
325 {
326 r = k-1;
327 }
328 else
329 {
330 l= k+1;
331 }
332 }
333 return -1;
334}
335stock binarysearch2(a[][],idx,key,l,r)
336{
337 new k;
338 while(r >=l)
339 {
340 k = (l+r)/2;
341 if(key == a[k][idx])
342 {
343 return k;
344 }
345 if(key < a[k][idx])
346 {
347 r = k-1;
348 }
349 else
350 {
351 l= k+1;
352 }
353 }
354 return -1;
355}
356
357stock SendClientMessageEx(playerid, color, fstring[], {Float, _}:...)
358{
359 static const
360 ARGC = 3;
361 new n = (numargs() - ARGC) * BYTECOUNT;
362 if (n)
363 {
364 new message[128], arg_start, arg_end;
365 #emit CONST.alt fstring
366 #emit LCTRL 5
367 #emit ADD
368 #emit STOR.S.pri arg_start
369 #emit LOAD.S.alt n
370 #emit ADD
371 #emit STOR.S.pri arg_end
372 do
373 {
374 #emit LOAD.I
375 #emit PUSH.pri
376 arg_end -= BYTECOUNT;
377 #emit LOAD.S.pri arg_end
378 }
379 while (arg_end > arg_start);
380 #emit PUSH.S fstring
381 #emit PUSH.C 128
382 #emit PUSH.ADR message
383 n += BYTECOUNT * 3;
384 #emit PUSH.S n
385 #emit SYSREQ.C format
386 n += BYTECOUNT;
387 #emit LCTRL 4
388 #emit LOAD.S.alt n
389 #emit ADD
390 #emit SCTRL 4
391 return SendClientMessage(playerid, color, message);
392 }
393 else
394 {
395 return SendClientMessage(playerid, color, fstring);
396 }
397}
398
399new TEAM_ZONE_ONE;
400new TEAM_ZONE_TWO;
401
402#if defined TEAMSIZE
403#if TEAMSIZE >=3
404new TEAM_ZONE_THREE;
405#endif
406#endif
407#if defined TEAMSIZE
408#if TEAMSIZE >=4
409new TEAM_ZONE_FOUR;
410#endif
411#endif
412#if defined TEAMSIZE
413#if TEAMSIZE >=5
414new TEAM_ZONE_FIVE;
415#endif
416#endif
417#if defined TEAMSIZE
418#if TEAMSIZE == 6
419new TEAM_ZONE_SIX;
420#endif
421#endif
422
423
424new BED_STATE_TEAM_ONE;
425new BED_STATE_TEAM_TWO;
426
427#if defined TEAMSIZE
428#if TEAMSIZE >=3
429new BED_STATE_TEAM_THREE;
430#endif
431#endif
432#if defined TEAMSIZE
433#if TEAMSIZE >=4
434new BED_STATE_TEAM_FOUR;
435#endif
436#endif
437#if defined TEAMSIZE
438#if TEAMSIZE >=5
439new BED_STATE_TEAM_FIVE;
440#endif
441#endif
442#if defined TEAMSIZE
443#if TEAMSIZE ==6
444new BED_STATE_TEAM_SIX;
445#endif
446#endif
447
448
449public OnPlayerDataSave(playerid)
450{
451 Corrupt_Check[playerid]++;
452
453 new DB_Query[256];
454 //Running a query to save the player's data using the stored stuff.
455 mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `BEDS` = %d, `BOMBS` = %d, `KILLS` = %d, `DEATHS` = %d WHERE `ID` = %d LIMIT 1",
456 playerdataInfo[playerid][pBeds], playerdataInfo[playerid][pBombs], playerdataInfo[playerid][pKills], playerdataInfo[playerid][pDeaths], playerdataInfo[playerid][ID]);
457
458 mysql_tquery(Database, DB_Query);
459
460 if(cache_is_valid(playerdataInfo[playerid][Player_Cache])) //Checking if the player's cache ID is valid.
461 {
462 cache_delete(playerdataInfo[playerid][Player_Cache]); // Deleting the cache.
463 playerdataInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE; // Setting the stored player Cache as invalid.
464 }
465
466 playerdataInfo[playerid][LoggedIn] = false;
467}
468public OnGameModeExit()
469{
470 for(new i = 0; i < MAX_PLAYERS; i++)
471 {
472 if(IsPlayerConnected(i)) // Checking if the players stored in "i" are connected.
473 {
474 OnPlayerDisconnect(i, 1); // We do that so players wouldn't lose their data upon server's close.
475 }
476 }
477
478 mysql_close(Database); // Closing the database.
479 return 1;
480}
481public OnGameModeInit()
482{
483 CreateObject(1829,243.1000100,1804.9000000,6.9000000,0.0000000,0.0000000,0.0000000); //object(man_safenew) (1) //Generic skin selection
484 SetTimer("StartCountdown",1000,true);
485 mysql_log(ALL);
486 new MySQLOpt: option_id = mysql_init_options();
487 mysql_set_option(option_id, AUTO_RECONNECT, true); // We will set that option to automatically reconnect on timeouts.
488 mysql_set_option(option_id,SERVER_PORT,3306);
489
490 Database = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DATABASE, option_id); // Setting up the "Database" handle on the given MySQL details above.
491
492 if(Database == MYSQL_INVALID_HANDLE || mysql_errno(Database) != 0) // Checking if the database connection is invalid to shutdown.
493 {
494 print("I couldn't connect to the MySQL server, closing."); // Printing a message to the log.
495
496 sleep(5);
497
498 SendRconCommand("exit"); // Sending console command to shut down server.
499 return 1;
500 }
501
502 print("I have connected to the MySQL server."); // If the given MySQL details were all okay, this message prints to the log.
503
504 // Now, we will set up the information table of the player's information.
505
506 mysql_tquery(Database, "CREATE TABLE IF NOT EXISTS `PLAYERS` (`ID` int(11) NOT NULL AUTO_INCREMENT,`USERNAME` varchar(24) NOT NULL,`PASSWORD` char(65) NOT NULL,`SALT` char(11) NOT NULL,`BEDS` mediumint(7), `KILLS` mediumint(7), `BOMBS` mediumint(7) NOT NULL DEFAULT '0',`DEATHS` mediumint(7) NOT NULL DEFAULT '0', PRIMARY KEY (`ID`), UNIQUE KEY `USERNAME` (`USERNAME`))");
507
508
509
510 #if defined MAPTYPE
511 #if MAPTYPE==CHILLIAD
512 #tryinclude <chilliad_vehicles.txt>
513 #tryinclude <chilliad_objects.txt>
514 #elseif MAPTYPE==BONE_COUNTY
515 #tryinclude <bone_vehicles.txt>
516 #tryinclude <bone_objects.txt>
517 #elseif MAPTYPE==MAD_DOGGS
518 #tryinclude <md_vehicles.txt>
519 #tryinclude <md_objects.txt>
520 #elseif MAPTYPE==SAN_FIERRO_DOCKS
521 #tryinclude <sf_vehicles.txt>
522 #tryinclude <sf_objects.txt>
523 #elseif MAPTYPE==GREEN_PALMS
524 #tryinclude <gp_vehicles.txt>
525 #tryinclude <gp_objects.txt>
526 #elseif MAPTYPE==COUNTRYSIDE_1
527 #tryinclude <cs_vehicles.txt>
528 #tryinclude <cs_objects.txt>
529 #elseif MAPTYPE==COUNTRYSIDE_2
530 #tryinclude <cs2_vehicles.txt>
531 #tryinclude <cs2_objects.txt>
532 #endif
533 #endif
534
535
536
537 for(new t;t<sizeof(MoneyPickups);t++)
538 {
539 MoneyPickups[t]=-1;
540 }
541 for(new d;d<sizeof(ActorPickups);d++)
542 {
543 ActorPickups[d]=-1;
544 }
545 for(new f;f<sizeof(InfoPickups);f++)
546 {
547 InfoPickups[f]=-1;
548 }
549
550 SendRconCommand("mapname "#MAPTYPE);
551
552 SetTimer("RespawnAllVehicles",UnusedVehTimer, 1);
553 SetTimer("RandomWeather", 300000, 1);
554
555 #if defined TEAMSIZE
556 #if TEAMSIZE >=2
557 TEAM_ZONE_ONE = GangZoneCreate(GlobalZones[0][0],GlobalZones[0][1],GlobalZones[0][2],GlobalZones[0][3]);
558 TEAM_ZONE_TWO = GangZoneCreate(GlobalZones[1][0],GlobalZones[1][1],GlobalZones[1][2],GlobalZones[1][3]);
559 #endif
560 #endif
561 #if defined TEAMSIZE
562 #if TEAMSIZE >=3
563 TEAM_ZONE_THREE = GangZoneCreate(GlobalZones[2][0],GlobalZones[2][1],GlobalZones[2][2],GlobalZones[2][3]);
564 #endif
565 #endif
566 #if defined TEAMSIZE
567 #if TEAMSIZE >=4
568 TEAM_ZONE_FOUR = GangZoneCreate(GlobalZones[3][0],GlobalZones[3][1],GlobalZones[3][2],GlobalZones[3][3]);
569 #endif
570 #endif
571 #if defined TEAMSIZE
572 #if TEAMSIZE >=5
573 TEAM_ZONE_FIVE = GangZoneCreate(GlobalZones[4][0],GlobalZones[4][1],GlobalZones[4][2],GlobalZones[4][3]);
574 #endif
575 #endif
576 #if defined TEAMSIZE
577 #if TEAMSIZE >=6
578 TEAM_ZONE_SIX = GangZoneCreate(GlobalZones[5][0],GlobalZones[5][1],GlobalZones[5][2],GlobalZones[5][3]);
579 #endif
580 #endif
581
582 for(new g=0;g<sizeof(GlobalActors);g++)
583 {
584 CreateGlobalActor(g+1,274,GlobalActors[g][0],GlobalActors[g][1],GlobalActors[g][2],GlobalActors[g][3],3.0,g);
585 SetActorInvulnerable(g+1, true);
586 }
587 for(new t=0;t<sizeof(InfoPickups);t++)
588 {
589 InfoPickups[t]=CreatePickup(1239,2,PlayerInfoPickups[t][0],PlayerInfoPickups[t][1],PlayerInfoPickups[t][2],0);
590 }
591
592
593
594
595 infomenu = CreateMenu("Information", 1,20,200,200);
596 if(IsValidMenu(infomenu)){
597 AddMenuItem(infomenu, 0, "How to play");
598 AddMenuItem(infomenu, 0, "FAQ");
599 AddMenuItem(infomenu, 0, "Rules");
600 }
601 shopmenu = CreateMenu("Ammu-Nation", 1,20,200,200);
602 if(IsValidMenu(shopmenu)){
603 AddMenuItem(shopmenu, 0, "Weapons");
604 AddMenuItem(shopmenu, 0, "Improve Skill");
605 AddMenuItem(shopmenu, 0, "Stealth $85000");
606 AddMenuItem(shopmenu, 0, "Bomb $100000");
607 AddMenuItem(shopmenu, 0, "Warpkit $50000");
608 AddMenuItem(shopmenu, 0, "Helmet $5000");
609 AddMenuItem(shopmenu, 0, "Suicide");
610 }
611 yesno=CreateMenu("~w~Confirmation",1,20,150,150);
612 if(IsValidMenu(yesno)){
613 SetMenuColumnHeader(yesno, 0, "Suicide");
614 AddMenuItem(yesno, 0, "Yes");
615 AddMenuItem(yesno, 0, "No");
616 AddMenuItem(yesno, 0, "Back");
617 }
618 ammunation=CreateMenu("~w~Weaponlist",1,20,150,150);
619 if(IsValidMenu(ammunation)){
620 SetMenuColumnHeader(ammunation, 0, "Weapon Type");
621 AddMenuItem(ammunation,0," Pistols");
622 AddMenuItem(ammunation,0," Micro SMG");
623 AddMenuItem(ammunation,0," Shotguns");
624 AddMenuItem(ammunation,0," Misc");
625 AddMenuItem(ammunation,0," SMG");
626 AddMenuItem(ammunation,0," Rifles");
627 AddMenuItem(ammunation,0," Assault rifle");
628 AddMenuItem(ammunation,0," Grenades");
629 AddMenuItem(ammunation,0," Hand Guns");
630 AddMenuItem(ammunation,0," Special");
631 AddMenuItem(ammunation, 0, "Back");
632 }
633 pistols=CreateMenu("~w~Ammu-Nation",1,20,150,150);
634 if(IsValidMenu(pistols)){
635 SetMenuColumnHeader(pistols, 0, "Pistole");
636 AddMenuItem(pistols,0," 9mm $1500");
637 AddMenuItem(pistols,0," 9mm Silenced $2500");
638 AddMenuItem(pistols,0," Desert Eagle $2500");
639 AddMenuItem(pistols, 0, "Back");
640 }
641 microsmg=CreateMenu("~w~Ammu-Nation",1,20,150,150);
642 if(IsValidMenu(microsmg)){
643 SetMenuColumnHeader(microsmg, 0, "Micro SMG");
644 AddMenuItem(microsmg,0," Tec9 $5500");
645 AddMenuItem(microsmg,0," Micro SMG $5000");
646 AddMenuItem(microsmg, 0, "Back");
647 }
648 shotguns=CreateMenu("~w~Ammu-Nation",1,20,150,150);
649 if(IsValidMenu(shotguns)){
650 SetMenuColumnHeader(shotguns, 0, "Shotguns");
651 AddMenuItem(shotguns,0," Shotgun $12500");
652 AddMenuItem(shotguns,0," Sawn Off $15500");
653 AddMenuItem(shotguns,0," Combat Shotgun $55500");
654 AddMenuItem(shotguns, 0, "Back");
655 }
656 items=CreateMenu("~w~Ammu-Nation",1,20,150,150);
657 if(IsValidMenu(items)){
658 SetMenuColumnHeader(items, 0, "Item");
659 AddMenuItem(items,0," Armour $2500");
660 AddMenuItem(items,0," Parachute $2500");
661 AddMenuItem(items,0," Spraycan $2500");
662 AddMenuItem(items,0," Camera $2500");
663 AddMenuItem(items,0," Health $2500");
664 AddMenuItem(items,0," Fightstyles");
665 AddMenuItem(items,0,"Back");
666 }
667 fightstyles=CreateMenu("~w~Ammu-Nation",1,20,150,150);
668 if(IsValidMenu(fightstyles)){
669 SetMenuColumnHeader(fightstyles, 0, "Fightstyles");
670 AddMenuItem(fightstyles,0," Kung Fu $2500");
671 AddMenuItem(fightstyles,0," Kneehead $2500");
672 AddMenuItem(fightstyles,0," Boxing $2500");
673 AddMenuItem(fightstyles,0," Grabkick $2500");
674 AddMenuItem(fightstyles,0," Elbow $2500");
675 AddMenuItem(fightstyles,0," Normal");
676 AddMenuItem(fightstyles,0,"Back");
677 }
678 smg=CreateMenu("~w~Ammu-Nation",1,30,150,150);
679 if(IsValidMenu(smg)){
680 SetMenuColumnHeader(smg, 0, "SMG");
681 AddMenuItem(smg,0," SMG $20000");
682 AddMenuItem(smg, 0, "Back");
683 }
684 rifles=CreateMenu("~w~Ammu-Nation",1,20,150,150);
685 if(IsValidMenu(rifles)){
686 SetMenuColumnHeader(rifles, 0, "Rifle");
687 AddMenuItem(rifles,0," Cunt Gun $12500");
688 AddMenuItem(rifles,0," Sniper Rifle $40000");
689 AddMenuItem(rifles, 0, "Back");
690 }
691 assaultrifle=CreateMenu("~w~Ammu-Nation",1,20,150,150);
692 if(IsValidMenu(assaultrifle)){
693 SetMenuColumnHeader(assaultrifle, 0, "Assault Rifle");
694 AddMenuItem(assaultrifle,0," AK-47 $40000");
695 AddMenuItem(assaultrifle,0," M4 $45000");
696 AddMenuItem(assaultrifle, 0, "Back");
697 }
698 special=CreateMenu("~w~Ammu-Nation",1,20,150,150);
699 if(IsValidMenu(special)){
700 SetMenuColumnHeader(special, 0, "special");
701 AddMenuItem(special,0," Minigun $2000000");
702 AddMenuItem(special,0," Bazooka $250000");
703 AddMenuItem(special,0," Flame Thrower $250000");
704 AddMenuItem(special, 0, "Back");
705 }
706 melee=CreateMenu("~w~Ammu-Nation",1,20,150,150);
707 if(IsValidMenu(melee)){
708 SetMenuColumnHeader(melee, 0, "Hand Guns");
709 AddMenuItem(melee,0," Baseball");
710 AddMenuItem(melee,0," Dildo");
711 AddMenuItem(melee,0," Chainsaw $100000");
712 AddMenuItem(melee,0," Katana");
713 AddMenuItem(melee,0," Pool cue");
714 AddMenuItem(melee,0," Knife");
715 AddMenuItem(melee,0," Night Stick");
716 AddMenuItem(melee,0," Golf Club");
717 AddMenuItem(melee, 0, "Back");
718 }
719 Grenades=CreateMenu("~w~Ammu-Nation",1,20,150,150);
720 if(IsValidMenu(Grenades)){
721 SetMenuColumnHeader(Grenades, 0, "Grenades");
722 AddMenuItem(Grenades,0," Grenades $125000");
723 AddMenuItem(Grenades,0," Tear Gas $25000");
724 AddMenuItem(Grenades,0," Molotovs $25000");
725 AddMenuItem(Grenades, 0, "Back");
726 }
727
728
729 SetTimer("TEAM_MONEY", MoneyDropTimer, true);
730 SetTimer("MONEY_MAIN", 1000, true);
731
732
733
734
735
736 UpdateTimeAndWeather();
737 SetTimer("UpdateTimeAndWeather",1000 * 60,1);
738 SetGameModeText("Bedwars");
739 ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
740 ShowNameTags(1);
741 SetNameTagDrawDistance(40.0);
742 EnableStuntBonusForAll(0);
743 SetWeather(2);
744
745
746 UsePlayerPedAnims();
747
748
749 ClassSel_InitTextDraws();
750
751 // Player Classes/
752 for(new a=299; a!=0;a--)
753 {
754 AddPlayerClass(a,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
755 }
756
757 txtSpectatorHelper = TextDrawCreate(10.0, 415.0,
758 " Press ~b~~k~~GO_LEFT~ ~w~or ~b~~k~~GO_RIGHT~ ~w~to switch between players.");
759 TextDrawUseBox(txtSpectatorHelper, 1);
760 TextDrawBoxColor(txtSpectatorHelper,0x22222266);
761 TextDrawLetterSize(txtSpectatorHelper,0.3,1.0);
762 TextDrawTextSize(txtSpectatorHelper,400.0,40.0);
763 TextDrawFont(txtSpectatorHelper, 2);
764 TextDrawSetShadow(txtSpectatorHelper,0);
765 TextDrawSetOutline(txtSpectatorHelper,1);
766 TextDrawBackgroundColor(txtSpectatorHelper,0x000000FF);
767 TextDrawColor(txtSpectatorHelper,0xFFFFFFFF);
768
769 txtTimeDisp = TextDrawCreate(605.0,25.0,"00:00");
770 TextDrawUseBox(txtTimeDisp, 0);
771 TextDrawFont(txtTimeDisp, 3);
772 TextDrawSetShadow(txtTimeDisp,0); // no shadow
773 TextDrawSetOutline(txtTimeDisp,2); // thickness 1
774 TextDrawBackgroundColor(txtTimeDisp,0x000000FF);
775 TextDrawColor(txtTimeDisp,0xFFFFFFFF);
776 TextDrawAlignment(txtTimeDisp,3);
777 TextDrawLetterSize(txtTimeDisp,0.5,1.5);
778 return 1;
779}
780stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
781{
782 new Float:a;
783 GetPlayerPos(playerid, x, y, a);
784 GetPlayerFacingAngle(playerid, a);
785 if (GetPlayerVehicleID(playerid))
786 {
787 GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
788 }
789 x += (distance * floatsin(-a, degrees));
790 y += (distance * floatcos(-a, degrees));
791}
792stock Float:frandom(Float:max, Float:min = 0.0, dp = 4)
793{
794 new
795Float:mul = floatpower(10.0, dp),
796 imin = floatround(min * mul),
797 imax = floatround(max * mul);
798 return float(random(imax - imin) + imin) / mul;
799}
800
801public RandomWeather()
802{
803 new rand = random(sizeof(gRandomWeatherIDs));
804 new strout[256];
805 format(strout, sizeof(strout), "Weather changed to %s", gRandomWeatherIDs[rand][wt_text]);
806 SetWeather(gRandomWeatherIDs[rand][wt_id]);
807 SendClientMessageToAll(COLOR_WHITE,strout);
808 print(strout);
809}
810
811
812stock TeleportPlayerToBase(playerid)
813{
814 #if defined TEAMSIZE
815 #if TEAMSIZE >= 2
816 new randSpawn=0;
817 switch(gPlayerTeamSelection[playerid])
818 {
819 case FIRST_TEAM:
820 {
821 new str[80];
822 randSpawn = random(sizeof(gSpawnsTeam_TEAM_ONE));
823 format(str,sizeof(str),"SERVER: You have been teleported to the base of your team "#FIRST_TEAM_COLOR_TAG);
824 SendClientMessage(playerid,COLOR_WHITE,str);
825 SetPlayerPos(playerid,
826 gSpawnsTeam_TEAM_ONE[randSpawn][0],
827 gSpawnsTeam_TEAM_ONE[randSpawn][1],
828 gSpawnsTeam_TEAM_ONE[randSpawn][2]);
829 SetPlayerInterior(playerid,TEAM_ONE_INTERIOR);
830 }
831 case SECOND_TEAM:
832 {
833 new str[80];
834 randSpawn = random(sizeof(gSpawnsTeam_TEAM_TWO));
835 format(str,sizeof(str),"SERVER: You have been teleported to the base of your team "#SECOND_TEAM_COLOR_TAG);
836 SendClientMessage(playerid,COLOR_WHITE,str);
837 SetPlayerPos(playerid,
838 gSpawnsTeam_TEAM_TWO[randSpawn][0],
839 gSpawnsTeam_TEAM_TWO[randSpawn][1],
840 gSpawnsTeam_TEAM_TWO[randSpawn][2]);
841 SetPlayerInterior(playerid,TEAM_TWO_INTERIOR);
842 }
843
844
845 #endif
846 #endif
847 #if defined TEAMSIZE
848 #if TEAMSIZE >= 3
849
850
851 case THIRD_TEAM:
852 {
853 new str[80];
854 randSpawn = random(sizeof(gSpawnsTeam_TEAM_THREE));
855 format(str,sizeof(str),"SERVER: You have been teleported to the base of your team "#THIRD_TEAM_COLOR_TAG);
856 SendClientMessage(playerid,COLOR_WHITE,str);
857 SetPlayerPos(playerid,
858 gSpawnsTeam_TEAM_THREE[randSpawn][0],
859 gSpawnsTeam_TEAM_THREE[randSpawn][1],
860 gSpawnsTeam_TEAM_THREE[randSpawn][2]);
861 SetPlayerInterior(playerid,TEAM_THREE_INTERIOR);
862 }
863
864
865 #endif
866 #endif
867 #if defined TEAMSIZE
868 #if TEAMSIZE >= 4
869
870
871 case FOURTH_TEAM:
872 {
873 new str[80];
874 randSpawn = random(sizeof(gSpawnsTeam_TEAM_FOUR));
875 format(str,sizeof(str),"SERVER: You have been teleported to the base of your team "#FOURTH_TEAM_COLOR_TAG);
876 SendClientMessage(playerid,COLOR_WHITE,str);
877 SetPlayerPos(playerid,
878 gSpawnsTeam_TEAM_FOUR[randSpawn][0],
879 gSpawnsTeam_TEAM_FOUR[randSpawn][1],
880 gSpawnsTeam_TEAM_FOUR[randSpawn][2]);
881 SetPlayerInterior(playerid,TEAM_FOUR_INTERIOR);
882 }
883
884 #endif
885 #endif
886 #if defined TEAMSIZE
887 #if TEAMSIZE >= 5
888
889
890 case FIFTH_TEAM:
891 {
892 new str[80];
893 randSpawn = random(sizeof(gSpawnsTeam_TEAM_FIVE));
894 format(str,sizeof(str),"SERVER: You have been teleported to the base of your team "#FIFTH_TEAM_COLOR_TAG);
895 SendClientMessage(playerid,COLOR_WHITE,str);
896 SetPlayerPos(playerid,
897 gSpawnsTeam_TEAM_FIVE[randSpawn][0],
898 gSpawnsTeam_TEAM_FIVE[randSpawn][1],
899 gSpawnsTeam_TEAM_FIVE[randSpawn][2]);
900 SetPlayerInterior(playerid,TEAM_FIVE_INTERIOR);
901 }
902
903 #endif
904 #endif
905 #if defined TEAMSIZE
906 #if TEAMSIZE == 6
907
908
909 case SIXTH_TEAM:
910 {
911 new str[80];
912 randSpawn = random(sizeof(gSpawnsTeam_TEAM_SIX));
913 format(str,sizeof(str),"SERVER: You have been teleported to the base of your team "#SIXTH_TEAM_COLOR_TAG);
914 SendClientMessage(playerid,COLOR_WHITE,str);
915 SetPlayerPos(playerid,
916 gSpawnsTeam_TEAM_SIX[randSpawn][0],
917 gSpawnsTeam_TEAM_SIX[randSpawn][1],
918 gSpawnsTeam_TEAM_SIX[randSpawn][2]);
919 SetPlayerInterior(playerid,TEAM_SIX_INTERIOR);
920 }
921
922 #endif
923 #endif
924
925 }
926
927
928
929}
930
931stock SpecPlayer(playerid,targetplayer)
932{
933 new String[128];
934 GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
935 Inter[playerid] = GetPlayerInterior(playerid);
936 vWorld[playerid] = GetPlayerVirtualWorld(playerid);
937 TogglePlayerSpectating(playerid, true);
938 if(IsPlayerInAnyVehicle(targetplayer))
939 {
940 if(GetPlayerInterior(targetplayer) > 0)
941 {
942 SetPlayerInterior(playerid,GetPlayerInterior(targetplayer));
943 }
944 if(GetPlayerVirtualWorld(targetplayer) > 0)
945 {
946 SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(targetplayer));
947 }
948 PlayerSpectateVehicle(playerid,GetPlayerVehicleID(targetplayer));
949 }
950 else
951 {
952 if(GetPlayerInterior(targetplayer) > 0)
953 {
954 SetPlayerInterior(playerid,GetPlayerInterior(targetplayer));
955 }
956 if(GetPlayerVirtualWorld(targetplayer) > 0)
957 {
958 SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(targetplayer));
959 }
960 PlayerSpectatePlayer(playerid,targetplayer);
961 }
962 GetPlayerName(targetplayer, Name, sizeof(Name));
963 format(String, sizeof(String),"SERVER: You have started to spectate %s.",Name);
964 SendClientMessage(playerid,COLOR_WHITE,String);
965
966 IsSpecing[playerid] = 1;
967 IsBeingSpeced[targetplayer] = 1;
968 spectatorid[playerid] = targetplayer;
969}
970
971stock SpecRandomPlayer(playerid)
972{
973 new randoms[MAX_PLAYERS],idx;
974 for(new i=GetPlayerPoolSize(); i!=-1; i--)
975 {
976 if(IsPlayerConnected(i) && gPlayerTeamSelection[i] != TEAM_SPECTATOR && playerid != i)
977 {
978 randoms[idx++]=i;
979 }
980 }
981 TextDrawShowForPlayer(playerid,txtSpectatorHelper);
982 if(!idx) return 0; // INVALID_PLAYER_ID
983 SpecPlayer(playerid, randoms[random(idx)]);
984 return 1;
985}
986
987public reveal(playerid)
988{
989
990 SendClientMessage(playerid,COLOR_WHITE,"SERVER: You are visible again!");
991 if(PStealth[playerid] == -1 && (gPlayerTeamSelection[playerid] == FIRST_TEAM))
992 {
993 PStealth[playerid]=0;
994 SetPlayerColor(playerid,COLOR_TEAM_ONE);
995
996 }
997 if(PStealth[playerid] == -1 && (gPlayerTeamSelection[playerid] == SECOND_TEAM))
998 {
999 PStealth[playerid]=0;
1000 SetPlayerColor(playerid,COLOR_TEAM_TWO);
1001
1002 }
1003 #if defined TEAMSIZE
1004 #if TEAMSIZE >= 3
1005 if(PStealth[playerid] == -1 && (gPlayerTeamSelection[playerid] == THIRD_TEAM))
1006 {
1007 PStealth[playerid]=0;
1008 SetPlayerColor(playerid,COLOR_TEAM_THREE);
1009
1010 }
1011 #endif
1012 #endif
1013 #if defined TEAMSIZE
1014 #if TEAMSIZE >= 4
1015 if(PStealth[playerid] == -1 && (gPlayerTeamSelection[playerid] == FOURTH_TEAM))
1016 {
1017 PStealth[playerid]=0;
1018 SetPlayerColor(playerid,COLOR_TEAM_FOUR);
1019
1020 }
1021 #endif
1022 #endif
1023 #if defined TEAMSIZE
1024 #if TEAMSIZE >= 5
1025 if(PStealth[playerid] == -1 && (gPlayerTeamSelection[playerid] == FIFTH_TEAM))
1026 {
1027 PStealth[playerid]=0;
1028 SetPlayerColor(playerid,COLOR_TEAM_FIVE);
1029
1030 }
1031 #endif
1032 #endif
1033 #if defined TEAMSIZE
1034 #if TEAMSIZE == 6
1035 if(PStealth[playerid] == -1 && (gPlayerTeamSelection[playerid] == SIXTH_TEAM))
1036 {
1037 PStealth[playerid]=0;
1038 SetPlayerColor(playerid,COLOR_TEAM_SIX);
1039
1040 }
1041 #endif
1042 #endif
1043
1044}
1045
1046stock SellPlayerWeapon(playerid,cost,weaponid,ammo)
1047{
1048 if(GetPlayerMoney(playerid) >= cost)
1049 {
1050
1051 new spentstring[128];
1052 format(spentstring,sizeof(spentstring),"SERVER: You spent $%d to purchase this weapon!",cost);
1053 SendClientMessage(playerid,COLOR_WHITE,spentstring);
1054 printf("%d spent %d to purchase weapon %d",playerid,cost,weaponid);
1055 GivePlayerWeapon(playerid,weaponid,ammo);
1056 GivePlayerMoneyText(playerid,-cost);
1057 TogglePlayerControllable(playerid,true);
1058 }
1059 else
1060 {
1061 new leftmoney = (GetPlayerMoney(playerid)-cost);
1062 new insufstring[128];
1063 format(insufstring,sizeof(insufstring),"SERVER: You still need $%d to purchase this weapon!",-leftmoney);
1064 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Insufficient balance! You can not afford this weapon!");
1065 printf("%d tried to purchase weapon %d but still needs %d",playerid,weaponid,-leftmoney);
1066 SendClientMessage(playerid,COLOR_WHITE,insufstring);
1067 TogglePlayerControllable(playerid,true);
1068 }
1069}
1070
1071stock SellPlayerFightingStyle(playerid,cost,style)
1072{
1073 if(GetPlayerMoney(playerid) >= cost)
1074 {
1075
1076 new spentstring[128];
1077 format(spentstring,sizeof(spentstring),"SERVER: You spent $%d to purchase this style!",cost);
1078 SendClientMessage(playerid,COLOR_WHITE,spentstring);
1079 SetPlayerFightingStyle(playerid,style);
1080 GivePlayerMoneyText(playerid,-cost);
1081 TogglePlayerControllable(playerid,true);
1082 }
1083 else
1084 {
1085 new leftmoney = (GetPlayerMoney(playerid)-cost);
1086 new insufstring[128];
1087 format(insufstring,sizeof(insufstring),"SERVER: You still need $%d to purchase this fightstyle!",-leftmoney);
1088 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Insufficient balance! You can not afford this fightstyle!");
1089 SendClientMessage(playerid,COLOR_WHITE,insufstring);
1090 TogglePlayerControllable(playerid,true);
1091 }
1092}
1093stock GenerateRandomPickup(modelid,type,Float:x_max,Float:x_min,Float:y_max,Float:y_min,Float:z_max,Float:z_min,virtualworld)
1094{
1095 if(maxmoney <= sizeof(MoneyPickups))
1096 {
1097
1098 moneyval= moneyval+1000;
1099 new Float:rx1=((frandom((floatabs(x_max-x_min)))+x_min));
1100 new Float:ry2=((frandom((floatabs(y_max-y_min)))+y_min));
1101 new Float:rz3=((frandom((floatabs(z_max-z_min)))+z_min));
1102 maxmoney = maxmoney +1;
1103 MoneyPickups[maxmoney] = CreatePickup(modelid,type,rx1,ry2,rz3,virtualworld);
1104 HeapSort(MoneyPickups);
1105
1106 }
1107
1108
1109}
1110stock FinishedGame()
1111{
1112 new scoreTable[MAX_PLAYERS][2], idx;
1113 for(new i = GetPlayerPoolSize(); i!=-1; i--)
1114 {
1115 if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
1116 scoreTable[i][0] = playerdataInfo[i][pKills];
1117 scoreTable[i][1] = i;
1118 }
1119 SortDeepArray(scoreTable, 0, .order = SORT_DESC); //Sortiert nach Kills
1120 for(new i = 0; i < MAX_PLAYERS; i++)
1121 {
1122 if(!IsPlayerConnected(i) || IsPlayerNPC(i))
1123 {
1124 continue;
1125 }
1126
1127 idx = scoreTable[i][1];
1128 playerdataInfo[idx][pKills]
1129 playerdataInfo[idx][pDeaths]
1130 playerdataInfo[idx][pBeds]
1131 }
1132
1133
1134 SetTimer("GMX",500,false);
1135}
1136
1137stock CheckSufficientPlayerCount()
1138{
1139 if(GetActiveTeamCount() > 1)
1140 {
1141 StartGame();
1142 }
1143
1144}
1145stock StartGame()
1146{
1147
1148 if(GetActiveTeamCount() > 1)
1149 {
1150 CountDownVar--;
1151 new str[128];
1152 if(CountDownVar == 0)
1153 {
1154 KillTimer(CountDownTimer2);
1155 CountDownVar = 59;
1156 GameHasStarted =1;
1157 GameTextForAll("Start!",1000,1);
1158 for(new i = 0; i < MAX_PLAYERS; i++)
1159 {
1160 if(gPlayerHasTeamSelected(i))
1161 {
1162 TeleportPlayerToBase(i);
1163 TogglePlayerControllable(i,1);
1164 ResetPlayerData(i);
1165
1166 }
1167 }
1168 }
1169 else
1170 {
1171 format(str, sizeof(str), "Count Down: %d", CountDownTimer2);
1172 GameTextForAll(str, 1000, 1);
1173 }
1174 return 1;
1175
1176 }
1177 else
1178 {
1179 CountDownVar = 59;
1180
1181 }
1182
1183}
1184
1185
1186public CountDown()
1187{
1188 CountDownVar--;
1189 for(new i = 0; i < MAX_PLAYERS; i++)
1190 {
1191 if(CountDownVar == 0)
1192 {
1193 KillTimer(CountDownTimer);
1194 CountDownVar = 4;
1195 PlayerPlaySound(i,7419,0,0,0);
1196 }
1197 if(CountDownVar == 1)
1198 {
1199 PlayerPlaySound(i,7418,0,0,0);
1200 }
1201 if(CountDownVar == 2)
1202 {
1203 PlayerPlaySound(i,7417,0,0,0);
1204 }
1205 }
1206 return 1;
1207}
1208
1209public warpcount(playerid)
1210{
1211 WarpVar[playerid]--;
1212 new Float:x,Float:y,Float:z;
1213 GetPlayerPos(playerid,x,y,z);
1214
1215 if(WarpVar[playerid] == 0)
1216 {
1217 if(!IsPlayerInRangeOfPoint(playerid,2.0,wX[playerid],wY[playerid],wZ[playerid]))
1218 {
1219 KillTimer(WarpTimer);
1220 WarpVar[playerid] = 4;
1221 Warppowder[playerid]=1;
1222 if(IsValidObject(Beam[playerid]))
1223 DestroyObject(Beam[playerid]);
1224 return SendClientMessage(playerid,COLOR_WHITE,"SERVER: You moved right away! Teleport aborted.");
1225 }
1226 if(IsValidObject(Beam[playerid]))
1227 DestroyObject(Beam[playerid]);
1228 TeleportPlayerToBase(playerid);
1229
1230 WarpVar[playerid] = 4;
1231 KillTimer(WarpTimer);
1232 PlayerPlaySound(playerid,1137,x,y,z);
1233 }
1234 if(WarpVar[playerid] == 1)
1235 {
1236 if(!IsPlayerInRangeOfPoint(playerid,2.0,wX[playerid],wY[playerid],wZ[playerid]))
1237 {
1238 KillTimer(WarpTimer);
1239 WarpVar[playerid] = 4;
1240 Warppowder[playerid]=1;
1241 if(IsValidObject(Beam[playerid]))
1242 DestroyObject(Beam[playerid]);
1243 return SendClientMessage(playerid,COLOR_WHITE,"SERVER: You moved right away! Teleport aborted.");
1244
1245 }
1246 PlayerPlaySound(playerid,1137,x,y,z);
1247
1248 }
1249 if(WarpVar[playerid] == 2)
1250 {
1251 if(!IsPlayerInRangeOfPoint(playerid,2.0,wX[playerid],wY[playerid],wZ[playerid]))
1252 {
1253 KillTimer(WarpTimer);
1254 WarpVar[playerid] = 4;
1255 Warppowder[playerid]=1;
1256 if(IsValidObject(Beam[playerid]))
1257 DestroyObject(Beam[playerid]);
1258 return SendClientMessage(playerid,COLOR_WHITE,"SERVER: You moved right away! Teleport aborted.");
1259 }
1260 PlayerPlaySound(playerid,1137,x,y,z);
1261
1262 }
1263 if(WarpVar[playerid] == 3)
1264 {
1265 if(!IsPlayerInRangeOfPoint(playerid,2.0,wX[playerid],wY[playerid],wZ[playerid]))
1266 {
1267 KillTimer(WarpTimer);
1268 WarpVar[playerid] = 4;
1269 Warppowder[playerid]=1;
1270 if(IsValidObject(Beam[playerid]))
1271 DestroyObject(Beam[playerid]);
1272 return SendClientMessage(playerid,COLOR_WHITE,"SERVER: You moved right away! Teleport aborted.");
1273 }
1274 PlayerPlaySound(playerid,1137,x,y,z);
1275
1276 }
1277
1278
1279 return 1;
1280}
1281
1282
1283
1284public SendTeamMessage(teamid, color, const message[])
1285{
1286 for(new i; i < MAX_PLAYERS; i++)
1287 {
1288 if(!IsPlayerConnected(i)) continue;
1289 if(gPlayerTeamSelection[i] != teamid) continue;
1290
1291 SendClientMessage(i, color, message);
1292 }
1293 return 1;
1294}
1295
1296public OnPlayerExitedMenu(playerid)
1297{
1298 TogglePlayerControllable(playerid,true);
1299 return 1;
1300}
1301/*
1302stock DropPlayerWeaponPickup(weaponid,ammo,Float:x,Float:y,Float:z)
1303{
1304
1305}
1306*/
1307public OnPlayerPickUpPickup(playerid, pickupid)
1308{
1309 if(GameHasStarted == 1)
1310 {
1311 new index;
1312 switch(GetPickupType(pickupid,index))
1313 {
1314 case INVALID_PICKUP_TYPE:
1315 {
1316 }
1317 case MONEY_TYPE:
1318 {
1319 maxmoney -= 1;
1320 GivePlayerMoney(playerid, MoneyVal);
1321 MoneyPickups[index]=-1;
1322 quickSort(MoneyPickups,0,sizeof(MoneyPickups)-1);
1323 DestroyPickup(pickupid);
1324 }
1325 case ACTOR_TYPE:
1326 {
1327 ShowMenuForPlayer(shopmenu,playerid);
1328 TogglePlayerControllable(playerid,false);
1329 }
1330 case INFO_TYPE:
1331 {
1332 ShowMenuForPlayer(infomenu,playerid);
1333 TogglePlayerControllable(playerid,false);
1334 }
1335 }
1336 }
1337 return 1;
1338
1339}
1340
1341
1342
1343
1344stock GetPickupType(pickupid, &index)
1345{
1346 new mres = binarysearch(MoneyPickups,pickupid,0,sizeof(MoneyPickups)-1);
1347 if(mres > -1 && MoneyPickups[mres] == pickupid) return index=mres,MONEY_TYPE;
1348 new ares = binarysearch(ActorPickups,pickupid,0,sizeof(ActorPickups)-1);
1349 if(ares > -1 && ActorPickups[ares] == pickupid) return index=ares,ACTOR_TYPE;
1350 new ires = binarysearch(InfoPickups,pickupid,0,sizeof(InfoPickups)-1);
1351 if(ires > -1 && InfoPickups[ires] == pickupid) return index=ires,INFO_TYPE;
1352
1353
1354
1355 return INVALID_PICKUP_TYPE;
1356}
1357
1358public UpdateTimeAndWeather()
1359{
1360
1361
1362
1363 gettime(hour, minute);
1364
1365 format(timestr,32,"%02d:%02d",hour,minute);
1366 format(timestrex,32,"Time: %02d:%02d",hour,minute);
1367 TextDrawSetString(txtTimeDisp,timestr);
1368
1369
1370 for(new i;i<MAX_PLAYERS;i++)
1371 {
1372 if(!IsPlayerConnected(i)) continue;
1373 if(IsPlayerAdmin(i))
1374 PlayerInfo[i][pAdmin]=1;
1375 }
1376
1377
1378 SetWorldTime(hour);
1379
1380 new x=0;
1381 while(x!=MAX_PLAYERS) {
1382 if(IsPlayerConnected(x)) {
1383 SetPlayerTime(x,hour,minute);
1384 }
1385 x++;
1386 }
1387
1388
1389}
1390main()
1391{
1392 print(" Knogles Last Bed Standing Masterpiece for SA-MP");
1393 print(" Fork of Minecrafts Bedwars");
1394 print(" Little TDM Gamemode");
1395 print(" Published under GNU GPL Public License.");
1396 print(" Copyright (C) 2017 Fabian Druschke");
1397 print(" Contact: webmaster@knogleinsi.de");
1398 print(" Mail: Postfach 32 22 50147 Kerpen Germany");
1399 print(" \n This program is free software: you can redistribute it and/or modify");
1400 print(" it under the terms of the GNU General Public License as published by");
1401 print(" the Free Software Foundation, either version 3 of the License, or");
1402 print(" (at your option) any later version.");
1403 print(" \n This program is distributed in the hope that it will be useful,");
1404 print(" but WITHOUT ANY WARRANTY; without even the implied warranty of");
1405 print(" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the");
1406 print(" GNU General Public License for more details.");
1407 print(" \n You should have received a copy of the GNU General Public License");
1408 print(" along with this program. If not, see http://www.gnu.org/licenses/");
1409 printf("\n\nHeapspace: %i kilobytes", heapspace() / 1024);
1410
1411}
1412
1413//----------------------------------------------------------
1414
1415stock Float:GetDistance( Float:a1, Float:b1, Float:c1, Float:a2, Float:b2, Float:c2 )
1416{
1417 return floatsqroot(((a1-a2)*(a1-a2))+((b1-b2)*(b1-b2))+((c1-c2)*(c1-c2)));
1418}
1419
1420stock HeapSort (array [], n = sizeof (array))
1421{
1422 new i;
1423 for (i = n / 2; i > 0; --i) // Make heap
1424 SinkDown (array, i, n);
1425
1426 for (i = n; i > 1; --i)
1427 {
1428 Swap (array [i - 1], array [0]);
1429 SinkDown (array, 1, i - 1);
1430 }
1431}
1432/*
1433stock strcpy(dest[], src[], size = sizeof(dest))
1434{
1435 dest[0] = EOS;
1436 return strcat(dest, src, size);
1437}
1438*/
1439stock quickSort(array[], left, right)
1440{
1441 new
1442 tempLeft = left,
1443 tempRight = right,
1444 pivot = array[(left + right) / 2],
1445 tempVar
1446 ;
1447 while(tempLeft <= tempRight)
1448 {
1449 while(array[tempLeft] < pivot) tempLeft++;
1450 while(array[tempRight] > pivot) tempRight--;
1451
1452 if(tempLeft <= tempRight)
1453 {
1454 tempVar = array[tempLeft], array[tempLeft] = array[tempRight], array[tempRight] = tempVar;
1455 tempLeft++, tempRight--;
1456 }
1457 }
1458 if(left < tempRight) quickSort(array, left, tempRight);
1459 if(tempLeft < right) quickSort(array, tempLeft, right);
1460}
1461
1462
1463
1464//----------------------------------------------------------
1465
1466static stock SinkDown (array [], i, m)
1467{
1468 new j;
1469 while (2 * i <= m)
1470 {
1471 j = 2 * i;
1472 if (j < m && array [j - 1] < array [j])
1473 ++j;
1474
1475 if (array [i - 1] < array [j - 1])
1476 {
1477 Swap (array [i - 1], array [j - 1]);
1478 i = j;
1479 }
1480 else
1481 i = m;
1482 }
1483}
1484
1485//----------------------------------------------------------
1486
1487static stock Swap (&a, &b)
1488{
1489 new s;
1490 s = a;
1491 a = b;
1492 b = s;
1493}
1494
1495//----------------------------------------------------------
1496stock PreloadAnimLib(playerid, animlib[])
1497{
1498 ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
1499}
1500
1501
1502public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
1503{
1504 switch (dialogid)
1505 {
1506 case DIALOG_LOGIN:
1507 {
1508 if(!response) return Kick(playerid);
1509
1510 new Salted_Key[65];
1511 SHA256_PassHash(inputtext, playerdataInfo[playerid][Salt], Salted_Key, 65);
1512
1513 if(strcmp(Salted_Key, playerdataInfo[playerid][pPass]) == 0)
1514 {
1515 // Now, password should be correct as well as the strings
1516 // Matched with each other, so nothing is wrong until now.
1517
1518 // We will activate the cache of player to make use of it e.g.
1519 // Retrieve their data.
1520
1521 cache_set_active(playerdataInfo[playerid][Player_Cache]);
1522
1523 // Okay, we are retrieving the information now..
1524 cache_get_value_int(0, "ID", playerdataInfo[playerid][ID]);
1525
1526 cache_get_value_int(0, "KILLS", playerdataInfo[playerid][pKills]);
1527 cache_get_value_int(0, "DEATHS", playerdataInfo[playerid][pDeaths]);
1528
1529 cache_get_value_int(0, "BEDS", playerdataInfo[playerid][pBeds]);
1530 cache_get_value_int(0, "BOMBS", playerdataInfo[playerid][pBombs]);
1531
1532 SetPlayerScore(playerid, playerdataInfo[playerid][pBeds]);
1533
1534 ResetPlayerMoney(playerid);
1535 GivePlayerMoney(playerid, playerdataInfo[playerid][pBombs]);
1536
1537 // So, we have successfully retrieved data? Now deactivating the cache.
1538
1539 cache_delete(playerdataInfo[playerid][Player_Cache]);
1540 playerdataInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
1541
1542 playerdataInfo[playerid][LoggedIn] = true;
1543 SendClientMessage(playerid, 0x00FF00FF, "You have been successfully logged in!");
1544 }
1545 else
1546 {
1547 new String[150];
1548
1549 playerdataInfo[playerid][pPassFails] += 1;
1550 printf("%s has been failed to login. (%d)", playerdataInfo[playerid][pName], playerdataInfo[playerid][pPassFails]);
1551 // Printing the message that someone has failed to login to his account.
1552
1553 if (playerdataInfo[playerid][pPassFails] >= 3) // If the fails exceeded the limit we kick the player.
1554 {
1555 format(String, sizeof(String), "%s has been kicked Reason: {FF0000}(%d/3) Login fails.", playerdataInfo[playerid][pName], playerdataInfo[playerid][pPassFails]);
1556 SendClientMessageToAll(0x969696FF, String);
1557 Kick(playerid);
1558 }
1559 else
1560 {
1561 // If the player didn't exceed the limits we send him a message that the password is wrong.
1562 format(String, sizeof(String), "Wrong password, you have %d out of 3 tries.", playerdataInfo[playerid][pPassFails]);
1563 SendClientMessage(playerid, 0xFF0000FF, String);
1564
1565 format(String, sizeof(String), "{FFFFFF}Welcome back, %s.\n\n{0099FF}This account is already registered.\n\
1566 {FFFFFF}Type in your password below to login.\n\n", playerdataInfo[playerid][pName]);
1567 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login System", String, "Login", "Leave");
1568 }
1569 }
1570 }
1571 case DIALOG_REGISTER:
1572 {
1573 if(!response) return Kick(playerid);
1574
1575 if(strlen(inputtext) <= 5 || strlen(inputtext) > 60)
1576 {
1577 // If the password length is less than or equal to 5 and more than 60
1578 // It repeats the process and shows error message as seen below.
1579
1580 SendClientMessage(playerid, 0x969696FF, "Invalid password length, should be 5 - 60.");
1581
1582 new String[150];
1583
1584 format(String, sizeof(String), "{FFFFFF}Welcome %s.\n\n{0099FF}This account is not registered.\n\
1585 {0099FF}Type in your password below to register a new account.\n\n", playerdataInfo[playerid][pName]);
1586 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration System", String, "Register", "Leave");
1587 }
1588 else
1589 {
1590
1591 // Salting the player's password using SHA256 for a better security.
1592
1593 for (new i = 0; i < 10; i++)
1594 {
1595 playerdataInfo[playerid][Salt][i] = random(79) + 47;
1596 }
1597
1598 playerdataInfo[playerid][Salt][10] = 0;
1599 SHA256_PassHash(inputtext, playerdataInfo[playerid][Salt], playerdataInfo[playerid][pPass], 65);
1600
1601 new DB_Query[225];
1602
1603 // Storing player's information if everything goes right.
1604 mysql_format(Database, DB_Query, sizeof(DB_Query), "INSERT INTO `PLAYERS` (`USERNAME`, `PASSWORD`, `SALT`, `BEDS`, `KILLS`, `BOMBS`, `DEATHS`)\
1605 VALUES ('%e', '%s', '%e', '0', '0', '0', '0')", playerdataInfo[playerid][pName], playerdataInfo[playerid][pPass], playerdataInfo[playerid][Salt]);
1606 mysql_tquery(Database, DB_Query, "OnPlayerRegister", "d", playerid);
1607 }
1608 }
1609 }
1610 return 1;
1611}
1612
1613forward public OnPlayerDataCheck(playerid, corrupt_check);
1614public OnPlayerDataCheck(playerid, corrupt_check)
1615{
1616 if (corrupt_check != Corrupt_Check[playerid]) return Kick(playerid);
1617 // You'd have asked already what's corrput_check and how it'd benefit me?
1618 // Well basically MySQL query takes long, incase a player leaves while its not proceeded
1619 // With ID 1 for example, then another player comes as ID 1 it'll basically corrupt the data
1620 // So, once the query is done, the player will have the wrong data assigned for himself.
1621
1622 new String[150];
1623
1624 if(cache_num_rows() > 0)
1625 {
1626 // If the player exists, everything is okay and nothing is wrongly detected
1627 // The player's password and Saltion key gets stored as seen below
1628 // So we won't have to get a headache just to match player's password.
1629
1630 cache_get_value(0, "PASSWORD", playerdataInfo[playerid][pPass], 65);
1631 cache_get_value(0, "SALT", playerdataInfo[playerid][Salt], 11);
1632
1633 playerdataInfo[playerid][Player_Cache] = cache_save();
1634 // ^ Storing the cache ID of the player for further use later.
1635
1636 format(String, sizeof(String), "{FFFFFF}Welcome back, %s.\n\n{0099FF}This account is already registered.\n\
1637 {0099FF}Please, input your password below to proceed to the game.\n\n", playerdataInfo[playerid][pName]);
1638 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login System", String, "Login", "Leave");
1639 }
1640 else
1641 {
1642 format(String, sizeof(String), "{FFFFFF}Welcome %s.\n\n{0099FF}This account is not registered.\n\
1643 {0099FF}Please, input your password below to proceed to the game.\n\n", playerdataInfo[playerid][pName]);
1644 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration System", String, "Register", "Leave");
1645 }
1646 return 1;
1647}
1648
1649forward public OnPlayerRegister(playerid);
1650public OnPlayerRegister(playerid)
1651{
1652 // This gets called only when the player registers a new account.
1653 SendClientMessage(playerid, 0x00FF00FF, "You are now registered and has been logged in.");
1654 playerdataInfo[playerid][LoggedIn] = true;
1655 return 1;
1656}
1657public OnPlayerConnect(playerid)
1658{
1659 WarpVar[playerid]=4;
1660 PreloadAnimLib(playerid,"BOMBER");
1661
1662 SetPlayerMapIcon(playerid, 12,Center[0][0],Center[0][1],Center[0][2], 52, 0, MAPICON_GLOBAL);
1663
1664 new DB_Query[115];
1665
1666 //Resetting player information.
1667 playerdataInfo[playerid][pKills] = 0;
1668 playerdataInfo[playerid][pDeaths] = 0;
1669 playerdataInfo[playerid][pPassFails] = 0;
1670
1671 GetPlayerName(playerid, playerdataInfo[playerid][pName], MAX_PLAYER_NAME); // Getting the player's name.
1672 Corrupt_Check[playerid]++;
1673
1674 mysql_format(Database, DB_Query, sizeof(DB_Query), "SELECT * FROM `PLAYERS` WHERE `USERNAME` = '%e' LIMIT 1", playerdataInfo[playerid][pName]);
1675 mysql_tquery(Database, DB_Query, "OnPlayerDataCheck", "ii", playerid, Corrupt_Check[playerid]);
1676 RemoveBuildingForPlayer(playerid, 694,-2406.2607,-1949.2020,303.7252, 200.0);
1677 RemoveBuildingForPlayer(playerid, 784,-2406.2607,-1949.2020,303.7252, 200.0);
1678 RemoveBuildingForPlayer(playerid, 3636, 1220.2734375,2590.296875,16.4453125, 10000.0);
1679 RemoveBuildingForPlayer(playerid,3683, 2377.390625,1743.234375,16.5390625,10000);
1680 RemoveBuildingForPlayer(playerid, 3673, -2137.1953125,70.28125,42.3125, 10000.0);
1681 RemoveBuildingForPlayer(playerid, 3682,1249.5546875,-905.4609375,45.03125,10000);
1682 RemoveBuildingForPlayer(playerid, 3259,1249.5546875,-905.4609375,45.03125,10000);
1683 RemoveBuildingForPlayer(playerid, 3424, 1568.2890625,-1677.78125,10.8203125, 10000.0);
1684 RemoveBuildingForPlayer(playerid, 3674, 1568.2890625,-1677.78125,10.8203125, 10000.0);
1685 RemoveBuildingForPlayer(playerid, 3675, 1568.2890625,-1677.78125,10.8203125, 10000.0);
1686 RemoveBuildingForPlayer(playerid, 3256, 1568.2890625,-1677.78125,10.8203125, 10000.0);
1687 RemoveBuildingForPlayer(playerid, 3258, 1220.2734375,2590.296875,16.4453125, 10000.0);
1688 RemoveBuildingForPlayer(playerid,3673, 2377.390625,1743.234375,16.5390625,10000);
1689 RemoveBuildingForPlayer(playerid, 3255, -2137.1953125,70.28125,42.3125, 10000.0);
1690 RemoveBuildingForPlayer(playerid, 3257,1249.5546875,-905.4609375,45.03125,10000);
1691
1692 RemoveBuildingForPlayer(playerid, 3290, 1220.2734375,2590.296875,16.4453125, 10000.0);
1693 RemoveBuildingForPlayer(playerid,3289, 2377.390625,1743.234375,16.5390625,10000);
1694 RemoveBuildingForPlayer(playerid, 3682, -2137.1953125,70.28125,42.3125, 10000.0);
1695 RemoveBuildingForPlayer(playerid, 3682,1249.5546875,-905.4609375,45.03125,10000);
1696 RemoveBuildingForPlayer(playerid, 3291,1249.5546875,-905.4609375,45.03125,10000);
1697 RemoveBuildingForPlayer(playerid, 3288, 1568.2890625,-1677.78125,10.8203125, 10000.0);
1698 RemoveBuildingForPlayer(playerid, 3291, 1568.2890625,-1677.78125,10.8203125, 10000.0);
1699 RemoveBuildingForPlayer(playerid, 3683, 1568.2890625,-1677.78125,10.8203125, 10000.0);
1700 RemoveBuildingForPlayer(playerid, 16086, 1568.2890625,-1677.78125,10.8203125, 10000.0);
1701 PStealth[playerid]=0;
1702 LastMoney[playerid]=0;
1703 new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
1704 GetPlayerName(playerid, pname, sizeof(pname));
1705 format(string, sizeof(string), "%s (%d) has joined the server.", pname,playerid);
1706 SendClientMessageToAll(0xAAAAAAAA, string);
1707 PlayerPlaySound(playerid,1185,0,0,0);
1708 GameTextForPlayer(playerid,"~w~Last Bed Standing",3000,4);
1709 SendClientMessage(playerid,COLOR_WHITE,"Welcome to {88AA88}B{FFFFFF}ed {88AA88}W{FFFFFF}ars");
1710 gPlayerTeamSelection[playerid] = -1;
1711 gPlayerHasTeamSelected[playerid] = 0;
1712 gPlayerLastTeamSelectionTick[playerid] = GetTickCount();
1713 return 1;
1714}
1715stock ClassSel_SetupCharSelection(playerid)
1716{
1717 TextDrawHideForPlayer(playerid,Textcover);
1718 if(gPlayerTeamSelection[playerid] > -1)
1719 {
1720 SetPlayerVirtualWorld(playerid,1);
1721 SetPlayerPos(playerid,243.1261,1805.2798,8.3794);
1722 SetPlayerFacingAngle(playerid,180.0);
1723 SetPlayerCameraPos(playerid,243.2876,1802.5547,7.4141);
1724 SetPlayerCameraLookAt(playerid,243.1261,1805.2798,8.3794);
1725
1726 #if defined TEAMSIZE
1727 #if TEAMSIZE >= 2
1728
1729
1730 switch(gPlayerTeamSelection[playerid])
1731 {
1732 case FIRST_TEAM:
1733 {
1734 SetPlayerColor(playerid,COLOR_TEAM_ONE);
1735 }
1736 case SECOND_TEAM:
1737 {
1738 SetPlayerColor(playerid,COLOR_TEAM_TWO);
1739 }
1740
1741
1742 #endif
1743 #endif
1744 #if defined TEAMSIZE
1745 #if TEAMSIZE >= 3
1746 case THIRD_TEAM:
1747 {
1748 SetPlayerColor(playerid,COLOR_TEAM_THREE);
1749 }
1750 #endif
1751 #endif
1752 #if defined TEAMSIZE
1753 #if TEAMSIZE >= 4
1754
1755 case FOURTH_TEAM:
1756 {
1757 SetPlayerColor(playerid,COLOR_TEAM_FOUR);
1758 }
1759
1760
1761 #endif
1762 #endif
1763 #if defined TEAMSIZE
1764 #if TEAMSIZE >= 5
1765
1766
1767
1768 case FIFTH_TEAM:
1769 {
1770 SetPlayerColor(playerid,COLOR_TEAM_FIVE);
1771 }
1772
1773
1774 #endif
1775 #endif
1776 #if defined TEAMSIZE
1777 #if TEAMSIZE >= 6
1778
1779
1780
1781 case SIXTH_TEAM:
1782 {
1783 SetPlayerColor(playerid,COLOR_TEAM_SIX);
1784 }
1785
1786
1787 #endif
1788 #endif
1789 }
1790 }
1791}
1792
1793stock ClassSel_InitTeamNameText(playerid,PlayerText:txtInit)
1794{
1795 PlayerTextDrawBackgroundColor(playerid,txtInit,0x000000ff);
1796 PlayerTextDrawFont(playerid,txtInit,2);
1797 PlayerTextDrawLetterSize(playerid,txtInit,0.399999,1.500000);
1798 PlayerTextDrawColor(playerid,txtInit,0xffffffff);
1799 PlayerTextDrawSetOutline(playerid,txtInit,1);
1800 PlayerTextDrawSetProportional(playerid,txtInit,1);
1801 PlayerTextDrawSetShadow(playerid,txtInit,1);
1802 PlayerTextDrawBackgroundColor(playerid,txtInit,0x000000ff);
1803 PlayerTextDrawFont(playerid,txtInit,2);
1804 PlayerTextDrawLetterSize(playerid,txtInit,0.399999,1.500000);
1805 PlayerTextDrawColor(playerid,txtInit,0xffffffff);
1806 PlayerTextDrawSetOutline(playerid,txtInit,1);
1807 PlayerTextDrawSetProportional(playerid,txtInit,1);
1808 PlayerTextDrawSetShadow(playerid,txtInit,1);
1809}
1810
1811stock ClassSel_SwitchToNextTeam(playerid)
1812{
1813 gPlayerTeamSelection[playerid]++;
1814
1815
1816 switch(TEAMSIZE)
1817 {
1818 case 2:
1819 {
1820 if(gPlayerTeamSelection[playerid] > SECOND_TEAM)
1821 {
1822 gPlayerTeamSelection[playerid] = FIRST_TEAM;
1823 }
1824 }
1825 case 3:
1826 {
1827 if(gPlayerTeamSelection[playerid] > THIRD_TEAM)
1828 {
1829 gPlayerTeamSelection[playerid] = FIRST_TEAM;
1830 }
1831 }
1832 case 4:
1833 {
1834 if(gPlayerTeamSelection[playerid] > FOURTH_TEAM)
1835 {
1836 gPlayerTeamSelection[playerid] = FIRST_TEAM;
1837 }
1838 }
1839 case 5:
1840 {
1841 if(gPlayerTeamSelection[playerid] > FIFTH_TEAM)
1842 {
1843 gPlayerTeamSelection[playerid] = FIRST_TEAM;
1844 }
1845 }
1846 case 6:
1847 {
1848 if(gPlayerTeamSelection[playerid] > SIXTH_TEAM)
1849 {
1850 gPlayerTeamSelection[playerid] = FIRST_TEAM;
1851 }
1852 }
1853 }
1854 PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
1855 gPlayerLastTeamSelectionTick[playerid] = GetTickCount();
1856 ClassSel_SetupSelectedTeam(playerid);
1857}
1858
1859
1860stock ClassSel_SwitchToPreviousTeam(playerid)
1861{
1862 gPlayerTeamSelection[playerid]--;
1863
1864 switch(TEAMSIZE)
1865 {
1866 case 2:
1867 {
1868 if(gPlayerTeamSelection[playerid] < FIRST_TEAM)
1869 {
1870 gPlayerTeamSelection[playerid] = SECOND_TEAM;
1871 }
1872 }
1873 case 3:
1874 {
1875 if(gPlayerTeamSelection[playerid] < FIRST_TEAM)
1876 {
1877 gPlayerTeamSelection[playerid] = THIRD_TEAM;
1878 }
1879 }
1880 case 4:
1881 {
1882 if(gPlayerTeamSelection[playerid] < FIRST_TEAM)
1883 {
1884 gPlayerTeamSelection[playerid] = FOURTH_TEAM;
1885 }
1886 }
1887 case 5:
1888 {
1889 if(gPlayerTeamSelection[playerid] < FIRST_TEAM)
1890 {
1891 gPlayerTeamSelection[playerid] = FIFTH_TEAM;
1892 }
1893 }
1894 case 6:
1895 {
1896 if(gPlayerTeamSelection[playerid] < FIRST_TEAM)
1897 {
1898 gPlayerTeamSelection[playerid] = SIXTH_TEAM;
1899 }
1900 }
1901 }
1902 PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
1903 gPlayerLastTeamSelectionTick[playerid] = GetTickCount();
1904 ClassSel_SetupSelectedTeam(playerid);
1905}
1906
1907stock getActingPlayer(playerid,&idx)
1908{
1909 new randoms[MAX_PLAYERS],tmp;
1910 for(new i=GetPlayerPoolSize(); i!=-1; i--)
1911 {
1912 if(IsPlayerConnected(i) && gPlayerTeamSelection[i] != TEAM_SPECTATOR && playerid != i)
1913 {
1914 randoms[tmp++]=i;
1915 }
1916 }
1917 if(!tmp) return INVALID_PLAYER_ID;
1918 if(idx>tmp) idx=0;
1919 if(idx<0) idx=tmp-1;
1920 return randoms[idx];
1921}
1922stock HandlePlayerSpectating(playerid)
1923{
1924 if( (GetTickCount() - gPlayerLastTeamSelectionTick[playerid]) < delay ) return 1;
1925 new Keys,ud,lr;
1926 GetPlayerKeys(playerid,Keys,ud,lr);
1927 if(lr == KEY_RIGHT)
1928 {
1929 SpectatingPlayer[playerid]++;
1930 ud = getActingPlayer(playerid,SpectatingPlayer[playerid]);
1931 if(ud == INVALID_PLAYER_ID)
1932 {
1933 SpectatingPlayer[playerid]--;
1934 return 1;
1935 }
1936 SpecPlayer(playerid,ud);
1937 }
1938 else if(lr == KEY_LEFT)
1939 {
1940 SpectatingPlayer[playerid]--;
1941 ud = getActingPlayer(playerid,SpectatingPlayer[playerid]);
1942 if(ud == INVALID_PLAYER_ID)
1943 {
1944 SpectatingPlayer[playerid]++;
1945 return 1;
1946 }
1947 SpecPlayer(playerid,ud);
1948 }
1949 return 1;
1950}
1951stock ClassSel_HandleTeamSelection(playerid)
1952{
1953
1954 new Keys,ud,lr;
1955 GetPlayerKeys(playerid,Keys,ud,lr);
1956
1957 if(gPlayerTeamSelection[playerid] == -1) {
1958 ClassSel_SwitchToNextTeam(playerid);
1959 return;
1960 }
1961
1962
1963 if( (GetTickCount() - gPlayerLastTeamSelectionTick[playerid]) < delay ) return;
1964
1965 if(Keys & KEY_FIRE) {
1966 gPlayerHasTeamSelected[playerid] = 1;
1967
1968 PlayerTextDrawHide(playerid,TeamText[playerid]);
1969 PlayerTextDrawHide(playerid,LocText[playerid]);
1970 PlayerTextDrawHide(playerid,TeamCover[playerid]);
1971 TextDrawHideForPlayer(playerid,txtClassSelHelper);//Observer textdraw
1972 TogglePlayerSpectating(playerid,0);
1973 return;
1974 }
1975 printf("ClassSel_HandleTeamSelection");
1976 if(lr > 0) {
1977 ClassSel_SwitchToNextTeam(playerid);
1978 }
1979 else if(lr < 0) {
1980 ClassSel_SwitchToPreviousTeam(playerid);
1981 }
1982
1983}
1984
1985
1986public OnPlayerRequestClass(playerid, classid)
1987{
1988 if(IsPlayerNPC(playerid)) return 1;
1989 printf("OnPlayerRequestClass");
1990 if(gPlayerHasTeamSelected[playerid]) {
1991 ClassSel_SetupCharSelection(playerid);
1992 return 1;
1993 }
1994 else
1995 {
1996 if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) {
1997 TogglePlayerSpectating(playerid,1);
1998 TextDrawShowForPlayer(playerid, txtClassSelHelper);
1999 gPlayerTeamSelection[playerid] = -1;
2000 }
2001 }
2002
2003 return 0;
2004}
2005
2006//----------------------------------------------------------
2007public OnPlayerSelectedMenuRow(playerid, row)
2008{
2009 new Menu:CurrentMenu = GetPlayerMenu(playerid);
2010 new Menu:Current= GetPlayerMenu(playerid);
2011 TogglePlayerControllable(playerid,false);
2012 if(Current==infomenu)
2013 {
2014 TogglePlayerControllable(playerid,false);
2015 switch(row)
2016 {
2017 case 0:
2018 {
2019 TogglePlayerControllable(playerid,true);
2020 SendClientMessage(playerid,COLOR_WHITE,"SERVER: How to play");
2021 SendClientMessage(playerid,COLOR_WHITE,"The goal of this mode, is to destroy the enemie's bed and wipe out all the remaining players to determine the winner team.");
2022 SendClientMessage(playerid,COLOR_WHITE,"You can use the /blowup command to destroy and enemies bed!");
2023 }
2024 case 1:
2025 {
2026 TogglePlayerControllable(playerid,true);
2027 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Q: How to destroy a bed?");
2028 SendClientMessage(playerid,COLOR_WHITE,"SERVER: A: Get close to the enemie's bed and use /blowup to destroy it!");
2029 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Q: What can i do if i am unable to respawn due to a destroyed bed?");
2030 SendClientMessage(playerid,COLOR_WHITE,"SERVER: A: You can use the command /spec [playerid] to spectate other players!");
2031 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Q: When does the game ends?");
2032 SendClientMessage(playerid,COLOR_WHITE,"SERVER: A: After a winning team is determined, means if only one team remains.");
2033 }
2034 case 2:
2035 {
2036 TogglePlayerControllable(playerid,true);
2037 SendClientMessage(playerid,COLOR_WHITE,"SERVER: If you commit one of these things it will get you banned!");
2038 SendClientMessage(playerid,COLOR_WHITE,"SERVER: NO Cheating");
2039 SendClientMessage(playerid,COLOR_WHITE,"SERVER: NO Spamming");
2040 SendClientMessage(playerid,COLOR_WHITE,"SERVER: NO Quitting to avoid anything! Better die in honor for a honorable cause!");
2041 SendClientMessage(playerid,COLOR_WHITE,"SERVER: NEVER kill your own team mates, it will get you banned!");
2042 SendClientMessage(playerid,COLOR_WHITE,"SERVER: NEVER exploit bugs in any way! Report them instead!");
2043 }
2044 }
2045 }
2046 if(Current==ammunation) {
2047 TogglePlayerControllable(playerid,false);
2048 switch(row) {
2049 case 0: {
2050 ShowMenuForPlayer(pistols,playerid);
2051 }
2052 case 1: {
2053 ShowMenuForPlayer(microsmg,playerid);
2054 }
2055 case 2: {
2056 ShowMenuForPlayer(shotguns,playerid);
2057 }
2058 case 3: {
2059 ShowMenuForPlayer(items,playerid);
2060 }
2061 case 4: {
2062 ShowMenuForPlayer(smg,playerid);
2063 }
2064 case 5: {
2065 ShowMenuForPlayer(rifles,playerid);
2066 }
2067 case 6: {
2068 ShowMenuForPlayer(assaultrifle,playerid);
2069 }
2070 case 7: {
2071 ShowMenuForPlayer(Grenades,playerid);
2072 }
2073 case 8: {
2074 ShowMenuForPlayer(melee,playerid);
2075 }
2076 case 9: {
2077 ShowMenuForPlayer(special,playerid);
2078 }
2079 case 10: {
2080 HideMenuForPlayer(ammunation,playerid);
2081 ShowMenuForPlayer(shopmenu,playerid);
2082
2083 }
2084 default: {
2085 print("Fail");
2086 }
2087 }
2088 }
2089 else if(Current==pistols) {
2090 ShowMenuForPlayer(pistols,playerid);
2091 switch(row) {
2092 case 0:
2093 {
2094 SellPlayerWeapon(playerid,1500,22,50);
2095 }
2096 case 1:
2097 {
2098 SellPlayerWeapon(playerid,2500,23,50);
2099
2100
2101 }
2102 case 2:
2103
2104 {
2105 SellPlayerWeapon(playerid,2500,24,50);
2106 }
2107 case 3: {
2108
2109 HideMenuForPlayer(pistols,playerid);
2110 ShowMenuForPlayer(ammunation,playerid);
2111 }
2112 default: {
2113 print("Fail");
2114 }
2115 }
2116 }
2117 else if(Current==microsmg) {
2118 ShowMenuForPlayer(microsmg,playerid);
2119 switch(row) {
2120 case 0:
2121
2122
2123 {
2124 SellPlayerWeapon(playerid,5500,32,50);
2125
2126 }
2127
2128 case 1:
2129
2130 {
2131 SellPlayerWeapon(playerid,5000,28,50);
2132
2133 }
2134 case 2: {
2135 HideMenuForPlayer(microsmg,playerid);
2136 ShowMenuForPlayer(ammunation,playerid);
2137 }
2138 default: {
2139 print("Fail");
2140 }
2141 }
2142 }
2143 else if(Current==shotguns) {
2144 ShowMenuForPlayer(shotguns,playerid);
2145 switch(row) {
2146 case 0: {
2147 SellPlayerWeapon(playerid,12500,25,50);
2148
2149 }
2150 case 1: {
2151 SellPlayerWeapon(playerid,15500,26,50);
2152
2153 }
2154 case 2: {
2155 SellPlayerWeapon(playerid,55500,27,50);
2156 }
2157 case 3: {
2158 HideMenuForPlayer(shotguns,playerid);
2159 ShowMenuForPlayer(ammunation,playerid);
2160 }
2161 default: {
2162 print("Fail");
2163 }
2164 }
2165 }
2166 else if(Current==items) {
2167 ShowMenuForPlayer(items,playerid);
2168 switch(row) {
2169 case 0:
2170 if(GetPlayerMoney(playerid) >= 2500)
2171 {
2172 GivePlayerMoneyText(playerid,-2500);
2173 SetPlayerArmour(playerid,100.0);
2174 }
2175 else
2176 {
2177 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Insufficient balance! You can not afford this item!");
2178 }
2179 case 1: {
2180 SellPlayerWeapon(playerid,2500,46,1);
2181 }
2182 case 2: {
2183 SellPlayerWeapon(playerid,2500,41,100);
2184 }
2185 case 3: {
2186 SellPlayerWeapon(playerid,2500,43,50);
2187
2188 }
2189
2190 case 4: if(GetPlayerMoney(playerid) >= 2500)
2191 {
2192 GivePlayerMoneyText(playerid,-2500);
2193 SetPlayerHealth(playerid,100.0);
2194 }
2195 else
2196 {
2197 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Insufficient balance! You can not afford this item!");
2198 }
2199 case 5:
2200 {
2201 HideMenuForPlayer(items,playerid);
2202 ShowMenuForPlayer(fightstyles,playerid);
2203 }
2204 case 6: {
2205 HideMenuForPlayer(items,playerid);
2206 ShowMenuForPlayer(ammunation,playerid);
2207 }
2208 default: {
2209 print("Fail");
2210 }
2211 }
2212 }
2213
2214 else if(Current==fightstyles) {
2215 ShowMenuForPlayer(fightstyles,playerid);
2216 switch(row) {
2217 case 0:
2218
2219 {
2220 SellPlayerFightingStyle (playerid,2500, FIGHT_STYLE_KUNGFU);
2221 }
2222 case 1: {
2223 SellPlayerFightingStyle (playerid,2500, FIGHT_STYLE_KNEEHEAD);
2224
2225 }
2226 case 2:
2227 {
2228 SellPlayerFightingStyle (playerid,2500, FIGHT_STYLE_BOXING);
2229 }
2230 case 3:
2231 {
2232 SellPlayerFightingStyle (playerid,2500, FIGHT_STYLE_GRABKICK);
2233 }
2234 case 4:
2235 {
2236 SellPlayerFightingStyle (playerid,2500, FIGHT_STYLE_ELBOW);
2237 }
2238 case 5:
2239 {
2240 SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
2241 }
2242 case 6:
2243 {
2244 HideMenuForPlayer(fightstyles,playerid);
2245 ShowMenuForPlayer(items,playerid);
2246 }
2247 default: {
2248 print("Fail");
2249 }
2250 }
2251 }
2252 else if(Current==smg) {
2253 ShowMenuForPlayer(smg,playerid);
2254 switch(row) {
2255 case 0:
2256
2257 {
2258 SellPlayerWeapon(playerid,20000,29,50);
2259
2260
2261
2262 }
2263 case 1: {
2264 HideMenuForPlayer(smg,playerid);
2265 ShowMenuForPlayer(ammunation,playerid);
2266
2267 }
2268 default: {
2269 print("Fail");
2270 }
2271 }
2272 }
2273
2274 else if(Current==assaultrifle) {
2275 ShowMenuForPlayer(assaultrifle,playerid);
2276 switch(row) {
2277 case 0:
2278 {
2279 SellPlayerWeapon(playerid,40000,30,500);
2280 }
2281
2282 case 1: {
2283 SellPlayerWeapon(playerid,45000,31,500);
2284
2285 }
2286 case 2: {
2287 HideMenuForPlayer(assaultrifle,playerid);
2288 ShowMenuForPlayer(ammunation,playerid);
2289 }
2290 default: {
2291 print("Fail");
2292 }
2293 }
2294 }
2295 else if(Current==rifles) {
2296 ShowMenuForPlayer(rifles,playerid);
2297 switch(row) {
2298 case 0: {
2299 SellPlayerWeapon(playerid,12500,33,50);
2300
2301
2302 }
2303 case 1: {
2304 SellPlayerWeapon(playerid,40000,34,50);
2305 }
2306 case 2: {
2307 HideMenuForPlayer(rifles,playerid);
2308 ShowMenuForPlayer(ammunation,playerid);
2309
2310 }
2311 default: {
2312 print("Fail");
2313 }
2314 }
2315 }
2316 else if(Current==Grenades) {
2317 ShowMenuForPlayer(Grenades,playerid);
2318 switch(row) {
2319 case 0: {
2320 SellPlayerWeapon(playerid,125000,16,50);
2321 }
2322 case 1: {
2323 SellPlayerWeapon(playerid,25000,17,50);
2324 }
2325 case 2: {
2326 SellPlayerWeapon(playerid,25000,18,50);
2327 }
2328 case 3: {
2329 HideMenuForPlayer(Grenades,playerid);
2330 ShowMenuForPlayer(ammunation,playerid);
2331 }
2332 default: {
2333 print("Fail");
2334 }
2335 }
2336 }
2337 else if(Current==yesno) {
2338 ShowMenuForPlayer(yesno,playerid);
2339 switch(row) {
2340 case 0: {
2341 SetPlayerHealth(playerid,0.0);
2342 SendDeathMessage(playerid, playerid, 22);
2343 }
2344 case 1: {
2345 HideMenuForPlayer(yesno,playerid);
2346 TogglePlayerControllable(playerid,true);
2347 }
2348 case 2: {
2349 HideMenuForPlayer(yesno,playerid);
2350 ShowMenuForPlayer(shopmenu,playerid);
2351 }
2352 default: {
2353 print("Fail");
2354 }
2355 }
2356 }
2357 else if(Current==melee) {
2358 ShowMenuForPlayer(melee,playerid);
2359 switch(row) {
2360 case 0: {
2361 GivePlayerWeapon(playerid,5,1);
2362 }
2363 case 1: {
2364 GivePlayerWeapon(playerid,11,1);
2365 }
2366 case 2: {
2367 SellPlayerWeapon(playerid,100000,9,1);
2368 }
2369 case 3: {
2370 GivePlayerWeapon(playerid,8,1);
2371 }
2372 case 4: {
2373 GivePlayerWeapon(playerid,7,1);
2374 }
2375 case 5: {
2376 GivePlayerWeapon(playerid,4,1);
2377 }
2378 case 6: {
2379 GivePlayerWeapon(playerid,3,1);
2380 }
2381 case 7: {
2382 GivePlayerWeapon(playerid,2,1);
2383 }
2384 case 8: {
2385 HideMenuForPlayer(melee,playerid);
2386 ShowMenuForPlayer(ammunation,playerid);
2387 }
2388 default: {
2389 print("Fail");
2390 }
2391 }
2392 }
2393 else if(Current==special) {
2394 ShowMenuForPlayer(special,playerid);
2395 switch(row) {
2396 case 0: {
2397 SellPlayerWeapon(playerid,2000000,38,1000);
2398 }
2399 case 1: {
2400 SellPlayerWeapon(playerid,250000,35,5);
2401 }
2402 case 2: {
2403 SellPlayerWeapon(playerid,250000,37,300);
2404
2405 }
2406 case 3: {
2407 HideMenuForPlayer(special,playerid);
2408 ShowMenuForPlayer(ammunation,playerid);
2409 }
2410 default: {
2411 print("Fail");
2412 }
2413 }
2414 }
2415 if(CurrentMenu == shopmenu)
2416 {
2417
2418 switch(row)
2419 {
2420 case 0:
2421 {
2422 TogglePlayerControllable(playerid,false);
2423 HideMenuForPlayer(shopmenu,playerid);
2424 ShowMenuForPlayer(ammunation,playerid);
2425
2426 }
2427 case 1:
2428 {
2429 if(GetPlayerMoney(playerid) > 10000 && PSkill[playerid] == 0)
2430 {
2431 PSkill[playerid]=1;
2432 GivePlayerMoneyText(playerid,-10000);
2433 SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Skill upgraded");
2434 SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,1000);
2435 SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,1000);
2436 SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,1000);
2437 SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,1000);
2438 SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,1000);
2439 SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,1000);
2440 SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,1000);
2441 SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,1000);
2442 SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,1000);
2443 SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,1000);
2444 SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,1000);
2445 ShowMenuForPlayer(shopmenu,playerid);
2446 }
2447 else if(GetPlayerMoney(playerid) < 10000)
2448 {
2449 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Insufficient balance! You can not afford this item!");
2450 ShowMenuForPlayer(shopmenu,playerid);
2451 TogglePlayerControllable(playerid,false);
2452 }
2453 else if(PSkill[playerid] != 0)
2454 {
2455 SendClientMessage(playerid,COLOR_WHITE,"SERVER: You already bought this item!");
2456 TogglePlayerControllable(playerid,true);
2457 }
2458
2459 }
2460 case 2:
2461 {
2462 if(GetPlayerMoney(playerid) >= 85000)
2463 {
2464 PStealth[playerid]=1;
2465 SendClientMessage(playerid,COLOR_WHITE,"SERVER: You are equipped with a stealth kit. You can use /stealth to hide yourself");
2466 GivePlayerMoneyText(playerid,-85000);
2467 TogglePlayerControllable(playerid,1);
2468 }
2469 else
2470 {
2471 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Insufficient balance! You can not afford this item!");
2472 TogglePlayerControllable(playerid,1);
2473 }
2474
2475 }
2476 case 3: if(GetPlayerMoney(playerid) >= 100000 && PBomb[playerid] == 0)
2477 {
2478 PBomb[playerid]=1;
2479 SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You have bought a bomb! Now you can place bombs by using /dropbomb!");
2480 ShowMenuForPlayer(shopmenu,playerid);
2481 TogglePlayerControllable(playerid,false);
2482 GivePlayerMoneyText(playerid,-100000);
2483 }
2484 else if(PBomb[playerid] != 0)
2485 {
2486 SendClientMessage(playerid,COLOR_WHITE,"SERVER: You already bought this item!");
2487 TogglePlayerControllable(playerid,1);
2488 }
2489 else if(GetPlayerMoney(playerid) < 100000)
2490 {
2491 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Insufficient balance! You can not afford this item!");
2492 ShowMenuForPlayer(shopmenu,playerid);
2493 TogglePlayerControllable(playerid,false);
2494 }
2495 case 4: if(GetPlayerMoney(playerid) >= 50000 && Warppowder[playerid] == 0)
2496
2497 {
2498 Warppowder[playerid]=1;
2499 SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You have bought a Warpkit! You can teleport yourself back to your base by using /warp");
2500 ShowMenuForPlayer(shopmenu,playerid);
2501 TogglePlayerControllable(playerid,false);
2502 GivePlayerMoneyText(playerid,-50000);
2503 }
2504 else if(Warppowder[playerid] != 0)
2505 {
2506 SendClientMessage(playerid,COLOR_WHITE,"SERVER: You already bought this item!");
2507 TogglePlayerControllable(playerid,1);
2508 }
2509 else if(GetPlayerMoney(playerid) < 50000)
2510 {
2511 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Insufficient balance! You can not afford this item!");
2512 ShowMenuForPlayer(shopmenu,playerid);
2513 TogglePlayerControllable(playerid,false);
2514 }
2515 case 5: if(GetPlayerMoney(playerid) >= 5000 && Helmet[playerid] == 0)
2516
2517 {
2518 Helmet[playerid]=1;
2519 SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You have bought a Helmet! You are now protected against headshots!");
2520 ShowMenuForPlayer(shopmenu,playerid);
2521 TogglePlayerControllable(playerid,false);
2522 GivePlayerMoneyText(playerid,-5000);
2523 }
2524 else if(Helmet[playerid] != 0)
2525 {
2526 SendClientMessage(playerid,COLOR_WHITE,"SERVER: You already bought this item!");
2527 TogglePlayerControllable(playerid,1);
2528 }
2529 else if(GetPlayerMoney(playerid) < 5000)
2530 {
2531 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Insufficient balance! You can not afford this item!");
2532 ShowMenuForPlayer(shopmenu,playerid);
2533 TogglePlayerControllable(playerid,false);
2534 }
2535 case 6:
2536 {
2537 HideMenuForPlayer(shopmenu,playerid);
2538 ShowMenuForPlayer(yesno,playerid);
2539 }
2540
2541 }
2542 }
2543}
2544
2545stock GetTeamPlayerCount(teamid)
2546{
2547 new playercount = 0;
2548 for(new i = 0; i < MAX_PLAYERS; i++)
2549 {
2550 if(GetPlayerState(i) == PLAYER_STATE_NONE) continue;
2551 if(gPlayerTeamSelection[i] != teamid) continue;
2552 playercount++;
2553 }
2554 return playercount;
2555}
2556stock GetActiveTeamCount()
2557{
2558 new i=0,count=0;
2559 while(i<TEAMSIZE)
2560 {
2561 if(GetTeamPlayerCount(i) > 0)
2562 {
2563 count++;
2564 }
2565 i++;
2566 }
2567 return count;
2568
2569}
2570
2571
2572public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
2573{
2574 if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9 && Helmet[playerid] != 1)
2575 {
2576 // One shot to the head to kill with sniper rifle
2577 SetPlayerHealth(playerid, 0.0);
2578 }
2579 return 1;
2580}
2581
2582
2583stock TeamsAlive(bool:value)
2584{
2585 new i=0,count=0;
2586 while(i<TEAMSIZE)
2587 {
2588 if(GetTeamPlayerCount(i) > 0)
2589 {
2590 count++;
2591 }
2592 i++;
2593 }
2594 if(bool:value == false)
2595 switch(count)
2596 {
2597 case 1:
2598 {
2599 switch(TeamsAlive(true))
2600 {
2601 case FIRST_TEAM:
2602 {
2603 for(new d;d<MAX_PLAYERS;d++)
2604 {
2605 SendClientMessageEx(d,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",FIRST_TEAM_COLOR_TAG);
2606 }
2607 }
2608 case SECOND_TEAM:
2609 {
2610 for(new d;d<MAX_PLAYERS;d++)
2611 {
2612 SendClientMessageEx(d,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",SECOND_TEAM_COLOR_TAG);
2613 }
2614 }
2615 #if defined TEAMSIZE
2616 #if TEAMSIZE >= 3
2617 case THIRD_TEAM:
2618 {
2619 for(new d;d<MAX_PLAYERS;d++)
2620 {
2621 SendClientMessageEx(d,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",THIRD_TEAM_COLOR_TAG);
2622 }
2623 }
2624 #endif
2625 #endif
2626 #if defined TEAMSIZE
2627 #if TEAMSIZE >= 4
2628 case FOURTH_TEAM:
2629 {
2630 for(new d;d<MAX_PLAYERS;d++)
2631 {
2632 SendClientMessageEx(d,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",FOURTH_TEAM_COLOR_TAG);
2633 }
2634 }
2635 #endif
2636 #endif
2637 #if defined TEAMSIZE
2638 #if TEAMSIZE >= 5
2639 case FIFTH_TEAM:
2640 {
2641 for(new d;d<MAX_PLAYERS;d++)
2642 {
2643 SendClientMessageEx(d,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",FIFTH_TEAM_COLOR_TAG);
2644 }
2645 }
2646 #endif
2647 #endif
2648 #if defined TEAMSIZE
2649 #if TEAMSIZE == 6
2650 case SIXTH_TEAM:
2651 {
2652 for(new d;d<MAX_PLAYERS;d++)
2653 {
2654 SendClientMessageEx(d,COLOR_WHITE,"SERVER: All remaining teams have been wiped. Team %s {FFFFFF}has won the game!",SIXTH_TEAM_COLOR_TAG);
2655 }
2656 }
2657 #endif
2658 #endif
2659
2660
2661 }
2662 for(new o;o<MAX_PLAYERS;o++)
2663 {
2664 ResetPlayerData(o);
2665 }
2666 //FinishedGame();
2667 }
2668 }
2669 if(bool:value == true && count == 1)//Returns the ID of the remaining team
2670 return i;
2671 return 1;
2672
2673}
2674public GMX()
2675{
2676 SendClientMessageToAll(COLOR_WHITE,"SERVER: Game over! Map is changing. Please standby..");
2677 printf("Total game time: %d",totaltime);
2678 SendRconCommand("gmx");
2679}
2680public OnPlayerDisconnect(playerid, reason)
2681{
2682 Corrupt_Check[playerid]++;
2683
2684 new DB_Query[256];
2685 //Running a query to save the player's data using the stored stuff.
2686 mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `BEDS` = %d, `BOMBS` = %d, `KILLS` = %d, `DEATHS` = %d WHERE `ID` = %d LIMIT 1",
2687 playerdataInfo[playerid][pBeds], playerdataInfo[playerid][pBombs], playerdataInfo[playerid][pKills], playerdataInfo[playerid][pDeaths], playerdataInfo[playerid][ID]);
2688
2689 mysql_tquery(Database, DB_Query);
2690
2691 if(cache_is_valid(playerdataInfo[playerid][Player_Cache])) //Checking if the player's cache ID is valid.
2692 {
2693 cache_delete(playerdataInfo[playerid][Player_Cache]); // Deleting the cache.
2694 playerdataInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE; // Setting the stored player Cache as invalid.
2695 }
2696
2697 playerdataInfo[playerid][LoggedIn] = false;
2698 print("OnPlayerDisconnect has been called."); // Sending message once OnPlayerDisconnect is called.
2699 //SaveUser_data(playerid);
2700 LastMoney[playerid]=0;
2701 new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
2702 GetPlayerName(playerid, pname, sizeof(pname));
2703 ResetPlayerData(playerid);
2704 if(IsBeingSpeced[playerid] == 1)
2705 {
2706 for(new i;i<MAX_PLAYERS;i++)
2707 {
2708 if(spectatorid[i] == playerid)
2709 {
2710 SpecRandomPlayer(i);
2711 }
2712 }
2713 }
2714 TextDrawHideForPlayer(playerid,txtSpectatorHelper);
2715 switch(reason)
2716 {
2717 case 0: format(string, sizeof(string), "%s (%d) has left the server. (Lost Connection)", pname,playerid);
2718 case 1: format(string, sizeof(string), "%s (%d) has left the server. (Leaving)", pname,playerid);
2719 case 2: format(string, sizeof(string), "%s (%d) has left the server. (Kicked)", pname,playerid);
2720 }
2721 SendClientMessageToAll(0xAAAAAAAA, string);
2722 return 1;
2723}
2724
2725stock GetPlayerTeamColorTag(playerid)
2726{
2727 new gTeam[144];
2728 switch(gPlayerTeamSelection[playerid])
2729 {
2730 case FIRST_TEAM: strcpy(gTeam,FIRST_TEAM_COLOR_TAG);
2731 case SECOND_TEAM: strcpy(gTeam,SECOND_TEAM_COLOR_TAG);
2732 #if defined TEAMSIZE
2733 #if TEAMSIZE >= 3
2734 case THIRD_TEAM: strcpy(gTeam,THIRD_TEAM_COLOR_TAG);
2735 #endif
2736 #endif
2737 #if defined TEAMSIZE
2738 #if TEAMSIZE >= 4
2739 case FOURTH_TEAM: strcpy(gTeam,FOURTH_TEAM_COLOR_TAG);
2740 #endif
2741 #endif
2742 #if defined TEAMSIZE
2743 #if TEAMSIZE >= 5
2744 case FIFTH_TEAM: strcpy(gTeam,FIFTH_TEAM_COLOR_TAG);
2745 #endif
2746 #endif
2747 #if defined TEAMSIZE
2748 #if TEAMSIZE == 6
2749 case SIXTH_TEAM: strcpy(gTeam,SIXTH_TEAM_COLOR_TAG);
2750 #endif
2751 #endif
2752 case TEAM_SPECTATOR: strcpy(gTeam,SPECTATOR_TEAM_COLOR_TAG);
2753 }
2754 return gTeam;
2755}
2756public OnPlayerUpdate(playerid)
2757{
2758
2759 if(IsPlayerNPC(playerid)) return 1;
2760
2761 if(IsSpecing[playerid] == 1)
2762 {
2763 HandlePlayerSpectating(playerid);
2764 return 1;
2765 }
2766 // changing teams by inputs
2767 if( !gPlayerHasTeamSelected[playerid] && GetPlayerState(playerid) == PLAYER_STATE_SPECTATING )
2768 {
2769 ClassSel_HandleTeamSelection(playerid);
2770 return 1;
2771 }
2772 return 1;
2773
2774}
2775
2776public OnPlayerClickPlayer(playerid, clickedplayerid, source)
2777{
2778 new deaths = PlayerInfo[clickedplayerid][pDeaths];
2779 new kills = PlayerInfo[clickedplayerid][pKills];
2780 if(deaths == 0)
2781 {
2782 deaths = 1;
2783 }
2784 deaths = PlayerInfo[clickedplayerid][pDeaths];
2785 kills = PlayerInfo[clickedplayerid][pKills];
2786 new Float:kd = floatdiv(kills,deaths);
2787 new name[MAX_PLAYER_NAME];
2788 GetPlayerName(clickedplayerid, name, sizeof(name));
2789 SendClientMessageEx(playerid, COLOR_WHITE,"SERVER: Player Stats of %s(%d) Team: %s ",name,clickedplayerid,GetPlayerTeamColorTag(clickedplayerid));
2790 SendClientMessageEx(playerid, COLOR_WHITE,"Kills:%d Deaths:%d Ratio:%0.2f Blown beds:%d Bombs detonated:%d",kills,deaths,kd,PlayerInfo[clickedplayerid][pBeds],PlayerInfo[clickedplayerid][pBombs]);
2791 return 1;
2792}
2793public OnPlayerCommandText(playerid, cmdtext[])
2794{
2795 new cmd[32], idx;
2796 sscanf(cmdtext,"s[32]d",cmd,idx);
2797 if(strcmp(cmd, "/weather", true) == 0)
2798 {
2799 if(!IsPlayerAdmin(playerid))
2800 return 0;
2801 new targetweatherid;
2802 if(sscanf(cmdtext[strlen("/weather")+1], "i", targetweatherid))
2803 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /weather [weatherid]");
2804 new wres = binarysearch2(gRandomWeatherIDs,0,targetweatherid,0,sizeof(gRandomWeatherIDs)-1);
2805 if(wres == -1)
2806 return SendClientMessage(playerid,COLOR_WHITE,"SERVER: Invalid weather ID, check weather array for valid IDs");
2807 new strout[64];
2808 format(strout, sizeof(strout), "Weather changed to %s", gRandomWeatherIDs[targetweatherid][wt_text]);
2809 SetWeather(gRandomWeatherIDs[targetweatherid][wt_id]);
2810 SendClientMessageToAll(COLOR_WHITE,strout);
2811 print(strout);
2812 }
2813 if(strcmp(cmd, "/search", true) == 0)
2814 {
2815 new targetid;
2816 if(sscanf(cmdtext[strlen("/search")+1], "i", targetid))
2817 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /search [key]");
2818 new mres = binarysearch(MoneyPickups,targetid,0,sizeof(MoneyPickups)-1);
2819 new astring[54];
2820 format(astring,sizeof(astring),"Index of key: %d",mres);
2821 new ares = binarysearch(ActorPickups,targetid,0,sizeof(ActorPickups)-1);
2822 SendClientMessage(playerid,COLOR_WHITE,astring);
2823 format(astring,sizeof(astring),"Index of key: %d",ares);
2824 SendClientMessage(playerid,COLOR_WHITE,astring);
2825
2826 }
2827 if(strcmp(cmd, "/compare", true) == 0)
2828 {
2829 HeapSort(MoneyPickups);
2830 HeapSort(ActorPickups);
2831 for(new i;i<sizeof(ActorPickups);i++)
2832 {
2833 new mres = binarysearch(MoneyPickups,ActorPickups[i],0,sizeof(MoneyPickups)-1);
2834 if(mres > -1)
2835 {
2836 SendClientMessage(playerid,COLOR_WHITE,"Match found! MoneyPickups contains values of ActorPickups");
2837 new tstring[144];
2838 format(tstring,sizeof(tstring),"MoneyPickups Val: %d Index: %d matchs ActorPickups Val: %d Index :%d",MoneyPickups[mres],mres,ActorPickups[i],i);
2839 SendClientMessage(playerid,-1,tstring);
2840 break;
2841
2842 }
2843 }
2844
2845 }
2846 if(strcmp(cmd, "/getplayerteam", true) == 0)
2847 {
2848 new targetplayer;
2849 if(sscanf(cmdtext[strlen("/getplayerteam")+1], "i", targetplayer))
2850 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /getplayerteam [playerid]");
2851 if(!IsPlayerConnected(targetplayer))
2852 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
2853 SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Player %d is part of Team: %s",targetplayer,GetPlayerTeamColorTag(targetplayer));
2854 }
2855 if(strcmp(cmd, "/stealth", true) == 0)
2856 {
2857 if(PStealth[playerid] == 1)
2858 {
2859 PStealth[playerid]=-1;
2860 SendClientMessage(playerid,COLOR_WHITE,"SERVER: You are now invisible for 60 seconds!");
2861 SetTimerEx("reveal", 60000, false,"i",playerid);
2862 }
2863 else
2864 {
2865 return SendClientMessage(playerid,COLOR_WHITE,"SERVER: You do not have a stealth package!");
2866 }
2867 #if defined TEAMSIZE
2868 #if TEAMSIZE >= 2
2869
2870 {
2871 switch(gPlayerTeamSelection[playerid])
2872 {
2873 case 0:
2874 {
2875 SetPlayerColor(playerid,COLOR_TEAM_ONE_STEALTH);
2876 }
2877 case 1:
2878 {
2879 SetPlayerColor(playerid,COLOR_TEAM_TWO_STEALTH);
2880 }
2881 }
2882 }
2883 #endif
2884 #endif
2885 #if defined TEAMSIZE
2886 #if TEAMSIZE >= 3
2887
2888 {
2889 switch(gPlayerTeamSelection[playerid])
2890 {
2891 case 2:
2892 {
2893 SetPlayerColor(playerid,COLOR_TEAM_THREE_STEALTH);
2894 }
2895 }
2896 }
2897 #endif
2898 #endif
2899 #if defined TEAMSIZE
2900 #if TEAMSIZE >= 4
2901
2902 {
2903 switch(gPlayerTeamSelection[playerid])
2904 {
2905 case 3:
2906 {
2907 SetPlayerColor(playerid,COLOR_TEAM_FOUR_STEALTH);
2908 }
2909 }
2910 }
2911 #endif
2912 #endif
2913 #if defined TEAMSIZE
2914 #if TEAMSIZE >= 5
2915
2916 {
2917 switch(gPlayerTeamSelection[playerid])
2918 {
2919 case 4:
2920 {
2921 SetPlayerColor(playerid,COLOR_TEAM_FIVE_STEALTH);
2922 }
2923 }
2924 }
2925 #endif
2926 #endif
2927 #if defined TEAMSIZE
2928 #if TEAMSIZE >= 6
2929
2930 {
2931 switch(gPlayerTeamSelection[playerid])
2932 {
2933 case 5:
2934 {
2935 SetPlayerColor(playerid,COLOR_TEAM_SIX_STEALTH);
2936 }
2937 }
2938 }
2939 #endif
2940 #endif
2941
2942 return 1;
2943 }
2944 if(strcmp(cmd, "/warp", true) == 0) //Warppowder
2945 {
2946 if(Warppowder[playerid] == 1 && !IsPlayerInAnyVehicle(playerid))
2947 {
2948 Warppowder[playerid]=0;
2949 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Warning! Don't move until teleport!");
2950 WarpTimer = SetTimerEx("warpcount", 1000, true,"i",playerid);
2951 new Float:x,Float:y,Float:z;
2952 GetPlayerPos(playerid,x,y,z);
2953 wX[playerid]=x;
2954 wY[playerid]=y;
2955 wZ[playerid]=z;
2956 Beam[playerid] = CreateObject(18671,x,y,z-1,0,0,0,300.0);
2957 }
2958 else if(Warppowder[playerid] != 1)
2959 {
2960 return SendClientMessage(playerid,COLOR_WHITE,"SERVER: You do not have Warppowder!");
2961 }
2962 else if(IsPlayerInAnyVehicle(playerid))
2963 {
2964 return SendClientMessage(playerid,COLOR_WHITE,"SERVER: You can not use Warpkits inside of vehicles");
2965 }
2966
2967 return 1;
2968 }
2969 if(strcmp(cmd, "/jetpack", true) == 0) {
2970 if(!IsPlayerAdmin(playerid))
2971 {
2972 return 0;
2973 }
2974 SendClientMessage(playerid,COLOR_WHITE, "SERVER: Jetpack activated!");
2975 SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
2976 return 1;
2977 }
2978 if(strcmp(cmd, "/sound", true) == 0)
2979 {
2980 new targetsoundid;
2981 if(sscanf(cmdtext[strlen("/sound")+1], "i", targetsoundid))
2982 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sound [soundid]");
2983
2984 for(new i = 0; i < MAX_PLAYERS; i++)
2985 {
2986 PlayerPlaySound(i, targetsoundid, 0,0,0);
2987 }
2988 printf("Playing SoundID: %i",targetsoundid);
2989 return 1;
2990
2991
2992 }
2993
2994
2995 if(strcmp(cmd, "/spec", true) == 0)
2996 {
2997 if(!IsPlayerAdmin(playerid)) return 0;
2998 new targetplayer;
2999 if(sscanf(cmdtext[strlen("/spec")+1], "u", targetplayer))
3000 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spec [playerid]");
3001 if(!IsPlayerConnected(targetplayer))
3002 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3003 if(playerid == targetplayer)
3004 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You cannot spectate yourself!");
3005 if(gPlayerTeamSelection[playerid] == TEAM_SPECTATOR || IsPlayerAdmin(playerid) )
3006 {
3007
3008 SpecPlayer(playerid,targetplayer);
3009 }
3010 else
3011 {
3012 return 0;
3013 }
3014 return 1;
3015 }
3016 if(strcmp(cmd, "/specoff", true) == 0)
3017 {
3018 if(!IsPlayerAdmin(playerid)) return 0;
3019 if(IsSpecing[playerid] == 0)return SendClientMessage(playerid,COLOR_WHITE,"SERVER: You are not spectating");
3020 TogglePlayerSpectating(playerid, 0);
3021 return 1;
3022 }
3023 // Prototyp
3024 if(strcmp(cmd, "/dropmoney", true) == 0)
3025 {
3026 new dropval;
3027 if(sscanf(cmdtext[strlen("/dropmoney")+1], "i", dropval))
3028 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dropmoney [value]");
3029 if(GetPlayerMoney(playerid) < dropval)
3030 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You do not have enough money.");
3031 if(maxmoney >= 4000 && dropval > 0 && dropval <= 100000 && (maxmoney+(dropval/MoneyVal))<(MAX_PICKUPS-sizeof(ActorPickups)-sizeof(InfoPickups)-1-((dropval/MoneyVal)+maxmoney)) && dropval != 0 && !IsPlayerInAnyVehicle(playerid))
3032 {
3033 if(dropval%MoneyVal == 0)
3034 {
3035 new dropstring[32];
3036 format(dropstring,sizeof(dropstring),"SERVER: Dropped $%d",dropval);
3037 SendClientMessage(playerid, COLOR_WHITE, dropstring);
3038 GivePlayerMoneyText(playerid,-dropval);
3039
3040 for(new i; i <dropval/MoneyVal; i++)
3041 {
3042
3043 maxmoney = maxmoney +1;
3044 new Float:x, Float:y, Float:z;
3045 GetPlayerPos(playerid,x,y,z);
3046 GetXYInFrontOfPlayer(playerid,x,y,4);
3047 GenerateRandomPickup(1212,19,x+0.5,x-0.5,y+0.5,y-0.5,z+0.5,z-0.5,0);
3048 }
3049
3050 }
3051 else
3052 {
3053
3054 if(dropval%MoneyVal != 0)
3055 {
3056 SendClientMessageEx(playerid, COLOR_WHITE, "SERVER: The desired value must be divisible by $%d",MoneyVal);
3057 }
3058
3059 }
3060
3061 }
3062 else
3063 {
3064 if(GetPlayerMoney(playerid) < dropval )
3065 {
3066 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You do not have enough money.");
3067 }
3068 if(dropval > 100000)
3069 {
3070
3071 SendClientMessage(playerid, COLOR_WHITE, "SERVER: The desired value has to be $100000 or less");
3072 }
3073 if(dropval==0)
3074 {
3075
3076 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You can not drop nothing!");
3077 }
3078 if((maxmoney+dropval/MoneyVal)>=4095 && dropval <= 100000)
3079 {
3080 new allowmoney[128];
3081 format(allowmoney,sizeof(allowmoney),"SERVER: Because of limitations you can not drop more than $%d right now!",(4095-maxmoney)*MoneyVal);
3082 SendClientMessage(playerid,COLOR_WHITE,allowmoney);
3083 printf("Player may only drop %d",(4095-maxmoney)*MoneyVal);
3084 }
3085 if(maxmoney > 4000)
3086 {
3087 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Due to limitations you can not drop anything right now. Try again later.");
3088 }
3089 }
3090
3091 }
3092 if(strcmp(cmd, "/freeze", true) == 0)
3093 {
3094 new target;
3095 if(!sscanf(cmdtext[strlen("/freeze")+1], "u", target))
3096 {
3097 if(IsPlayerAdmin(playerid))
3098 {
3099 if(!IsPlayerConnected(target))
3100 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3101 TogglePlayerControllable(target,false);
3102 }
3103 }
3104 else
3105 {
3106 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /freeze [playerid]");
3107
3108 }
3109 }
3110 if(strcmp(cmd, "/kill", true) == 0)
3111 {
3112 if(IsPlayerAdmin(playerid))
3113 {
3114 new targetplayer;
3115 if(sscanf(cmdtext[strlen("/kill")+1], "u", targetplayer))
3116 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kill [playerid]");
3117 if(!IsPlayerConnected(targetplayer))
3118 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3119 if(gPlayerTeamSelection[targetplayer] == TEAM_SPECTATOR)
3120 return SendClientMessageEx(playerid, COLOR_WHITE,"SERVER: Cannot kill Player %d, player %d is part of Team %s",targetplayer,targetplayer,GetPlayerTeamColorTag(targetplayer));
3121 SetPlayerHealth(targetplayer,0.0);
3122 }
3123 }
3124 if(strcmp(cmd, "/givecash", true) == 0)
3125 {
3126 if(IsPlayerAdmin(playerid))
3127 {
3128 new targetplayer,moneyamount;
3129 new tname[MAX_PLAYER_NAME];
3130 new aname[MAX_PLAYER_NAME];
3131 new givemoneystring[128];
3132 if(sscanf(cmdtext[strlen("/givecash")+1], "ui", targetplayer,moneyamount))
3133 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
3134 if(!IsPlayerConnected(targetplayer))
3135 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3136 GivePlayerMoneyText(targetplayer,moneyamount);
3137 GetPlayerName(targetplayer,tname,sizeof(tname));
3138 GetPlayerName(playerid,aname,sizeof(aname));
3139 format(givemoneystring,sizeof(givemoneystring),"SERVER: Admin %s (%d) gave %s (%d) $%d.",aname,playerid,tname,targetplayer,moneyamount);
3140 SendClientMessageToAll(COLOR_WHITE,givemoneystring);
3141 }
3142 }
3143 if(strcmp(cmd, "/slap", true) == 0)
3144 {
3145 if(IsPlayerAdmin(playerid))
3146 {
3147 new targetplayer;
3148 new Float:a, Float:b, Float:c;
3149 if(sscanf(cmdtext[strlen("/slap")+1], "u", targetplayer))
3150 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [playerid]");
3151 if(!IsPlayerConnected(targetplayer))
3152 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3153 GetPlayerPos(targetplayer,a,b,c);
3154 SetPlayerPos(targetplayer,a,b,c+10);
3155 }
3156 }
3157 if(strcmp(cmd, "/reset", true) == 0)
3158 {
3159 if(IsPlayerAdmin(playerid))
3160 {
3161 new targetplayer;
3162 if(sscanf(cmdtext[strlen("/reset")+1], "u", targetplayer))
3163 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /reset [playerid]");
3164 if(!IsPlayerConnected(targetplayer))
3165 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3166 if(gPlayerHasTeamSelected[targetplayer] == -1)
3167 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player is still in team selection!");
3168 ResetPlayerData(targetplayer);
3169 ResetPlayerMoney(targetplayer);
3170 TeleportPlayerToBase(targetplayer);
3171 }
3172 }
3173 if(strcmp(cmd, "/checkmoney", true) == 0)
3174 {
3175 if(IsPlayerAdmin(playerid))
3176 {
3177 new targetplayer;
3178 new tname[144];
3179 if(sscanf(cmdtext[strlen("/checkmoney")+1], "u", targetplayer))
3180 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /checkmoney [playerid]");
3181 if(!IsPlayerConnected(targetplayer))
3182 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3183 if(gPlayerHasTeamSelected[targetplayer] == -1)
3184 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player is still in team selection!");
3185 GetPlayerName(targetplayer,tname,sizeof(tname));
3186 SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Player %s(%d) is in posession of $%d at this moment",tname,targetplayer,GetPlayerMoney(targetplayer));
3187 }
3188 }
3189 if(strcmp(cmd, "/spawn", true) == 0)
3190 {
3191 if(IsPlayerAdmin(playerid))
3192 {
3193 new targetplayer;
3194 if(sscanf(cmdtext[strlen("/spawn")+1], "u", targetplayer))
3195 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spawn [playerid]");
3196 if(!IsPlayerConnected(targetplayer))
3197 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3198 if(gPlayerHasTeamSelected[targetplayer] == -1)
3199 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player is still in team selection!");
3200 TeleportPlayerToBase(targetplayer);
3201 }
3202 }
3203 if(strcmp(cmd, "/unfreeze", true) == 0)
3204 {
3205 if(IsPlayerAdmin(playerid))
3206 {
3207 new targetplayer;
3208 if(sscanf(cmdtext[strlen("/unfreeze")+1], "u", targetplayer))
3209 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unfreeze [playerid]");
3210 if(!IsPlayerConnected(targetplayer))
3211 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3212 TogglePlayerControllable(targetplayer,true);
3213 }
3214 }
3215 if(strcmp(cmd, "/getmoneycount", true) == 0)
3216 {
3217 new moneyvalstring[128];
3218 format(moneyvalstring,sizeof(moneyvalstring),"SERVER: $%d have been generated.%d money pickups have been created",moneyval,maxmoney);
3219 SendClientMessage(playerid,COLOR_WHITE,moneyvalstring);
3220 }
3221 if(strcmp(cmd, "/goto", true) == 0)
3222 {
3223 if(IsPlayerAdmin(playerid))
3224 {
3225 new targetplayer;
3226 if(sscanf(cmdtext[strlen("/goto")+1], "u", targetplayer))
3227 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /goto [playerid]");
3228 if(!IsPlayerConnected(targetplayer))
3229 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3230 if(playerid == targetplayer)
3231 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You cannot goto yourself!");
3232 if(IsPlayerConnected(targetplayer))
3233 {
3234 new Float:x, Float:y, Float:z;
3235 GetPlayerPos(targetplayer, x, y, z);
3236 SetPlayerInterior(playerid,GetPlayerInterior(targetplayer));
3237 SetPlayerPos(playerid, x+1, y+1, z);
3238 return 1;
3239 }
3240 }
3241 else
3242 {
3243 return 0;
3244 }
3245 }
3246 if(strcmp(cmd, "/acmds", true) == 0)
3247 {
3248 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Commands for admin use only below.");
3249 SendClientMessage(playerid,COLOR_WHITE,"SERVER: /goto [playerid] /playertoplayer [playerid] [targetplayerid]");
3250 SendClientMessage(playerid,COLOR_WHITE,"SERVER: /getmoneycount /get [playerid] /netstats [playerid]");
3251 SendClientMessage(playerid,COLOR_WHITE,"SERVER: /kill [playerid] /spawn [playerid] /slap [playerid]");
3252 SendClientMessage(playerid,COLOR_WHITE,"SERVER: /givecash [playerid] [value] /freeze [playerid] /unfreeze [playerid]");
3253 SendClientMessage(playerid,COLOR_WHITE,"SERVER: /sound [soundid] /spec [playerid]");
3254 }
3255 if(strcmp(cmd, "/playertoplayer", true) == 0)
3256 {
3257 if(IsPlayerAdmin(playerid))
3258 {
3259 new targetplayer1,targetplayer2;
3260 if(sscanf(cmdtext[strlen("/playertoplayer")+1], "uu", targetplayer1,targetplayer2))
3261 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /playertoplayer [playerid] [playerid]");
3262 if(!IsPlayerConnected(targetplayer1) || !IsPlayerConnected(targetplayer2))
3263 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3264 if(playerid == targetplayer1 && playerid == targetplayer2 )
3265 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You cannot teleport yourself to yourself!");
3266 new Float:d1,Float:d2,Float:d3;
3267 GetPlayerPos(targetplayer2,d1,d2,d3);
3268 SetPlayerPos(targetplayer1,d1,d2,d3);
3269
3270 }
3271 else
3272 {
3273 return 0;
3274 }
3275 }
3276 if(strcmp(cmd, "/getmoneycount", true) == 0)
3277 {
3278 new moneyvalstring[128];
3279 format(moneyvalstring,sizeof(moneyvalstring),"SERVER: $%d have been generated.%d money pickups have been created",moneyval,maxmoney);
3280 SendClientMessage(playerid,COLOR_WHITE,moneyvalstring);
3281 }
3282 if(strcmp(cmd, "/get", true) == 0)
3283 {
3284
3285 if(IsPlayerAdmin(playerid))
3286 {
3287 new targetplayer;
3288 if(sscanf(cmdtext[strlen("/get")+1], "u", targetplayer))
3289 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /get [playerid]");
3290 if(!IsPlayerConnected(targetplayer))
3291 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3292 if(playerid == targetplayer)
3293 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You cannot get yourself!");
3294 if(IsPlayerConnected(targetplayer))
3295 {
3296 new Float:x, Float:y, Float:z;
3297 GetPlayerPos(playerid, x, y, z);
3298 SetPlayerInterior(targetplayer,GetPlayerInterior(playerid));
3299 SetPlayerPos(targetplayer, x+1, y+1, z);
3300 return 1;
3301 }
3302 }
3303 else
3304 {
3305 return 0;
3306 }
3307 }
3308 if(strcmp(cmd, "/dropbomb", true) == 0)
3309 {
3310 if(PBomb[playerid] == 1 && GetPlayerInterior(playerid) == 0 && !IsPlayerInAnyVehicle(playerid))
3311 {
3312 ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 1, 0, 0, 1, 1);
3313 PBombID[playerid]=1;
3314 PBomb[playerid]=-1;
3315 GetPlayerPos(playerid,pX[playerid],pY[playerid],pZ[playerid]);
3316 BombObject[playerid] = CreateObject(363,pX[playerid],pY[playerid],(pZ[playerid]-0.4),0,0,0);//Bomb object
3317 SendClientMessage(playerid, COLOR_WHITE, "SERVER: Bomb placed! Use ~k~~CONVERSATION_YES~ or /detonate to blow it up!");
3318 for(new k;k<sizeof(beds[]);k++)
3319 {
3320 new Float:dist = floatabs(GetDistance(pX[playerid],pY[playerid],pZ[playerid],beds[k][0],beds[k][1],beds[k][2]));
3321 {
3322 if(dist < 8)
3323 {
3324 new distancestring[128];
3325 format(distancestring,sizeof(distancestring),"SERVER: Distance of dropped bomb to closest bed: %fm",dist);
3326 }
3327 }
3328 }
3329 }
3330 else if(GetPlayerInterior(playerid) != 0)
3331 {
3332 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You cannot use /dropbomb inside of interiors.");
3333 }
3334 else if(PBomb[playerid] != 1)
3335 {
3336 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You have to buy a bomb to use this command.");
3337 }
3338 }
3339 if(strcmp(cmd, "/detonate", true) == 0)
3340 {
3341 if(PBomb[playerid] == -1 && PBombID[playerid] == 1 && IsPlayerInRangeOfPoint(playerid,150,pX[playerid],pY[playerid],pZ[playerid]))
3342 {
3343 PlayerInfo[playerid][pBombs]++;
3344 PBombID[playerid]=0;
3345 PBomb[playerid]=0;
3346 CreateExplosion(pX[playerid],pY[playerid],pZ[playerid],7,10);
3347 CreateExplosion(pX[playerid],pY[playerid],pZ[playerid],9,10);
3348 SendClientMessage(playerid, COLOR_WHITE, "SERVER: Bomb detonated!");
3349 PlayerPlaySound(playerid, 21001, 0, 0, 0);
3350 DestroyObject(BombObject[playerid]);
3351 for(new i = 0; i < sizeof(beds[]); i++)
3352 {
3353 new Float:health;
3354 GetPlayerHealth(playerid,health);
3355 new Float:dist = GetDistance(beds[i][0],beds[i][1],beds[i][2],pX[playerid],pY[playerid],pZ[playerid]);
3356 if(dist < 4)
3357 {
3358 running = 1;
3359 if(!(i == 0 && gPlayerTeamSelection[playerid] == FIRST_TEAM) || !(i == 1 && gPlayerTeamSelection[playerid] == THIRD_TEAM) || !(i == 2 && gPlayerTeamSelection[playerid] == SECOND_TEAM))
3360 PBeds[playerid]+=1;
3361
3362
3363 if(i == 0 && BED_STATE_TEAM_ONE !=-1 )
3364 {
3365 BED_STATE_TEAM_ONE=-1;
3366 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#FIRST_TEAM_COLOR_TAG);
3367 }
3368 if(i == 1 && BED_STATE_TEAM_TWO !=-1 )
3369 {
3370 BED_STATE_TEAM_THREE=-1;
3371 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#SECOND_TEAM_COLOR_TAG);
3372 }
3373
3374 #if defined TEAMSIZE
3375 #if TEAMSIZE >=3
3376 if(i == 2 && BED_STATE_TEAM_THREE !=-1 )
3377 {
3378 BED_STATE_TEAM_TWO=-1;
3379 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#THIRD_TEAM_COLOR_TAG);
3380 }
3381 #endif
3382 #endif
3383 #if defined TEAMSIZE
3384 #if TEAMSIZE >=4
3385 if(i == 3 && BED_STATE_TEAM_FOUR !=-1 )
3386 {
3387 BED_STATE_TEAM_FOUR=-1;
3388 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#FOURTH_TEAM_COLOR_TAG);
3389 }
3390 #endif
3391 #endif
3392 #if defined TEAMSIZE
3393 #if TEAMSIZE >=5
3394 if(i == 4 && BED_STATE_TEAM_FIVE !=-1 )
3395 {
3396 BED_STATE_TEAM_FIVE=-1;
3397 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#FIFTH_TEAM_COLOR_TAG);
3398 }
3399 #endif
3400 #endif
3401 #if defined TEAMSIZE
3402 #if TEAMSIZE >=6
3403 if(i == 5 && BED_STATE_TEAM_SIX !=-1 )
3404 {
3405 BED_STATE_TEAM_SIX=-1;
3406 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#SIXTH_TEAM_COLOR_TAG);
3407 }
3408 #endif
3409 #endif
3410 SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
3411 x1=pX[playerid];
3412 y1=pY[playerid];
3413 z1=pZ[playerid];
3414 ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 1, 0, 0, 1, 1);
3415 SetTimer("BlowUpThisBed", 130, false);
3416 return 1;
3417 }
3418
3419 }
3420 }
3421 }
3422 if(strcmp(cmd, "/netstats", true) == 0)
3423 {
3424 new stats[400+1];
3425 new targetplayer;
3426 if(sscanf(cmdtext[strlen("/netstats")+1], "u", targetplayer))
3427 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /netstats [playerid]");
3428 if(!IsPlayerConnected(targetplayer))
3429 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3430
3431 GetPlayerNetworkStats(targetplayer, stats, sizeof(stats)); // get a players networkstats
3432 ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Networkstats", stats, "Okay", "");
3433 }
3434 if(strcmp(cmd, "/stats", true) == 0)
3435 {
3436 new targetplayer;
3437 if(sscanf(cmdtext[strlen("/stats")+1], "u", targetplayer))
3438 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /stats [playerid]");
3439 if(!IsPlayerConnected(targetplayer))
3440 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3441 new statsstring1[128];
3442 new statsstring2[256];
3443 new deaths = PlayerInfo[targetplayer][pDeaths];
3444 new kills = PlayerInfo[targetplayer][pKills];
3445 if(deaths == 0)
3446 {
3447 deaths = 1;
3448 }
3449 deaths = PlayerInfo[targetplayer][pDeaths];
3450 kills = PlayerInfo[targetplayer][pKills];
3451 new Float:kd = floatdiv(kills,deaths);
3452 new name[MAX_PLAYER_NAME];
3453 GetPlayerName(targetplayer, name, sizeof(name));
3454 format(statsstring1,sizeof(statsstring1),"SERVER: Player stats of %s(%d) below.",name,targetplayer);
3455 SendClientMessage(playerid, COLOR_WHITE,statsstring1);
3456 format(statsstring2,sizeof(statsstring2),"Kills:%d Deaths:%d Ratio:%0.2f Blown beds:%d Bombs detonated:%d",kills,deaths,kd,PlayerInfo[targetplayer][pBeds],PlayerInfo[targetplayer][pBombs]);
3457 SendClientMessage(playerid, COLOR_WHITE,statsstring2);
3458 }
3459 if(strcmp(cmd, "/pm", true) == 0)
3460 {
3461 new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
3462 if(sscanf(cmdtext[strlen("/pm")+1], "us", id, str2))
3463 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pm <id> <message>");
3464 if(!IsPlayerConnected(id))
3465 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
3466 if(playerid == id)
3467 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You cannot pm yourself!");
3468
3469 GetPlayerName(playerid, Name1, sizeof(Name1));
3470 GetPlayerName(id, Name2, sizeof(Name2));
3471 format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
3472 SendClientMessage(playerid, COLOR_YELLOW, str);
3473 format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
3474 SendClientMessage(id, COLOR_YELLOW, str);
3475 return 1;
3476 }
3477 if(strcmp(cmd, "/r", true) == 0)
3478 {
3479 new str[256], str2[256], Name1[MAX_PLAYER_NAME];
3480 if(sscanf(cmdtext[strlen("/r")+1], "s", str2))
3481 return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /r <message>");
3482 GetPlayerName(playerid, Name1, sizeof(Name1));
3483 format(str, sizeof(str), "[%s{FFFFFF}]%s(%d): %s",GetPlayerTeamColorTag(playerid), Name1, playerid, str2);
3484 SendTeamMessage(gPlayerTeamSelection[playerid],COLOR_WHITE,str);
3485 return 1;
3486 }
3487 if(strcmp(cmdtext, "/blowup", true) == 0 && GameHasStarted == 1)
3488 {
3489 for(new i = 0; i < sizeof(beds); i++)
3490 {
3491 new Float:health;
3492 GetPlayerHealth(playerid,health);
3493
3494 if(running !=1 && IsPlayerInRangeOfPoint(playerid,3.0,beds[i][0],beds[i][1],beds[i][2]) && health > 0 && !IsPlayerInAnyVehicle(playerid)) // In this script we deal with players only
3495 {
3496 if((i == 0 && gPlayerTeamSelection[playerid] == FIRST_TEAM) || (i == 1 && gPlayerTeamSelection[playerid] == SECOND_TEAM) || (i == 2 && gPlayerTeamSelection[playerid] == THIRD_TEAM) || (i == 3 && gPlayerTeamSelection[playerid] == FOURTH_TEAM) || (i == 4 && gPlayerTeamSelection[playerid] == FIFTH_TEAM) || (i == 5 && gPlayerTeamSelection[playerid] == SIXTH_TEAM))
3497 return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You cannot blow up the bed of your own team!");
3498 running = 1;
3499 PlayerInfo[playerid][pBeds]=GetPlayerScore(playerid);
3500 SetTimer("BlowUpThisBed", bombtimer, false);
3501 if(i == 0 && BED_STATE_TEAM_ONE !=-1 )
3502 {
3503 BED_STATE_TEAM_ONE=-1;
3504 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are blowing up the bed of Team "#FIRST_TEAM_COLOR_TAG);
3505 }
3506 if(i == 1 && BED_STATE_TEAM_TWO !=-1 )
3507 {
3508 BED_STATE_TEAM_TWO=-1;
3509 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are blowing up the bed of Team "#SECOND_TEAM_COLOR_TAG);
3510 }
3511
3512 #if defined TEAMSIZE
3513 #if TEAMSIZE >=3
3514 if(i == 2 && BED_STATE_TEAM_THREE !=-1 )
3515 {
3516 BED_STATE_TEAM_THREE=-1;
3517 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are blowing up the bed of Team "#THIRD_TEAM_COLOR_TAG);
3518 }
3519 #endif
3520 #endif
3521 #if defined TEAMSIZE
3522 #if TEAMSIZE >=4
3523 if(i == 3 && BED_STATE_TEAM_FOUR !=-1 )
3524 {
3525 BED_STATE_TEAM_FOUR=-1;
3526 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are blowing up the bed of Team "#FOURTH_TEAM_COLOR_TAG);
3527 }
3528 #endif
3529 #endif
3530 #if defined TEAMSIZE
3531 #if TEAMSIZE >=5
3532 if(i == 4 && BED_STATE_TEAM_FIVE !=-1 )
3533 {
3534 BED_STATE_TEAM_FIVE=-1;
3535 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are blowing up the bed of Team "#FIFTH_TEAM_COLOR_TAG);
3536 }
3537 #endif
3538 #endif
3539 #if defined TEAMSIZE
3540 #if TEAMSIZE >=6
3541 if(i == 5 && BED_STATE_TEAM_SIX !=-1 )
3542 {
3543 BED_STATE_TEAM_SIX=-1;
3544 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are blowing up the bed of Team "#SIXTH_TEAM_COLOR_TAG);
3545 }
3546 #endif
3547 #endif
3548 PBeds[playerid]+=1;
3549 SendClientMessage(playerid, COLOR_WHITE, "SERVER: Planted Bomb Successfully. Lets Blow This Bed Up!");
3550 SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
3551 SendClientMessage(playerid, COLOR_WHITE, "SERVER: Keep Running! Bed Will Blow Up In 5 seconds!");
3552
3553 GetPlayerPos(playerid, x1, y1, z1);
3554 ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 1, 0, 0, 1, 1);
3555 for(new k = 0; k < MAX_PLAYERS; k++)
3556 {
3557 PlayerPlaySound(k,7416,x1,y1,z1);
3558 }
3559 CountDownTimer = SetTimer("CountDown", 1000, true);
3560 new Float:dist = GetDistance(beds[i][0],beds[i][1],beds[i][2],x1,y1,z1);
3561 printf("Distance to closest bed: %f, Index: %d", dist, i);
3562
3563
3564
3565 return 1;
3566
3567 }
3568
3569
3570
3571 }
3572 return 0;
3573
3574 }
3575 return 1;
3576
3577}
3578public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
3579{
3580 if(PRESSED(KEY_YES) && PBomb[playerid] == -1 && PBombID[playerid] == 1 && IsPlayerInRangeOfPoint(playerid,150,pX[playerid],pY[playerid],pZ[playerid]))
3581 {
3582 PlayerInfo[playerid][pBombs]++;
3583 PBombID[playerid]=0;
3584 PBomb[playerid]=0;
3585 CreateExplosion(pX[playerid],pY[playerid],pZ[playerid],7,10);
3586 CreateExplosion(pX[playerid],pY[playerid],pZ[playerid],9,10);
3587 SendClientMessage(playerid, COLOR_WHITE, "SERVER: Bomb detonated!");
3588 PlayerPlaySound(playerid, 21001, 0, 0, 0);
3589 DestroyObject(BombObject[playerid]);
3590 for(new i = 0; i < sizeof(beds[]); i++)
3591 {
3592 new Float:health;
3593 GetPlayerHealth(playerid,health);
3594 new Float:dist = GetDistance(beds[i][0],beds[i][1],beds[i][2],pX[playerid],pY[playerid],pZ[playerid]);
3595 if(dist < 4)
3596 {
3597 running = 1;
3598 if(!(i == 0 && gPlayerTeamSelection[playerid] == FIRST_TEAM) || !(i == 1 && gPlayerTeamSelection[playerid] == THIRD_TEAM) || !(i == 2 && gPlayerTeamSelection[playerid] == SECOND_TEAM))
3599 PBeds[playerid]+=1;
3600
3601
3602 if(i == 0 && BED_STATE_TEAM_ONE !=-1 )
3603 {
3604 BED_STATE_TEAM_ONE=-1;
3605 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#FIRST_TEAM_COLOR_TAG);
3606 }
3607 if(i == 1 && BED_STATE_TEAM_TWO !=-1 )
3608 {
3609 BED_STATE_TEAM_THREE=-1;
3610 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#SECOND_TEAM_COLOR_TAG);
3611 }
3612
3613 #if defined TEAMSIZE
3614 #if TEAMSIZE >=3
3615 if(i == 2 && BED_STATE_TEAM_THREE !=-1 )
3616 {
3617 BED_STATE_TEAM_TWO=-1;
3618 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#THIRD_TEAM_COLOR_TAG);
3619 }
3620 #endif
3621 #endif
3622 #if defined TEAMSIZE
3623 #if TEAMSIZE >=4
3624 if(i == 3 && BED_STATE_TEAM_FOUR !=-1 )
3625 {
3626 BED_STATE_TEAM_FOUR=-1;
3627 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#FOURTH_TEAM_COLOR_TAG);
3628 }
3629 #endif
3630 #endif
3631 #if defined TEAMSIZE
3632 #if TEAMSIZE >=5
3633 if(i == 4 && BED_STATE_TEAM_FIVE !=-1 )
3634 {
3635 BED_STATE_TEAM_FIVE=-1;
3636 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#FIFTH_TEAM_COLOR_TAG);
3637 }
3638 #endif
3639 #endif
3640 #if defined TEAMSIZE
3641 #if TEAMSIZE >=6
3642 if(i == 5 && BED_STATE_TEAM_SIX !=-1 )
3643 {
3644 BED_STATE_TEAM_SIX=-1;
3645 SendClientMessage(playerid, COLOR_WHITE, "SERVER: You blew up the bed of Team "#SIXTH_TEAM_COLOR_TAG);
3646 }
3647 #endif
3648 #endif
3649 SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
3650 x1=pX[playerid];
3651 y1=pY[playerid];
3652 z1=pZ[playerid];
3653 ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 4.0, 1, 0, 0, 1, 1);
3654 SetTimer("BlowUpThisBed", 130, false);
3655
3656
3657
3658
3659 return 1;
3660 }
3661
3662 }
3663 }
3664 return 1;
3665}
3666public OnPlayerDeath(playerid, killerid, reason)
3667{
3668 PlayerInfo[playerid][pDeaths]++;
3669 if(killerid != INVALID_PLAYER_ID) PlayerInfo[killerid][pKills]++;
3670 ResetPlayerData(playerid);
3671
3672 new pname[MAX_PLAYER_NAME];
3673 GetPlayerName(playerid, pname, sizeof(pname));
3674 new matediedstringgrey[128];
3675 new matediedstringred[128];
3676 new matediedstringblue[128];
3677
3678 HideMenuForPlayer(ammunation,playerid);
3679 HideMenuForPlayer(pistols,playerid);
3680 HideMenuForPlayer(microsmg,playerid);
3681 HideMenuForPlayer(shotguns,playerid);
3682 HideMenuForPlayer(items,playerid);
3683 HideMenuForPlayer(smg,playerid);
3684 HideMenuForPlayer(rifles,playerid);
3685 HideMenuForPlayer(assaultrifle,playerid);
3686 HideMenuForPlayer(Grenades,playerid);
3687 HideMenuForPlayer(melee,playerid);
3688 HideMenuForPlayer(special,playerid);
3689 HideMenuForPlayer(shopmenu,playerid);
3690 HideMenuForPlayer(yesno,playerid);
3691
3692
3693 if(GetPlayerWeapon(playerid) == 16)
3694 {
3695 new Float:x, Float:y, Float:z;
3696 GetPlayerPos(playerid,x,y,z);
3697 CreateExplosion(x,y,z,7,10);
3698 CreateExplosion(x,y,z,9,10);
3699 }
3700
3701 if(BED_STATE_TEAM_ONE != 0 && gPlayerTeamSelection[playerid] == FIRST_TEAM)
3702 {
3703 format(matediedstringgrey,sizeof(matediedstringgrey),"SERVER: %s (%d) has been killed, watch out! %d players left in Team "#FIRST_TEAM_COLOR_TAG,pname,playerid,GetTeamPlayerCount(FIRST_TEAM)-1);
3704 SendClientMessageToAll(COLOR_WHITE,matediedstringgrey);
3705 }
3706 if(BED_STATE_TEAM_TWO != 0 && gPlayerTeamSelection[playerid] == SECOND_TEAM)
3707 {
3708 format(matediedstringred,sizeof(matediedstringred),"SERVER: %s (%d) has been killed, watch out! %d players left in Team "#SECOND_TEAM_COLOR_TAG,pname,playerid,GetTeamPlayerCount(SECOND_TEAM)-1);
3709 SendClientMessageToAll(COLOR_WHITE,matediedstringred);
3710 }
3711 #if defined TEAMSIZE
3712 #if TEAMSIZE >=3
3713 if(BED_STATE_TEAM_THREE != 0 && gPlayerTeamSelection[playerid] == THIRD_TEAM)
3714 {
3715 format(matediedstringblue,sizeof(matediedstringblue),"SERVER: %s (%d) has been killed, watch out! %d players left in Team "#THIRD_TEAM_COLOR_TAG,pname,playerid,GetTeamPlayerCount(THIRD_TEAM)-1);
3716 SendClientMessageToAll(COLOR_WHITE,matediedstringblue);
3717 }
3718 #endif
3719 #endif
3720 #if defined TEAMSIZE
3721 #if TEAMSIZE >=4
3722 if(BED_STATE_TEAM_FOUR != 0 && gPlayerTeamSelection[playerid] == FOURTH_TEAM)
3723 {
3724 format(matediedstringgrey,sizeof(matediedstringgrey),"SERVER: %s (%d) has been killed, watch out! %d players left in Team "#FOURTH_TEAM_COLOR_TAG,pname,playerid,GetTeamPlayerCount(FOURTH_TEAM)-1);
3725 SendClientMessageToAll(COLOR_WHITE,matediedstringgrey);
3726 }
3727 #endif
3728 #endif
3729 #if defined TEAMSIZE
3730 #if TEAMSIZE >=5
3731 if(BED_STATE_TEAM_FIVE != 0 && gPlayerTeamSelection[playerid] == FIFTH_TEAM)
3732 {
3733 format(matediedstringred,sizeof(matediedstringred),"SERVER: %s (%d) has been killed, watch out! %d players left in Team "#FIFTH_TEAM_COLOR_TAG,pname,playerid,GetTeamPlayerCount(FIFTH_TEAM)-1);
3734 SendClientMessageToAll(COLOR_WHITE,matediedstringred);
3735 }
3736 #endif
3737 #endif
3738 #if defined TEAMSIZE
3739 #if TEAMSIZE ==6
3740 if(BED_STATE_TEAM_SIX != 0 && gPlayerTeamSelection[playerid] == SIXTH_TEAM)
3741 {
3742 format(matediedstringblue,sizeof(matediedstringblue),"SERVER: %s (%d) has been killed, watch out! %d players left in Team "#SIXTH_TEAM_COLOR_TAG,pname,playerid,GetTeamPlayerCount(SIXTH_TEAM)-1);
3743 SendClientMessageToAll(COLOR_WHITE,matediedstringblue);
3744 }
3745 #endif
3746 #endif
3747 new playercash;
3748 playercash = GetPlayerMoney(playerid);
3749 SendDeathMessage(killerid, playerid, reason); // Shows the kill in the killfeed
3750 gPlayerHasTeamSelected[playerid] = 0;
3751 TextDrawHideForPlayer(playerid,txtTimeDisp);
3752 playercash = GetPlayerMoney(playerid);
3753 ResetPlayerMoney(playerid);
3754 GivePlayerMoneyText(playerid, -playercash);
3755 LastMoney[playerid]=playercash;
3756
3757 #if defined BEDSSYSTEM
3758 #if BEDSSYSTEM==0
3759 if(killerid != playerid && killerid != INVALID_PLAYER_ID)
3760 {
3761 GivePlayerMoneyText(killerid,playercash);
3762 }
3763 #elseif BEDSSYSTEM==1
3764
3765 if(killerid != playerid && killerid != INVALID_PLAYER_ID)
3766 {
3767 if(GetPlayerScore(killerid) >= 100)
3768 GivePlayerMoneyText(killerid,playercash+playercash/4);
3769 if(GetPlayerScore(killerid) >= 500)
3770 GivePlayerMoneyText(killerid,playercash+playercash/2);
3771 if(GetPlayerScore(killerid) >= 1000)
3772 GivePlayerMoneyText(killerid,playercash * 2);
3773 }
3774 #endif
3775 #else
3776 if(killerid != playerid && killerid != INVALID_PLAYER_ID)
3777 {
3778 GivePlayerMoneyText(killerid,playercash);
3779 }
3780 #endif
3781
3782
3783 PKills[playerid] += 1;
3784 if(BED_STATE_TEAM_ONE!=0 && FIRST_TEAM == gPlayerTeamSelection[playerid])
3785 {
3786 SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Unable to respawn. The bed of team %s {FFFFFF}already has been destroyed.",FIRST_TEAM_COLOR_TAG);
3787 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Entering spectator mode..");
3788 SetPlayerCameraPos(playerid,243.2876,1802.5547,7.4141);
3789 SetPlayerCameraLookAt(playerid,243.1261,1805.2798,8.3794);
3790 gPlayerTeamSelection[playerid] =TEAM_SPECTATOR;
3791 SetPlayerColor(playerid,COLOR_WHITE);
3792 SpecRandomPlayer(playerid);
3793 }
3794 if(BED_STATE_TEAM_TWO!=0 && SECOND_TEAM == gPlayerTeamSelection[playerid])
3795 {
3796 SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Unable to respawn. The bed of team %s {FFFFFF}already has been destroyed.",SECOND_TEAM_COLOR_TAG);
3797 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Entering spectator mode..");
3798 SetPlayerCameraPos(playerid,243.2876,1802.5547,7.4141);
3799 SetPlayerCameraLookAt(playerid,243.1261,1805.2798,8.3794);
3800 gPlayerTeamSelection[playerid] =TEAM_SPECTATOR;
3801 SetPlayerColor(playerid,COLOR_WHITE);
3802 SpecRandomPlayer(playerid);
3803 }
3804 #if defined TEAMSIZE
3805 #if TEAMSIZE >= 3
3806 if(BED_STATE_TEAM_THREE!=0 && THIRD_TEAM == gPlayerTeamSelection[playerid])
3807 {
3808 SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Unable to respawn. The bed of team %s {FFFFFF}already has been destroyed.",THIRD_TEAM_COLOR_TAG);
3809 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Entering spectator mode..");
3810 SetPlayerCameraPos(playerid,243.2876,1802.5547,7.4141);
3811 SetPlayerCameraLookAt(playerid,243.1261,1805.2798,8.3794);
3812 gPlayerTeamSelection[playerid] =TEAM_SPECTATOR;
3813 SetPlayerColor(playerid,COLOR_WHITE);
3814 SpecRandomPlayer(playerid);
3815 }
3816 #endif
3817 #endif
3818 #if defined TEAMSIZE
3819 #if TEAMSIZE >= 4
3820 if(BED_STATE_TEAM_FOUR!=0 && FOURTH_TEAM == gPlayerTeamSelection[playerid])
3821 {
3822 SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Unable to respawn. The bed of team %s {FFFFFF}already has been destroyed.",FOURTH_TEAM_COLOR_TAG);
3823 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Entering spectator mode..");
3824 SetPlayerCameraPos(playerid,243.2876,1802.5547,7.4141);
3825 SetPlayerCameraLookAt(playerid,243.1261,1805.2798,8.3794);
3826 gPlayerTeamSelection[playerid] =TEAM_SPECTATOR;
3827 SetPlayerColor(playerid,COLOR_WHITE);
3828 SpecRandomPlayer(playerid);
3829 }
3830 #endif
3831 #endif
3832 #if defined TEAMSIZE
3833 #if TEAMSIZE >= 5
3834 if(BED_STATE_TEAM_FIVE!=0 && FIFTH_TEAM == gPlayerTeamSelection[playerid])
3835 {
3836 SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Unable to respawn. The bed of team %s {FFFFFF}already has been destroyed.",FIFTH_TEAM_COLOR_TAG);
3837 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Entering spectator mode..");
3838 SetPlayerCameraPos(playerid,243.2876,1802.5547,7.4141);
3839 SetPlayerCameraLookAt(playerid,243.1261,1805.2798,8.3794);
3840 gPlayerTeamSelection[playerid] =TEAM_SPECTATOR;
3841 SetPlayerColor(playerid,COLOR_WHITE);
3842 SpecRandomPlayer(playerid);
3843 }
3844 #endif
3845 #endif
3846 #if defined TEAMSIZE
3847 #if TEAMSIZE == 6
3848 if(BED_STATE_TEAM_SIX!=0 && SIXTH_TEAM == gPlayerTeamSelection[playerid])
3849 {
3850 SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Unable to respawn. The bed of team %s {FFFFFF}already has been destroyed.",SIXTH_TEAM_COLOR_TAG);
3851 SendClientMessage(playerid,COLOR_WHITE,"SERVER: Entering spectator mode..");
3852 SetPlayerCameraPos(playerid,243.2876,1802.5547,7.4141);
3853 SetPlayerCameraLookAt(playerid,243.1261,1805.2798,8.3794);
3854 gPlayerTeamSelection[playerid] =TEAM_SPECTATOR;
3855 SetPlayerColor(playerid,COLOR_WHITE);
3856 SpecRandomPlayer(playerid);
3857 }
3858 #endif
3859 #endif
3860 if(GetActiveTeamCount() >= 2)
3861 {
3862 TeamsAlive(false);
3863 }
3864 if(IsBeingSpeced[playerid] == 1)
3865 {
3866 for(new i;i<MAX_PLAYERS;i++)
3867 {
3868 if(spectatorid[i] == playerid)
3869 {
3870 SpecRandomPlayer(i);
3871 }
3872 }
3873 }
3874 return 1;
3875}
3876
3877ClassSel_SetupSelectedTeam(playerid)
3878{
3879 PlayerTextDrawDestroy(playerid, TeamText[playerid]);
3880 PlayerTextDrawDestroy(playerid, TeamCover[playerid]);
3881 PlayerTextDrawDestroy(playerid, LocText[playerid]);
3882 TeamText[playerid] = CreatePlayerTextDraw(playerid, 65.000000,349.000000,"Team:");
3883 ClassSel_InitTeamNameText(playerid,TeamText[playerid]);
3884 TeamCover[playerid] = CreatePlayerTextDraw(playerid, 10.000000,349.000000,"Team:");
3885 ClassSel_InitTeamNameText(playerid,TeamCover[playerid]);
3886 LocText[playerid] = CreatePlayerTextDraw(playerid, 10.000000,379.000000,"Location:");
3887 ClassSel_InitTeamNameText(playerid,LocText[playerid]);
3888 PlayerTextDrawShow(playerid,TeamCover[playerid]);
3889 PlayerPlaySound(playerid,1185,0,0,0);
3890 SetPlayerColor(playerid,COLOR_WHITE);
3891 gettime(hour, minute);
3892 SetPlayerTime(playerid,hour,minute);
3893 if(gPlayerTeamSelection[playerid] == -1) {
3894 gPlayerTeamSelection[playerid] = FIRST_TEAM;
3895 }
3896
3897 if(gPlayerTeamSelection[playerid] == FIRST_TEAM) {
3898 SetPlayerInterior(playerid,TEAM_ONE_SEL_INTERIOR);
3899 SetPlayerCameraPos(playerid,ClassSel_SetupTeamTEAM_POS[0][0],ClassSel_SetupTeamTEAM_POS[0][1],ClassSel_SetupTeamTEAM_POS[0][2]);
3900 SetPlayerCameraLookAt(playerid,ClassSel_SetupTeamTEAM_LOOK_AT[0][0],ClassSel_SetupTeamTEAM_LOOK_AT[0][1],ClassSel_SetupTeamTEAM_LOOK_AT[0][2]);
3901 new astring[64];
3902 PlayerTextDrawHide(playerid,TeamText[playerid]);
3903 PlayerTextDrawHide(playerid,LocText[playerid]);
3904 PlayerTextDrawSetString(playerid, TeamText[playerid],FIRST_TEAM_NAME_TAG);
3905 PlayerTextDrawColor(playerid,TeamText[playerid],COLOR_TEAM_ONE_TD);
3906 PlayerTextDrawShow(playerid,TeamText[playerid]);
3907 format(astring,sizeof(astring),"Location:"#FIRST_TEAM_LOCATION);
3908 PlayerTextDrawSetString(playerid, LocText[playerid], astring);
3909 PlayerTextDrawShow(playerid,LocText[playerid]);
3910
3911 SetPlayerWeather(playerid,15);
3912 PlayerPlaySound(playerid,2403,0,0,0);
3913
3914 }
3915 #if defined TEAMSIZE
3916 #if TEAMSIZE >= 2
3917 else if(gPlayerTeamSelection[playerid] == SECOND_TEAM) {
3918 SetPlayerInterior(playerid,TEAM_TWO_SEL_INTERIOR);
3919 SetPlayerWeather(playerid,15);
3920 SetPlayerCameraPos(playerid,ClassSel_SetupTeamTEAM_POS[1][0],ClassSel_SetupTeamTEAM_POS[1][1],ClassSel_SetupTeamTEAM_POS[1][2]);
3921 SetPlayerCameraLookAt(playerid,ClassSel_SetupTeamTEAM_LOOK_AT[1][0],ClassSel_SetupTeamTEAM_LOOK_AT[1][1],ClassSel_SetupTeamTEAM_LOOK_AT[1][2]);
3922 new astring[64];
3923 PlayerTextDrawHide(playerid,TeamText[playerid]);
3924 PlayerTextDrawHide(playerid,LocText[playerid]);
3925 PlayerTextDrawSetString(playerid, TeamText[playerid],SECOND_TEAM_NAME_TAG);
3926 PlayerTextDrawColor(playerid,TeamText[playerid],COLOR_TEAM_TWO_TD);
3927 PlayerTextDrawShow(playerid,TeamText[playerid]);
3928 format(astring,sizeof(astring),"Location:"#SECOND_TEAM_LOCATION);
3929 PlayerTextDrawSetString(playerid, LocText[playerid], astring);
3930 PlayerTextDrawShow(playerid,LocText[playerid]);
3931 PlayerPlaySound(playerid,2402,0,0,0);
3932
3933 }
3934 #endif
3935 #endif
3936 #if defined TEAMSIZE
3937 #if TEAMSIZE >= 3
3938 else if(gPlayerTeamSelection[playerid] == THIRD_TEAM) {
3939 SetPlayerInterior(playerid,TEAM_THREE_SEL_INTERIOR);
3940 SetPlayerCameraPos(playerid,ClassSel_SetupTeamTEAM_POS[2][0],ClassSel_SetupTeamTEAM_POS[2][1],ClassSel_SetupTeamTEAM_POS[2][2]);
3941 SetPlayerCameraLookAt(playerid,ClassSel_SetupTeamTEAM_LOOK_AT[2][0],ClassSel_SetupTeamTEAM_LOOK_AT[2][1],ClassSel_SetupTeamTEAM_LOOK_AT[2][2]);
3942 new astring[64];
3943 PlayerTextDrawHide(playerid,TeamText[playerid]);
3944 PlayerTextDrawHide(playerid,LocText[playerid]);
3945 PlayerTextDrawSetString(playerid, TeamText[playerid],THIRD_TEAM_NAME_TAG);
3946 PlayerTextDrawColor(playerid,TeamText[playerid],COLOR_TEAM_THREE_TD);
3947 PlayerTextDrawShow(playerid,TeamText[playerid]);
3948 format(astring,sizeof(astring),"Location:"#THIRD_TEAM_LOCATION);
3949 PlayerTextDrawSetString(playerid, LocText[playerid], astring);
3950 PlayerTextDrawShow(playerid,LocText[playerid]);
3951 PlayerPlaySound(playerid,2404,0,0,0);
3952
3953 }
3954 #endif
3955 #endif
3956 #if defined TEAMSIZE
3957 #if TEAMSIZE >= 4
3958 else if(gPlayerTeamSelection[playerid] == FOURTH_TEAM) {
3959 SetPlayerInterior(playerid,TEAM_FOUR_SEL_INTERIOR);
3960 SetPlayerCameraPos(playerid,ClassSel_SetupTeamTEAM_POS[3][0],ClassSel_SetupTeamTEAM_POS[3][1],ClassSel_SetupTeamTEAM_POS[3][2]);
3961 SetPlayerCameraLookAt(playerid,ClassSel_SetupTeamTEAM_LOOK_AT[3][0],ClassSel_SetupTeamTEAM_LOOK_AT[3][1],ClassSel_SetupTeamTEAM_LOOK_AT[3][2]);
3962 new astring[64];
3963 PlayerTextDrawHide(playerid,TeamText[playerid]);
3964 PlayerTextDrawHide(playerid,LocText[playerid]);
3965 PlayerTextDrawSetString(playerid, TeamText[playerid],FOURTH_TEAM_NAME_TAG);
3966 PlayerTextDrawColor(playerid,TeamText[playerid],COLOR_TEAM_FOUR_TD);
3967 PlayerTextDrawShow(playerid,TeamText[playerid]);
3968 format(astring,sizeof(astring),"Location:"#FOURTH_TEAM_LOCATION);
3969 PlayerTextDrawSetString(playerid, LocText[playerid], astring);
3970 PlayerTextDrawShow(playerid,LocText[playerid]);
3971 SetPlayerWeather(playerid,0);
3972 PlayerPlaySound(playerid,2404,0,0,0);
3973
3974 }
3975 #endif
3976 #endif
3977 #if defined TEAMSIZE
3978 #if TEAMSIZE >= 5
3979 else if(gPlayerTeamSelection[playerid] == FIFTH_TEAM) {
3980 SetPlayerInterior(playerid,TEAM_FIVE_SEL_INTERIOR);
3981 SetPlayerCameraPos(playerid,ClassSel_SetupTeamTEAM_POS[4][0],ClassSel_SetupTeamTEAM_POS[4][1],ClassSel_SetupTeamTEAM_POS[4][2]);
3982 SetPlayerCameraLookAt(playerid,ClassSel_SetupTeamTEAM_LOOK_AT[4][0],ClassSel_SetupTeamTEAM_LOOK_AT[4][1],ClassSel_SetupTeamTEAM_LOOK_AT[4][2]);
3983 new astring[64];
3984 PlayerTextDrawHide(playerid,TeamText[playerid]);
3985 PlayerTextDrawHide(playerid,LocText[playerid]);
3986 PlayerTextDrawSetString(playerid, TeamText[playerid],FIFTH_TEAM_NAME_TAG);
3987 PlayerTextDrawColor(playerid,TeamText[playerid],COLOR_TEAM_FIVE_TD);
3988 PlayerTextDrawShow(playerid,TeamText[playerid]);
3989 format(astring,sizeof(astring),"Location:"#FIFTH_TEAM_LOCATION);
3990 PlayerTextDrawSetString(playerid, LocText[playerid], astring);
3991 PlayerTextDrawShow(playerid,LocText[playerid]);
3992
3993 SetPlayerWeather(playerid,0);
3994 PlayerPlaySound(playerid,2404,0,0,0);
3995
3996 }
3997 #endif
3998 #endif
3999 #if defined TEAMSIZE
4000 #if TEAMSIZE == 6
4001 else if(gPlayerTeamSelection[playerid] == SIXTH_TEAM) {
4002 SetPlayerInterior(playerid,TEAM_SIX_SEL_INTERIOR);
4003 SetPlayerCameraPos(playerid,ClassSel_SetupTeamTEAM_POS[5][0],ClassSel_SetupTeamTEAM_POS[5][1],ClassSel_SetupTeamTEAM_POS[5][2]);
4004 SetPlayerCameraLookAt(playerid,ClassSel_SetupTeamTEAM_LOOK_AT[5][0],ClassSel_SetupTeamTEAM_LOOK_AT[5][1],ClassSel_SetupTeamTEAM_LOOK_AT[5][2]);
4005 new astring[64];
4006 PlayerTextDrawHide(playerid,TeamText[playerid]);
4007 PlayerTextDrawHide(playerid,LocText[playerid]);
4008 PlayerTextDrawSetString(playerid, TeamText[playerid],SIXTH_TEAM_NAME_TAG);
4009 PlayerTextDrawColor(playerid,TeamText[playerid],COLOR_TEAM_SIX_TD);
4010 PlayerTextDrawShow(playerid,TeamText[playerid]);
4011 format(astring,sizeof(astring),"Location:"#SIXTH_TEAM_LOCATION);
4012 PlayerTextDrawSetString(playerid, LocText[playerid], astring);
4013 PlayerTextDrawShow(playerid,LocText[playerid]);
4014 PlayerPlaySound(playerid,2404,0,0,0);
4015
4016 }
4017 #endif
4018 #endif
4019}
4020
4021//----------------------------------------------------------
4022public BlowUpThisBed()
4023{
4024 CreateExplosion(x1, y1, z1, 7, 10.0);//'heavy' explosion close to bed
4025 CreateExplosion(x1, y1, z1, 9, 10.0);
4026 running=0;
4027 printf("Blow Up This Bed called");
4028 if(BED_STATE_TEAM_ONE == -1)
4029 {
4030 BED_STATE_TEAM_ONE = -2;
4031 SendTeamMessage(FIRST_TEAM,COLOR_WHITE,"SERVER: Sudden death! Keep running, your bed has been blown up! There is no respawn after death!");
4032 new adstring[64];
4033 format(adstring,sizeof(adstring),"SERVER: The bed of team %s {FFFFFF}blew up!",FIRST_TEAM_COLOR_TAG);
4034 SendClientMessageToAll(-1,adstring);
4035 GangZoneHideForAll(TEAM_ZONE_ONE);
4036 printf("Violet");
4037
4038 }
4039 if(BED_STATE_TEAM_TWO == -1)
4040 {
4041 BED_STATE_TEAM_TWO = -2;
4042 SendTeamMessage(SECOND_TEAM,COLOR_WHITE,"SERVER: Sudden death! Keep running, your bed has been blown up! There is no respawn after death!");
4043 new adstring[64];
4044 format(adstring,sizeof(adstring),"SERVER: The bed of team %s {FFFFFF}blew up!",SECOND_TEAM_COLOR_TAG);
4045 SendClientMessageToAll(-1,adstring);
4046 GangZoneHideForAll(TEAM_ZONE_TWO);
4047 }
4048 #if defined TEAMSIZE
4049 #if TEAMSIZE >= 3
4050 if(BED_STATE_TEAM_THREE == -1)
4051 {
4052 BED_STATE_TEAM_THREE = -2;
4053 SendTeamMessage(THIRD_TEAM,COLOR_WHITE,"SERVER: Sudden death! Keep running, your bed has been blown up! There is no respawn after death!");
4054 new adstring[64];
4055 format(adstring,sizeof(adstring),"SERVER: The bed of team %s {FFFFFF}blew up!",THIRD_TEAM_COLOR_TAG);
4056 SendClientMessageToAll(-1,adstring);
4057 GangZoneHideForAll(TEAM_ZONE_THREE);
4058 }
4059 #endif
4060 #endif
4061 #if defined TEAMSIZE
4062 #if TEAMSIZE >= 4
4063 if(BED_STATE_TEAM_FOUR == -1)
4064 {
4065 BED_STATE_TEAM_FOUR = -2;
4066 SendTeamMessage(FOURTH_TEAM,COLOR_WHITE,"SERVER: Sudden death! Keep running, your bed has been blown up! There is no respawn after death!");
4067 new adstring[64];
4068 format(adstring,sizeof(adstring),"SERVER: The bed of team %s {FFFFFF}blew up!",FOURTH_TEAM_COLOR_TAG);
4069 SendClientMessageToAll(-1,adstring);
4070 GangZoneHideForAll(TEAM_ZONE_FOUR);
4071
4072 }
4073 #endif
4074 #endif
4075 #if defined TEAMSIZE
4076 #if TEAMSIZE >= 5
4077 if(BED_STATE_TEAM_FIVE == -1)
4078 {
4079 BED_STATE_TEAM_FIVE = -2;
4080 SendTeamMessage(FIFTH_TEAM,COLOR_WHITE,"SERVER: Sudden death! Keep running, your bed has been blown up! There is no respawn after death!");
4081 new adstring[64];
4082 format(adstring,sizeof(adstring),"SERVER: The bed of team %s {FFFFFF}blew up!",FIFTH_TEAM_COLOR_TAG);
4083 SendClientMessageToAll(-1,adstring);
4084 GangZoneHideForAll(TEAM_ZONE_FIVE);
4085 }
4086 #endif
4087 #endif
4088 #if defined TEAMSIZE
4089 #if TEAMSIZE == 6
4090 if(BED_STATE_TEAM_SIX == -1)
4091 {
4092 BED_STATE_TEAM_SIX = -2;
4093 SendTeamMessage(SIXTH_TEAM,COLOR_WHITE,"SERVER: Sudden death! Keep running, your bed has been blown up! There is no respawn after death!");
4094 new adstring[64];
4095 format(adstring,sizeof(adstring),"SERVER: The bed of team %s {FFFFFF}blew up!",SIXTH_TEAM_COLOR_TAG);
4096 SendClientMessageToAll(-1,adstring);
4097 GangZoneHideForAll(TEAM_ZONE_SIX);
4098 }
4099 #endif
4100 #endif
4101}
4102stock GetVehicleDriver(vid)
4103{
4104 for(new i; i < GetMaxPlayers(); i++)
4105 {
4106 if(!IsPlayerConnected(i)) continue;
4107 if(GetPlayerVehicleID(i) == vid && GetPlayerSeat(playerid) == 0) return i;
4108 }
4109 return INVALID_PLAYER_ID;
4110}
4111stock RespawnAllVehicles()
4112{
4113 for(new i = GetVehiclePoolSize(); i > 0; i--)
4114 {
4115 if(GetVehicleDriver(i) != INVALID_PLAYER_ID) continue;
4116 SetVehicleToRespawn(i);
4117 }
4118}
4119stock GetPlayerCount()
4120{
4121 new counter=0;
4122 for(new k;k<MAX_PLAYERS;k++)
4123 {
4124 if(!IsPlayerConnected(k) || IsPlayerNPC(k)) continue;
4125
4126 counter++;
4127 }
4128 return counter;
4129}
4130
4131public OnPlayerStateChange(playerid, newstate, oldstate)
4132{
4133 if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
4134 {
4135 if(IsBeingSpeced[playerid] == 1)
4136 {
4137 for(new i;i<MAX_PLAYERS;i++)
4138 {
4139 if(spectatorid[i] == playerid)
4140 {
4141 PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
4142 }
4143 }
4144 }
4145 }
4146 if(newstate == PLAYER_STATE_ONFOOT)
4147 {
4148 if(IsBeingSpeced[playerid] == 1)
4149 {
4150 for(new i;i<MAX_PLAYERS;i++)
4151 {
4152 if(spectatorid[i] == playerid)
4153 {
4154 PlayerSpectatePlayer(i, playerid);
4155 }
4156 }
4157 }
4158 }
4159 return 1;
4160}
4161public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
4162{
4163 if(IsBeingSpeced[playerid] == 1)
4164 {
4165 for(new i;i<MAX_PLAYERS;i++)
4166 {
4167 if(spectatorid[i] == playerid)
4168 {
4169 SetPlayerInterior(i,GetPlayerInterior(playerid));
4170 SetPlayerVirtualWorld(i,GetPlayerVirtualWorld(playerid));
4171 }
4172 }
4173 }
4174 return 1;
4175}
4176
4177public OnPlayerSpawn(playerid)
4178{
4179 if(IsSpecing[playerid] == 1)
4180 {
4181 SetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
4182 SetPlayerInterior(playerid,Inter[playerid]);
4183 SetPlayerVirtualWorld(playerid,vWorld[playerid]);
4184 IsSpecing[playerid] = 0;
4185 IsBeingSpeced[spectatorid[playerid]] = 0;
4186 }
4187 if(IsPlayerNPC(playerid)) return 1;
4188 if(IsSpecing[playerid] == 1) return 1;
4189 if(gPlayerTeamSelection[playerid] == TEAM_SPECTATOR) return 1;
4190
4191 TextDrawShowForPlayer(playerid,txtTimeDisp);
4192 PlayerPlaySound(playerid,1188,0,0,0);
4193 SetPlayerWorldBounds(playerid,MAP_WORLDBOUNDS[0][0], MAP_WORLDBOUNDS[0][1], MAP_WORLDBOUNDS[0][2], MAP_WORLDBOUNDS[0][3]);
4194
4195 new randSpawn = 0;
4196
4197
4198 SetPlayerVirtualWorld(playerid,0);
4199 TogglePlayerClock(playerid,0);
4200 ResetPlayerMoney(playerid);
4201
4202 switch(gPlayerTeamSelection[playerid])
4203 {
4204 case FIRST_TEAM:
4205 {
4206 randSpawn = random(sizeof(gSpawnsTeam_TEAM_ONE));
4207 SetPlayerPos(playerid,gSpawnsTeam_TEAM_ONE[randSpawn][0],gSpawnsTeam_TEAM_ONE[randSpawn][1],gSpawnsTeam_TEAM_ONE[randSpawn][2]);
4208 SetPlayerFacingAngle(playerid,gSpawnsTeam_TEAM_ONE[randSpawn][3]);
4209 }
4210 #if defined TEAMSIZE
4211 #if TEAMSIZE >= 2
4212 case SECOND_TEAM:
4213 {
4214 randSpawn = random(sizeof(gSpawnsTeam_TEAM_TWO));
4215 SetPlayerPos(playerid,
4216 gSpawnsTeam_TEAM_TWO[randSpawn][0],
4217 gSpawnsTeam_TEAM_TWO[randSpawn][1],
4218 gSpawnsTeam_TEAM_TWO[randSpawn][2]);
4219 SetPlayerFacingAngle(playerid,gSpawnsTeam_TEAM_TWO[randSpawn][3]);
4220 }
4221 #endif
4222 #endif
4223 #if defined TEAMSIZE
4224 #if TEAMSIZE >= 3
4225 case THIRD_TEAM:
4226 {
4227 randSpawn = random(sizeof(gSpawnsTeam_TEAM_THREE));
4228 SetPlayerPos(playerid,
4229 gSpawnsTeam_TEAM_THREE[randSpawn][0],
4230 gSpawnsTeam_TEAM_THREE[randSpawn][1],
4231 gSpawnsTeam_TEAM_THREE[randSpawn][2]);
4232 SetPlayerFacingAngle(playerid,gSpawnsTeam_TEAM_THREE[randSpawn][3]);
4233 }
4234 #endif
4235 #endif
4236 #if defined TEAMSIZE
4237 #if TEAMSIZE >= 4
4238 case FOURTH_TEAM:
4239 {
4240 randSpawn = random(sizeof(gSpawnsTeam_TEAM_FOUR));
4241 SetPlayerPos(playerid,
4242 gSpawnsTeam_TEAM_FOUR[randSpawn][0],
4243 gSpawnsTeam_TEAM_FOUR[randSpawn][1],
4244 gSpawnsTeam_TEAM_FOUR[randSpawn][2]);
4245 SetPlayerFacingAngle(playerid,gSpawnsTeam_TEAM_FOUR[randSpawn][3]);
4246 }
4247 #endif
4248 #endif
4249 #if defined TEAMSIZE
4250 #if TEAMSIZE >= 5
4251 case FIFTH_TEAM:
4252 {
4253 randSpawn = random(sizeof(gSpawnsTeam_TEAM_FIVE));
4254 SetPlayerPos(playerid,
4255 gSpawnsTeam_TEAM_FIVE[randSpawn][0],
4256 gSpawnsTeam_TEAM_FIVE[randSpawn][1],
4257 gSpawnsTeam_TEAM_FIVE[randSpawn][2]);
4258 SetPlayerFacingAngle(playerid,gSpawnsTeam_TEAM_FIVE[randSpawn][3]);
4259 }
4260 #endif
4261 #endif
4262 #if defined TEAMSIZE
4263 #if TEAMSIZE == 6
4264 case SIXTH_TEAM:
4265 {
4266 randSpawn = random(sizeof(gSpawnsTeam_TEAM_SIX));
4267 SetPlayerPos(playerid,
4268 gSpawnsTeam_TEAM_SIX[randSpawn][0],
4269 gSpawnsTeam_TEAM_SIX[randSpawn][1],
4270 gSpawnsTeam_TEAM_SIX[randSpawn][2]);
4271 SetPlayerFacingAngle(playerid,gSpawnsTeam_TEAM_SIX[randSpawn][3]);
4272 }
4273 #endif
4274 #endif
4275 }
4276
4277
4278 GangZoneShowForPlayer(playerid, TEAM_ZONE_ONE, COLOR_TEAM_ONE);
4279 GangZoneShowForPlayer(playerid, TEAM_ZONE_TWO, COLOR_TEAM_TWO);
4280 #if defined TEAMSIZE
4281 #if TEAMSIZE >= 3
4282 GangZoneShowForPlayer(playerid, TEAM_ZONE_THREE, COLOR_TEAM_THREE);
4283 #endif
4284 #endif
4285 #if defined TEAMSIZE
4286 #if TEAMSIZE >= 4
4287 GangZoneShowForPlayer(playerid, TEAM_ZONE_FOUR, COLOR_TEAM_FOUR);
4288 #endif
4289 #endif
4290 #if defined TEAMSIZE
4291 #if TEAMSIZE >= 5
4292 GangZoneShowForPlayer(playerid, TEAM_ZONE_FIVE, COLOR_TEAM_FIVE);
4293 #endif
4294 #endif
4295 #if defined TEAMSIZE
4296 #if TEAMSIZE == 6
4297 GangZoneShowForPlayer(playerid, TEAM_ZONE_SIX, COLOR_TEAM_SIX);
4298 #endif
4299 #endif
4300
4301
4302 SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,100);
4303 SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,100);
4304 SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,100);
4305 SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,100);
4306 SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,100);
4307 SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,100);
4308 SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,100);
4309 SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,100);
4310 SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,100);
4311 SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,100);
4312 SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,100);
4313
4314 GivePlayerWeapon(playerid,WEAPON_COLT45,100);
4315 GivePlayerWeapon(playerid,25,5);
4316
4317 switch(gPlayerTeamSelection[playerid])
4318 {
4319 case FIRST_TEAM:
4320 {
4321 SetPlayerInterior(playerid,TEAM_ONE_INTERIOR);
4322 }
4323 case SECOND_TEAM:
4324 {
4325 SetPlayerInterior(playerid,TEAM_TWO_INTERIOR);
4326 }
4327 #if defined TEAMSIZE
4328 #if TEAMSIZE >= 3
4329 case THIRD_TEAM:
4330 {
4331 SetPlayerInterior(playerid,TEAM_THREE_INTERIOR);
4332 }
4333 #endif
4334 #endif
4335 #if defined TEAMSIZE
4336 #if TEAMSIZE >= 4
4337 case FOURTH_TEAM:
4338 {
4339 SetPlayerInterior(playerid,TEAM_FOUR_INTERIOR);
4340 }
4341 #endif
4342 #endif
4343 #if defined TEAMSIZE
4344 #if TEAMSIZE >= 5
4345 case FIFTH_TEAM:
4346 {
4347 SetPlayerInterior(playerid,TEAM_FIVE_INTERIOR);
4348 }
4349 #endif
4350 #endif
4351 #if defined TEAMSIZE
4352 #if TEAMSIZE >= 6
4353 case SIXTH_TEAM:
4354 {
4355 SetPlayerInterior(playerid,TEAM_SIX_INTERIOR);
4356 }
4357 #endif
4358 #endif
4359 default:
4360 {
4361 printf("Something went wrong..");
4362 TextDrawHideForPlayer(playerid,txtSpectatorHelper);
4363 }
4364 }
4365
4366
4367 return 1;
4368}
4369
4370public TEAM_MONEY()//MONEY FOR EACH TEAM
4371{
4372 for (new m=0;m<sizeof(MoneySpawns)-1;m++)
4373 {
4374 GenerateRandomPickup(1212,19,MoneySpawns[m][0],MoneySpawns[m][1],MoneySpawns[m][2],MoneySpawns[m][3],MoneySpawns[m][4],MoneySpawns[m][5],0);
4375 }
4376
4377}
4378
4379//----------------------------------------------------------
4380
4381
4382public MONEY_MAIN()//MAIN
4383{
4384
4385 GenerateRandomPickup(1212,19,MoneySpawns[sizeof(MoneySpawns)-1][0],MoneySpawns[sizeof(MoneySpawns)-1][1],MoneySpawns[sizeof(MoneySpawns)-1][2],MoneySpawns[sizeof(MoneySpawns)-1][3],MoneySpawns[sizeof(MoneySpawns)-1][4],MoneySpawns[sizeof(MoneySpawns)-1][5],0);
4386}
4387
4388
4389stock ResetPlayerData(playerid)
4390{
4391 IsSpecing[playerid]=0;
4392 IsBeingSpeced[playerid]=0;
4393 PStealth[playerid]=0;
4394 Warppowder[playerid]=0;
4395 Helmet[playerid]=0;
4396 PBombID[playerid]=0;
4397 PBomb[playerid]=0;
4398 PSkill[playerid]=0;
4399 WarpVar[playerid]=4;
4400 if(IsValidObject(BombObject[playerid]))
4401 DestroyObject(BombObject[playerid]);
4402 pZ[playerid]=0;
4403 pY[playerid]=0;
4404 pZ[playerid]=0;
4405 if(IsValidObject(Beam[playerid]))
4406 DestroyObject(Beam[playerid]);
4407 SetPlayerFightingStyle(playerid,FIGHT_STYLE_NORMAL);
4408}
4409
4410stock CreateGlobalActor(actorid,modelid,Float:ax,Float:ay,Float:az,Float:angle,Float:distance,pickupid)
4411{
4412 actorid = CreateActor(modelid,ax,ay,az,angle);
4413 new Float:x, Float:y, Float:z;
4414
4415 GetActorPos(actorid, x, y, z);
4416 GetXYInFrontOfActor(actorid, x, y, distance);
4417 ActorPickups[pickupid] = CreatePickup(1210,2,x,y,z,-1);
4418 SetActorInvulnerable(actorid, true);
4419 printf("Actor created, pickupid %d",pickupid);
4420 printf("Array pickupid %d",ActorPickups[Shop_Counter++]);
4421 return pickupid;
4422}
4423
4424stock GetXYInFrontOfActor(actorid, &Float:x, &Float:y, Float:distance)
4425{
4426 new Float:a;
4427 GetActorPos(actorid, x, y, a);
4428 GetActorFacingAngle(actorid, a);
4429 x += (distance * floatsin(-a, degrees));
4430 y += (distance * floatcos(-a, degrees));
4431}
4432
4433stock GivePlayerMoneyText(playerid,value)
4434{
4435 new moneyplayerid[32];
4436 if(value < 0)
4437 format(moneyplayerid,sizeof(moneyplayerid), "~r~ %d~y~$",value);
4438 if(value >= 0)
4439 format(moneyplayerid,sizeof(moneyplayerid), "~g~ %d~y~$",value);
4440 GameTextForPlayer(playerid,moneyplayerid,1000,1);
4441 GivePlayerMoney(playerid,value);
4442}
4443ClassSel_InitTextDraws()
4444{
4445
4446 // Init our observer helper text display
4447 txtClassSelHelper = TextDrawCreate(10.0, 415.0,
4448 " Press ~b~~k~~GO_LEFT~ ~w~or ~b~~k~~GO_RIGHT~ ~w~to switch teams.~n~ Press ~y~~k~~PED_FIREWEAPON~ ~y~to select.");
4449 TextDrawUseBox(txtClassSelHelper, 1);
4450 TextDrawBoxColor(txtClassSelHelper,0x22222266);
4451 TextDrawLetterSize(txtClassSelHelper,0.3,1.0);
4452 TextDrawTextSize(txtClassSelHelper,400.0,40.0);
4453 TextDrawFont(txtClassSelHelper, 2);
4454 TextDrawSetShadow(txtClassSelHelper,0);
4455 TextDrawSetOutline(txtClassSelHelper,1);
4456 TextDrawBackgroundColor(txtClassSelHelper,0x000000FF);
4457 TextDrawColor(txtClassSelHelper,0xFFFFFFFF);
4458
4459
4460}