Advertisement
YashasSamaga

Untitled

Aug 8th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.49 KB | None | 0 0
  1. #define BONUS_ZONE_UPDATE_INTERVAL 600
  2. #define REACTION_TEST_UPDATE_INTERVAL 300
  3. #define TEMP_BANS_UPDATE_INTERVAL 60
  4. #define WEATHER_CHANGE_UPDATE_INTERVAL 600
  5. #define RANDOM_MSG_UPDATE_INTERVAL 180
  6. #define SUPPLY_DROP_INTERVAL 300
  7.  
  8. #define DEBUG(%0) printf(%0) //Comment this and uncomment the next line to stop the debug messages
  9. //#define DEBUG(%0)
  10.  
  11.  
  12. new Seconds = 0;
  13. main ()
  14. {
  15. TestTimer = 60; //Make a reaction test after 60 seconds after server startup
  16. StaticTimerEx[bonuszone] = 60; //Make a BZone after 60 seconds after server startup
  17. SetTimer("ServerTimer",1000,true);
  18. SetTimer("ServerTimer_10",10000,true);
  19. }
  20.  
  21. ResetPlayer(playerid)
  22. {
  23. new tmp = PlayerInfo[playerid][Zone];
  24. if(tmp != -1)
  25. {
  26. if(playerid == ZoneInfo[tmp][zone_Attacker])
  27. {
  28. ZoneInfo[tmp][zone_Timer] = -1;
  29. ZoneInfo[tmp][UnderAttack] = false;
  30. ZoneInfo[tmp][zone_Attacker] = -1;
  31. GangZoneStopFlashForAll(ZoneInfo[tmp][zone_Zone]);
  32. PlayerInfo[playerid][Zone] = -1;
  33. }
  34. else ZoneInfo[tmp][zone_Attackers]--, PlayerInfo[playerid][Zone] = -1;
  35. }
  36.  
  37. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  38.  
  39. if(C4[playerid] != -1) DestroyDynamicObject(C4[playerid]);
  40.  
  41. Delete3DTextLabel(PlayerInfo[playerid][Lab]);
  42. TextDrawDestroy(StatsTD[playerid]);
  43. TextDrawDestroy(InfoTD[playerid]);
  44. DestroyCarePackage(playerid);
  45.  
  46. for(new s = 0; s < _:timer_info; s++) TimerEx[playerid][timer_info:s] = -1;
  47.  
  48. PlayerInfo[playerid][Score] = 0;
  49. PlayerInfo[playerid][Money] = 0;
  50. PlayerInfo[playerid][Kills] = 0;
  51. PlayerInfo[playerid][Deaths] = 0;
  52. PlayerInfo[playerid][Admin] = 0;
  53. PlayerInfo[playerid][VIP] = 0;
  54. PlayerInfo[playerid][License] = 0;
  55. PlayerInfo[playerid][Clan] = -1;
  56. PlayerInfo[playerid][ClanRank] = 0;
  57. PlayerInfo[playerid][DM] = MODE_DEFAULT;
  58. PlayerInfo[playerid][HQ] = -1;
  59. PlayerInfo[playerid][AFK] = 0;
  60. PlayerInfo[playerid][Tank] = -1;
  61. PlayerInfo[playerid][Team] = 0;
  62. PlayerInfo[playerid][Spawn] = -1;
  63. PlayerInfo[playerid][Class] = 0;
  64. PlayerInfo[playerid][Zone] = -1;
  65. PlayerInfo[playerid][Base] = -1;
  66. PlayerInfo[playerid][Rank] = 0;
  67. PlayerInfo[playerid][Warns][0] = 0;
  68. PlayerInfo[playerid][Warns][1] = 0;
  69. PlayerInfo[playerid][Warns][2] = 0;
  70. PlayerInfo[playerid][Warns][3] = 0;
  71. PlayerInfo[playerid][Bounty] = 0;
  72. PlayerInfo[playerid][Vehicle] = -1;
  73. PlayerInfo[playerid][Muted] = -1;
  74. PlayerInfo[playerid][Frozen] = -1;
  75. PlayerInfo[playerid][Jailed] = -1;
  76. PlayerInfo[playerid][Drone] = -1;
  77. PlayerInfo[playerid][Medkit] = 0;
  78. PlayerInfo[playerid][Activity] = 0;
  79. PlayerInfo[playerid][Attempts] = 0;
  80. PlayerInfo[playerid][CInvited] = -1;
  81. PlayerInfo[playerid][OldAdmin] = -1;
  82. PlayerInfo[playerid][Disguised] = -1;
  83. PlayerInfo[playerid][Spectating] = -1;
  84. PlayerInfo[playerid][Lab] = Text3D:INVALID_3DTEXT_ID;
  85. PlayerInfo[playerid][CP] = false;
  86. PlayerInfo[playerid][CW] = false;
  87. PlayerInfo[playerid][SID] = false;
  88. PlayerInfo[playerid][Hacker] = false;
  89. PlayerInfo[playerid][Helmet] = false;
  90. PlayerInfo[playerid][Spec] = false;
  91. PlayerInfo[playerid][Duty] = false;
  92. PlayerInfo[playerid][Logged] = false;
  93. PlayerInfo[playerid][Proccess] = false;
  94. Prestige[playerid][0] = 0, Prestige[playerid][1] = 0;
  95. Prestige[playerid][2] = 0, Prestige[playerid][3] = 0;
  96. Prestige[playerid][4] = 0, Prestige[playerid][5] = 0;
  97. Duel[playerid][duel_opponent] = -1, Duel[playerid][duel_weapon] = -1;
  98. Duel[playerid][duel_bet] = -1, Duel[playerid][duel_invited] = -1;
  99. KillSpree[playerid] = 0;
  100. DeathSpree[playerid] = 0;
  101. ZoneSpree[playerid] = 0;
  102. WarpTime[playerid] = 0;
  103. WarpVehID[playerid] = -1;
  104. StateTime[playerid] = -1;
  105. StateWarn[playerid] = 0;
  106. C4[playerid] = -1;
  107. C4Owned[playerid] = false;
  108. DND[playerid] = false;
  109. Hidden[playerid] = false;
  110. banned[playerid] = false;
  111. conns[playerid] = false;
  112. PingWarns[playerid] = 0;
  113. FailPass[playerid] = 0;
  114. LastDeath[playerid] = -1;
  115. DeathSpam[playerid] = 0;
  116. LastPM[playerid] = -1;
  117. StatsTD[playerid] = Text:INVALID_TEXT_DRAW;
  118. PlayerInfo[playerid][Connected] = false;
  119. return 1;
  120. }
  121.  
  122. forward ServerTimer();
  123. forward ServerTimer_10();
  124.  
  125. public ServerTimer_10()
  126. {
  127. //These do not rely on Seconds - so no problem in having them in 10 second timer
  128. static strtd[160];
  129. if(Weap)
  130. {
  131. for(new a = 0; a < MAX_OBJ; a++)
  132. {
  133. if(GroundWeapon[a][ObjRespawn] == -1) continue;
  134. if(Seconds == GroundWeapon[a][ObjRespawn]) continue;
  135. DestroyDynamicObject(GroundWeapon[a][ObjID]);
  136. GroundWeapon[a][ObjID] = -1;
  137. GroundWeapon[a][ObjWeaponID] = -1;
  138. GroundWeapon[a][ObjAmmo] = 0;
  139. GroundWeapon[a][ObjPosX] = 0.0;
  140. GroundWeapon[a][ObjPosY] = 0.0;
  141. GroundWeapon[a][ObjPosZ] = 0.0;
  142. GroundWeapon[a][ObjRespawn] = -1;
  143. }
  144. }
  145. for(new x = 0; x < sizeof(Antenna); x++)
  146. {
  147. if(Antenna[x][antenna_Spawn] == -1) continue;
  148. if(Seconds == Antenna[x][antenna_Spawn]) continue;
  149. DestroyObject(Antenna[x][antenna_Smoke]);
  150. Antenna[x][antenna_HP] = 100;
  151. Antenna[x][antenna_Destroyed] = false;
  152. Antenna[x][antenna_Spawn] = -1;
  153. format(strtd,sizeof(strtd), "Antenna(%d)\n%d hp", x, Antenna[x][antenna_HP]);
  154. Update3DTextLabelText(Antenna[x][antenna_Label], 0x009DFFFF, strtd);
  155. }
  156. }
  157.  
  158. public ServerTimer()
  159. {
  160. static strtd[160];
  161. Seconds++;
  162.  
  163. if(Seconds == TestTimer)
  164. {
  165. //TestTimer = Seconds = 300;
  166. TestTimer += REACTION_TEST_UPDATE_INTERVAL; //Will work since Seconds == TestTimer
  167.  
  168. switch((TestOn = !TestOn))
  169. {
  170. case false:
  171. {
  172. SendClientMessageToAll(WEAK_GREEN, "Nobody won the reaction test.");
  173. //TestChars = "";
  174. }
  175. case true:
  176. {
  177. new Length = (random(8)+2);
  178. for(new x = 0; x != Length; x++) TestChars[x] = Characters[random(sizeof(Characters))];
  179. TestChars[Length] = 0;
  180. format(strtd, sizeof(strtd), "REACTION TEST! Write '%s' to win rewards.", TestChars);
  181. SendClientMessageToAll(WEAK_GREEN, strtd);
  182. }
  183. }
  184. }
  185.  
  186. if(Seconds == StaticTimerEx[bonuszone])
  187. {
  188. for(new x=0; x < sizeof(ZoneInfo); x++) ZoneInfo[x][BonusZone] = false;
  189. new bonus_zone_id = random(sizeof(ZoneInfo)-1);
  190.  
  191. format(strtd,sizeof(strtd), "* Zone %s is now a bonus zone! Capture it for extra rewards!", ZoneInfo[bonus_zone_id][zone_Name]);
  192. SendClientMessageToAll(WEAK_GREEN, strtd);
  193. ZoneInfo[bonus_zone_id][zone_Owner] = TEAM_NONE;
  194. ZoneInfo[bonus_zone_id][zone_Timer] =
  195. ZoneInfo[bonus_zone_id][zone_Attacker] = -1;
  196. ZoneInfo[bonus_zone_id][zone_Attackers] = 0;
  197. ZoneInfo[bonus_zone_id][UnderAttack] = false;
  198. ZoneInfo[bonus_zone_id][BonusZone] = true;
  199. GangZoneStopFlashForAll(bonus_zone_id);
  200. GangZoneHideForAll(bonus_zone_id); // Assumption made
  201. GangZoneShowForAll(bonus_zone_id, 0xFFFFFFAA); //Assumption Made
  202.  
  203. StaticTimerEx[bonuszone] += BONUS_ZONE_UPDATE_INTERVAL;
  204. }
  205.  
  206. if(Seconds == StaticTimerEx[removetempbans])
  207. {
  208. RemoveTBans();
  209. StaticTimerEx[removetempbans] += TEMP_BANS_UPDATE_INTERVAL;
  210. }
  211.  
  212. if(Seconds == StaticTimerEx[lastnuke])
  213. {
  214. StaticTimerEx[lastnuke] = -1;
  215. SendClientMessageToAll(ORANGE, "*** Nuclear weapons are ready for usage.");
  216. }
  217.  
  218. if(Seconds == StaticTimerEx[lastsam])
  219. {
  220. StaticTimerEx[lastsam] = -1;
  221. SendClientMessageToAll(ORANGE, "*** Surface-to-air missiles (SAMs) are ready for usage.");
  222. }
  223.  
  224. if(Seconds == StaticTimerEx[timeweatherchange])
  225. {
  226. if(++ServerTime == 25) ServerTime = 0;
  227. ServerWeather = random(8);
  228. SetWeather(ServerWeather);
  229. SetWorldTime(ServerTime);
  230. StaticTimerEx[timeweatherchange] += WEATHER_CHANGE_UPDATE_INTERVAL;
  231. }
  232.  
  233. if(Seconds == StaticTimerEx[lastmsg])
  234. {
  235. SendClientMessageToAll(PINK, RandomMSG[random(sizeof(RandomMSG))]);
  236. StaticTimerEx[lastmsg] += RANDOM_MSG_UPDATE_INTERVAL;
  237. }
  238.  
  239. if(Seconds == Supply[sSpawn])
  240. {
  241. new spawn = random(sizeof(DropSpawn));
  242. DestroyObject(Supply[sObject]);
  243. Delete3DTextLabel(Supply[sLab]);
  244. Supply[sLab] = Text3D:INVALID_3DTEXT_ID;
  245. Supply[sObject] = CreateObject(18849, DropSpawn[spawn][0], DropSpawn[spawn][1], DropSpawn[spawn][3], 0, 0, 0, 1000.0);
  246. MoveObject(Supply[sObject], DropSpawn[spawn][0], DropSpawn[spawn][1], DropSpawn[spawn][2], 5, 0, 0, 0);
  247. Supply[sLab] = Create3DTextLabel("Supply drop\n(/supply)", 0x009DFFFF, DropSpawn[spawn][0], DropSpawn[spawn][1], DropSpawn[spawn][2], 10.0, 0, 1);
  248. Supply[sSpawn] += SUPPLY_DROP_INTERVAL;
  249. SendClientMessageToAll(ORANGE, "* A supply drop is landing somewhere in desert! find it and use /supply to get equipment.");
  250. }
  251.  
  252. static Float:X, Float:Y, Float:Z, Float:km;
  253. foreach(Player, i)
  254. {
  255. if(!PlayerInfo[i][Logged]) continue;
  256. format(strtd,sizeof(strtd), "~y~Rank: ~w~%s - ~y~Score: ~w~%d~n~~g~Kills: ~w~%d - ~r~Deaths: ~w~%d~n~~b~~h~Team: ~w~%s - ~b~~h~Class: ~w~%s", RankName(PlayerInfo[i][Rank]), PlayerInfo[i][Score], PlayerInfo[i][Kills], PlayerInfo[i][Deaths], TeamName(PlayerInfo[i][Team]), ClassName(PlayerInfo[i][Class]));
  257. TextDrawSetString(StatsTD[i], strtd);
  258. PlayerInfo[i][AFK]++;
  259. if(PlayerInfo[i][AFK] < 3)
  260. {
  261. if(PlayerInfo[i][Admin] > 0) PlayerInfo[i][Activity]++;
  262. }
  263. if(Seconds == TimerEx[i][antispawnkill])
  264. {
  265. TimerEx[i][antispawnkill] = -1;
  266. if(!PlayerInfo[i][Duty])
  267. {
  268. switch(PlayerInfo[i][DM])
  269. {
  270. case MODE_DEFAULT:
  271. {
  272. format(strtd,sizeof(strtd), "%s %s", RankName(PlayerInfo[i][Rank]), ClassName(PlayerInfo[i][Class]));
  273. Update3DTextLabelText(PlayerInfo[i][Lab], TeamInfo[PlayerInfo[i][Team]][team_color_label], strtd);
  274. SetPlayerHealth(i, 99.0);
  275. if(ZoneInfo[16][zone_Owner] == PlayerInfo[i][Team]) SetPlayerArmour(i, 99.0);
  276. else SetPlayerArmour(i, Ranks[PlayerInfo[i][Rank]][rank_armor]);
  277. }
  278. case MODE_DM:
  279. {
  280. SetPlayerHealth(i, 99.0), SetPlayerArmour(i, 99.0);
  281. GivePlayerWeapon(i, 24, 9999);
  282. GivePlayerWeapon(i, 27, 9999);
  283. GivePlayerWeapon(i, 34, 9999);
  284. GivePlayerWeapon(i, 31, 9999);
  285. Update3DTextLabelText(PlayerInfo[i][Lab], TeamInfo[PlayerInfo[i][Team]][team_color_label], "Deathmatcher");
  286. }
  287. case MODE_MINIGUN_DM:
  288. {
  289. SetPlayerHealth(i, 99.0), SetPlayerArmour(i, 99.0);
  290. GivePlayerWeapon(i, 38, 99999);
  291. Update3DTextLabelText(PlayerInfo[i][Lab], TeamInfo[PlayerInfo[i][Team]][team_color_label], "Minigunner");
  292. }
  293. }
  294. SendClientMessage(i, RED, "Anti spawn kill protection ended.");
  295. }
  296. }
  297. if(Ping != 1)
  298. {
  299. if(GetPlayerPing(i) > Ping)
  300. {
  301. if(PingWarns[i]++ >= 5)
  302. {
  303. format(strtd, sizeof(strtd), ""BOT" has kicked %s(%d). Reason: High ping (%d/%d).", PlayerInfo[i][Name], i, GetPlayerPing(i), Ping);
  304. SendClientMessageToAll(ARED, strtd);
  305. SendClientMessage(i, ARED, "You have been kicked from the server. Reason: High ping.");
  306. KickEx(i);
  307. }
  308. }
  309. }
  310.  
  311. new zone = PlayerInfo[i][Zone];
  312. if(zone != -1)
  313. {
  314. if(ZoneInfo[zone][UnderAttack])
  315. {
  316. if(ZoneInfo[zone][zone_Timer] > 0)
  317. {
  318. if(PlayerInfo[i][AFK] > 15 && ZoneInfo[zone][zone_Attacker] == i)
  319. {
  320. format(strtd,sizeof(strtd), ""BOT" has kicked %s(%d). Reason: AFK capture.", PlayerInfo[i][Name], i);
  321. SendClientMessageToAll(ARED, strtd);
  322. SendClientMessage(i, ARED, "You have been kicked from the server. Reason: AFK capture.");
  323. ZoneInfo[zone][zone_Timer] =
  324. ZoneInfo[zone][zone_Attacker] = -1;
  325. ZoneInfo[zone][zone_Attackers] = 0;
  326. ZoneInfo[zone][UnderAttack] = false;
  327. GangZoneStopFlashForAll(ZoneInfo[zone][zone_Zone]);
  328. KickEx(i);
  329. }
  330. else
  331. {
  332. format(strtd,sizeof(strtd), "~w~Capturing... ~r~%d", ZoneInfo[zone][zone_Timer]);
  333. DisplayInfoTextdraw(i, strtd, 1);
  334. if(ZoneInfo[zone][zone_Attacker] == i) ZoneInfo[zone][zone_Timer] -= ZoneInfo[zone][zone_Attackers];
  335. if(ZoneInfo[zone][zone_Timer] <= 0) ZoneCap(ZoneInfo[zone][zone_Attacker]);
  336. }
  337. }
  338. }
  339. }
  340. if(Seconds == PlayerInfo[i][Muted])
  341. {
  342. SendClientMessage(i, ARED, "You have been chat unmuted.");
  343. PlayerInfo[i][Muted] = -1;
  344. }
  345. if(Seconds == PlayerInfo[i][Frozen])
  346. {
  347. SendClientMessage(i, ARED, "You have been unfrozen.");
  348. PlayerInfo[i][Frozen] = -1;
  349. TogglePlayerControllable(i, true);
  350. }
  351. if(Seconds == PlayerInfo[i][Jailed])
  352. {
  353. SendClientMessage(i, ARED, "You have been unjailed.");
  354. PlayerInfo[i][Jailed] = -1;
  355. SpawnPlayer(i);
  356. }
  357. if(Seconds == TimerEx[i][lastwarned]) TimerEx[i][lastwarned] = -1;
  358.  
  359. if(Seconds == TimerEx[i][removeinfotext]) TextDrawHideForPlayer(i, InfoTD[i]), TimerEx[i][removeinfotext] = -1;
  360.  
  361. if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !PlayerInfo[i][Duty])
  362. {
  363. if(Airveh(GetPlayerVehicleID(i))) continue;
  364.  
  365. GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
  366. if(VectorSize(X,Y,Z) > 1.33333) //240 *0.75 = 180 then 180/135 = 1.333
  367. {
  368. format(strtd, sizeof(strtd), "[SERVER]: %s(%d) possible speed hacks.", PlayerInfo[i][Name], i);
  369. SendAdminMessage(strtd, 0xD10000AA, 1);
  370. }
  371. }
  372. if(GetPlayerAnimationIndex(i))
  373. {
  374. new anim = GetPlayerAnimationIndex(i);
  375. GetPlayerPos(i, X, Y, Z);
  376. if((anim >= 1538) && (anim <= 1542) && Z > 41)
  377. {
  378. format(strtd,sizeof(strtd), "[SERVER]: %s(%d) possible fly hacks.", PlayerInfo[i][Name], i);
  379. SendAdminMessage(strtd, 0xD10000AA, 1);
  380. }
  381. }
  382. if(Seconds == TimerEx[i][hackcheck])
  383. {
  384. if(PlayerInfo[i][AFK] >= 2) TimerEx[i][hackcheck]=Seconds+10;
  385. else
  386. {
  387. GetPlayerCameraFrontVector(i, X,Y,Z);
  388. if(Z < -0.8)
  389. {
  390. PlayerInfo[i][Hacker] = true;
  391. format(strtd,sizeof(strtd), "[SERVER]: %s(%d) possible misc. hacks.", PlayerInfo[i][Name], i);
  392. SendAdminMessage(strtd, 0xD10000AA, 1);
  393. }
  394. SendClientMessage(i, WHITE, "Processed successfully.");
  395. PlayerInfo[i][Frozen] =
  396. TimerEx[i][hackcheck] = -1;
  397. TogglePlayerControllable(i, true);
  398. PlayerInfo[i][Proccess] = true;
  399. }
  400. }
  401. }
  402. return 1;
  403. }
  404. forward ZoneCap(playerid);
  405. public ZoneCap(playerid)
  406. {
  407. new zone = PlayerInfo[playerid][Zone];
  408.  
  409. DEBUG("Zone Captured PID:%d ZoneID:%d ZoneUnderAttack:%d IsPIDAttacker:%d ImportantZone:%d BonusZone:%d",playerid,zone,ZoneInfo[zone][UnderAttack],ZoneInfo[zone][zone_Attacker] == playerid,ZoneInfo[zone][ImportantZone],ZoneInfo[zone][BonusZone]);
  410. if(ZoneInfo[zone][UnderAttack])
  411. {
  412. new str[70], money;
  413. if(ZoneInfo[zone][zone_Attacker] == playerid)
  414. {
  415. DisplayInfoTextdraw(playerid, "~g~~h~Captured!", 5);
  416. ZoneInfo[zone][UnderAttack] = false;
  417. ZoneInfo[zone][zone_Attacker] = -1;
  418. ZoneInfo[zone][zone_Attackers] = 0;
  419. ZoneInfo[zone][zone_Timer] = -1;
  420. GangZoneHideForAll(ZoneInfo[zone][zone_Zone]);
  421. GangZoneShowForAll(ZoneInfo[zone][zone_Zone], TeamInfo[PlayerInfo[playerid][Team]][team_color]);
  422. format(str,sizeof(str), "~y~[ZONE] ~w~%s ~g~captured ~w~the %s", TeamName(PlayerInfo[playerid][Team]), ZoneInfo[zone][zone_Name]);
  423. SendBoxMessage(str);
  424. money = randomEx(1000, 1500);
  425. format(str, sizeof(str), "Captured. +3 score and %d$.", money);
  426. SendClientMessage(playerid, GREEN, str);
  427. GivePlayerScoreEx(playerid, 3), GivePlayerMoneyEx(playerid, money);
  428. ZoneSpree[playerid]++;
  429. switch(ZoneSpree[playerid])
  430. {
  431. case 10,15,20,25,30,35,40,45,50,60,70,80,90,100:
  432. {
  433. format(str,sizeof(str), "%s(%d) is on a capture spree of %d!", PlayerInfo[playerid][Name], playerid, ZoneSpree[playerid]);
  434. SendClientMessageToAll(ORANGE, str);
  435. money = randomEx(1500, 2000);
  436. GivePlayerScoreEx(playerid, 2), GivePlayerMoneyEx(playerid, money);
  437. format(str, sizeof(str), "Extra 2 score and %d$ for capture spree.", money);
  438. SendClientMessage(playerid, GREEN, str);
  439. }
  440. }
  441. if(ZoneInfo[zone][ImportantZone])
  442. {
  443. SendClientMessage(playerid, GREEN, "Extra 2 score and 1000$ for capturing an important zone.");
  444. GivePlayerScoreEx(playerid, 2), GivePlayerMoneyEx(playerid, 1000);
  445. }
  446. if(ZoneInfo[zone][BonusZone])
  447. {
  448. new score = randomEx(5,15);
  449. money = randomEx(2000,5000);
  450. format(str, sizeof(str), "Extra %d score and %d$ for capturing bonus zone.", score, money);
  451. SendClientMessage(playerid, GREEN, str);
  452. format(str, sizeof(str), "* %s(%d) captured the bonus zone.", PlayerInfo[playerid][Name], playerid);
  453. SendClientMessage(playerid, WEAK_GREEN, str);
  454. GivePlayerScoreEx(playerid, score), GivePlayerMoneyEx(playerid, money);
  455. ZoneInfo[zone][BonusZone] = false;
  456. StaticTimerEx[bonuszone] += BONUS_ZONE_UPDATE_INTERVAL;
  457. }
  458. }
  459. foreach(Player, i)
  460. {
  461. if(i == playerid) continue;
  462. if(PlayerInfo[i][Duty]) continue;
  463. if(PlayerInfo[i][Team] == PlayerInfo[playerid][Team])
  464. {
  465. if(IsPlayerInDynamicCP(i, ZoneInfo[zone][zone_CP]) && PlayerInfo[i][Zone] == zone)
  466. {
  467. PlayerInfo[i][Zone] = -1;
  468. money = randomEx(1000, 1100);
  469. format(str, sizeof(str), "Assisted in capture. +2 score and %d$.", money);
  470. SendClientMessage(i, GREEN, str);
  471. DisplayInfoTextdraw(i, "~g~~h~Captured!", 5);
  472. GivePlayerScoreEx(i, 2), GivePlayerMoneyEx(i, money);
  473. if(ZoneInfo[zone][ImportantZone])
  474. {
  475. SendClientMessage(i, GREEN, "Extra 1 score and 800$ for assisting in capturing of an important zone.");
  476. GivePlayerScoreEx(i, 1), GivePlayerMoneyEx(i, 800);
  477. }
  478. }
  479. else
  480. {
  481. format(str,sizeof(str), "* Your team captured the %s. +800$", ZoneInfo[zone][zone_Name]);
  482. SendClientMessage(i, WHITE, str);
  483. GivePlayerMoneyEx(i, 800);
  484. }
  485. }
  486. else if(PlayerInfo[i][Team] == ZoneInfo[zone][zone_Owner])
  487. {
  488. format(str,sizeof(str), "* Your team lost the %s. -500$", ZoneInfo[zone][zone_Name]);
  489. SendClientMessage(i, WHITE, str);
  490. GivePlayerMoneyEx(i, -500);
  491. if(PlayerInfo[i][Spawn] == zone)
  492. {
  493. SendClientMessage(i, RED, "The zone on which you chose to spawn at got captured by enemy team.");
  494. PlayerInfo[i][Spawn] = -1;
  495. }
  496. }
  497. }
  498. ZoneInfo[zone][zone_Owner] = PlayerInfo[playerid][Team];
  499. PlayerInfo[playerid][Zone] = -1;
  500. }
  501. return 1;
  502. }
  503.  
  504.  
  505. OnPlayerDeath
  506. DEBUG("Player Died ZoneID:%d",PlayerInfo[playerid][Zone]);
  507. if(PlayerInfo[playerid][Zone] != -1)
  508. {
  509. if(playerid == ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker])
  510. {
  511. PlayerInfo[playerid][Zone] =
  512. ZoneInfo[PlayerInfo[playerid][Zone]][zone_Timer] =
  513. ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker] = -1;
  514. ZoneInfo[PlayerInfo[playerid][Zone]][UnderAttack] = false;
  515. GangZoneStopFlashForAll(ZoneInfo[PlayerInfo[playerid][Zone]][zone_Zone]);
  516. }
  517. else ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attackers]-=1, PlayerInfo[playerid][Zone] = -1;
  518. }
  519.  
  520.  
  521. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  522. {
  523. DEBUG("Player Entered Checkpoint cid:%d",checkpointid,ZoneInfo[PlayerInfo[playerid][Zone]][zone_CP],PlayerInfo[playerid][Zone]);
  524. for(new i=0; i < sizeof(ZoneInfo); i++)
  525. {
  526. if(checkpointid != ZoneInfo[i][zone_CP]) continue;
  527. DEBUG("Player Entered Zone Checkpoint cid:%d ZoneCP:%d ZoneID:%d Bonus Zone:%d",checkpointid,ZoneInfo[PlayerInfo[playerid][Zone]][zone_CP],PlayerInfo[playerid][Zone],bonus_zone_id);
  528.  
  529. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You can't capture from a vehicle.");
  530. if(ZoneInfo[i][zone_Owner] == PlayerInfo[playerid][Team]) return SendClientMessage(playerid, RED, "This zone is owned by your team.");
  531. if(PlayerInfo[playerid][Duty]) return SendClientMessage(playerid, RED, "You can't be in admin duty.");
  532. if(PlayerInfo[playerid][Spec]) return SendClientMessage(playerid, RED, "You can't be in spectate.");
  533. if(PlayerInfo[playerid][Team] == TEAM_CIVIL) return SendClientMessage(playerid, RED, "Guerillas can't capture zones.");
  534. if(ZoneInfo[i][UnderAttack] && PlayerInfo[ZoneInfo[i][zone_Attacker]][Team] == PlayerInfo[playerid][Team]) return ZoneInfo[i][zone_Attackers]+=1, PlayerInfo[playerid][Zone] = i, SendClientMessage(playerid, WHITE, "Stay in the red checkpoint to get capture assist rewards.");
  535. else if(ZoneInfo[i][UnderAttack] && PlayerInfo[ZoneInfo[i][zone_Attacker]][Team] != PlayerInfo[playerid][Team]) return SendClientMessage(playerid, RED, "Kill the enemy in the zone to capture.");
  536. ZoneInfo[i][UnderAttack] = true;
  537. ZoneInfo[i][zone_Attacker] = playerid;
  538. ZoneInfo[i][zone_Attackers]++;
  539. ZoneInfo[i][zone_Timer] = 25;
  540. PlayerInfo[playerid][Zone] = i;
  541. GangZoneFlashForAll(ZoneInfo[i][zone_Zone], TeamInfo[PlayerInfo[playerid][Team]][team_color]);
  542. new str[70];
  543. format(str,sizeof(str), "~y~[ZONE] ~w~%s ~r~attacked ~w~the %s", TeamName(PlayerInfo[playerid][Team]), ZoneInfo[i][zone_Name]);
  544. SendBoxMessage(str);
  545. format(str,sizeof(str), "You are starting to capture %s.", ZoneInfo[i][zone_Name]);
  546. SendClientMessage(playerid, WHITE, str), str[0]='\0';
  547. SendClientMessage(playerid, WHITE, "Stay in this red checkpoint for 25 seconds to capture the zone.");
  548. }
  549. return 1;
  550. }
  551.  
  552. public OnPlayerLeaveDynamicCP(playerid, checkpointid)
  553. {
  554. DEBUG("Player Left Checkpoint cid:%d ZoneCP:%d ZoneID:%d Bonus Zone:%d",checkpointid,ZoneInfo[PlayerInfo[playerid][Zone]][zone_CP],PlayerInfo[playerid][Zone],bonus_zone_id);
  555. if(checkpointid == ZoneInfo[PlayerInfo[playerid][Zone]][zone_CP])
  556. {
  557. if(ZoneInfo[PlayerInfo[playerid][Zone]][UnderAttack])
  558. {
  559. if(ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker] == playerid)
  560. {
  561. ZoneInfo[PlayerInfo[playerid][Zone]][zone_Timer] = -1;
  562. ZoneInfo[PlayerInfo[playerid][Zone]][UnderAttack] = false;
  563. ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker] = -1;
  564. ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attackers] = 0;
  565. GangZoneStopFlashForAll(ZoneInfo[PlayerInfo[playerid][Zone]][zone_Zone]);
  566. PlayerInfo[playerid][Zone] = -1;
  567. SendClientMessage(playerid, RED, "Capture failed as you left the red checkpoint.");
  568. }
  569. else if(ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attackers] > 1 && playerid != ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker])
  570. {
  571. SendClientMessage(playerid, RED, "You are no longer assisting in capture as you left the red checkpoint.");
  572. ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attackers]-=1;
  573. PlayerInfo[playerid][Zone] = -1;
  574. }
  575. }
  576. }
  577. return 1;
  578. }
  579.  
  580.  
  581. OnPlayerStateChange
  582. if(PlayerInfo[playerid][Zone] != -1)
  583. {
  584. new zone = PlayerInfo[playerid][Zone];
  585. if(playerid == ZoneInfo[zone][zone_Attacker])
  586. {
  587. ZoneInfo[zone][zone_Timer] =
  588. PlayerInfo[playerid][Zone] =
  589. ZoneInfo[zone][zone_Attacker] = -1;
  590. ZoneInfo[zone][UnderAttack] = false;
  591. ZoneInfo[zone][zone_Attackers] = 0;
  592. GangZoneStopFlashForAll(ZoneInfo[zone][zone_Zone]);
  593. SendClientMessage(playerid, RED, "Capture failed as you entered a vehicle.");
  594. }
  595. else if(ZoneInfo[zone][zone_Attackers] > 1 && playerid != ZoneInfo[zone][zone_Attacker])
  596. {
  597. SendClientMessage(playerid, RED, "You are no longer assisting in capture as you entered a vehicle.");
  598. ZoneInfo[zone][zone_Attackers]--;
  599. PlayerInfo[playerid][Zone] = -1;
  600. }
  601. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement