Advertisement
Knogle

Last Bed Standing - Fork of Minecraft Bedwars 0.1b

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