Advertisement
Knogle

Last Bed Standing - Fork of Minecraft Bedwars 0.1.3

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