Guest User

Untitled

a guest
Nov 25th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.79 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4.  
  5. #undef MAX_PLAYERS
  6. #define MAX_PLAYERS (200)
  7.  
  8. #include <gangzonesc>
  9.  
  10. #define TURF_STATE_NORMAL (0)
  11. #define TURF_STATE_ATTACKED (1)
  12. #define TURF_STATE_PROVOKED (2)
  13.  
  14. #define TURF_REQUIRED_KILLS (3)
  15. #define TURF_REQUIRED_PLAYERS (1)
  16. #define TURF_REQUIRED_CAPTURETIME (2 * 60 * 1000)
  17. #define TURF_REQUIRED_PROVOKETIME (10 * 1000)
  18.  
  19.  
  20. #define COLOR_DODGER_BLUE (0x1E90FFFF)
  21. #define COLOR_FIREBRICK (0xB22222FF)
  22. #define COLOR_STEEL_BLUE (0x4682B4FF)
  23. #define COLOR_RED (0xFF0000FF)
  24. #define COLOR_GREY (0x808080FF)
  25. #define COLOR_GREEN (0x00CC00FF)
  26. #define COLOR_LIME (0xCCFF99FF)
  27. #define COLOR_BLACK (0x000000FF)
  28. #define COLOR_WHITE (0xFFFFFFFF)
  29. #define COLOR_ORANGE (0xFF9933FF)
  30. #define COLOR_YELLOW (0xFFFF66FF)
  31. #define COLOR_BLUE (0x0099CCFF)
  32. #define COLOR_PURPLE (0x6600FFFF)
  33. #define COLOR_BROWN (0x663300FF)
  34. #define COLOR_PINK (0xCC99FFFF)
  35. #define COLOR_HOT_PINK (0xFF99FFFF)
  36. #define COLOR_THISTLE (0xD8BFD8FF)
  37. #define COLOR_KHAKI (0x999966FF)
  38. #define COLOR_ORANGE_RED (0xFF4500FF)
  39.  
  40. #define SAMP_BLUE "{A9C4E4}"
  41. #define WHITE "{FFFFFF}"
  42. #define MARONE "{800000}"
  43. #define RED "{FF0000}"
  44. #define HOT_PINK "{FF99FF}"
  45. #define LIME "{CCFF99}"
  46. #define TOMATO "{FF6347}"
  47. #define PINK "{CC99FF}"
  48. #define BLACK "{000000}"
  49. #define ORANGE "{FF9933}"
  50. #define YELLOW "{FFFF66}"
  51. #define GREEN "{00CC00}"
  52. #define VIOLET "{EE82EE}"
  53. #define BROWN "{663300}"
  54. #define CORAL "{993333}"
  55. #define LIGHT "{00FFFF}"
  56.  
  57.  
  58.  
  59. #define COLOR_CHANGE_ALPHA(%1) ((%1 & ~0xFF) | (clamp(100, 0x00, 0xFF)))
  60.  
  61. enum e_TEAM {
  62. teamName[35],
  63. teamColor
  64. };
  65.  
  66. enum e_TURF {
  67. turfName[35],
  68. turfOwner,
  69. turfAttacker,
  70. Float: turfPos[4],
  71. turfOwnerKills,
  72. turfAttackerKills,
  73. turfState,
  74. turfTimer,
  75. turfId
  76. };
  77.  
  78. new const g_Team[][e_TEAM] = {
  79. {"Groves", 0x00CC00FF},
  80. {"Ballas", 0x663300FF},
  81. {"Cops", 0x0099CCFF},
  82. {"Vagos", 0xFFFF66FF},
  83. {"Aztecas", 0x00FFFFFF},
  84. {"Chickens",0xFF9933FF},
  85. {"RussianMafia",0xFF0000FF},
  86. {"FBI",0x000000FF}
  87.  
  88.  
  89. };
  90.  
  91. new const g_Turf[][e_TURF] = {
  92.  
  93. {"Ganton", 0, NO_TEAM, {2286.484375, -1763.024902, 2582.484375, -1595.024902}},
  94. {"Idlewood", 0, NO_TEAM, {1949.637451, -1965.481323, 2213.637451, -1717.481323}},
  95.  
  96. {"Las Colinas", 1, NO_TEAM, {2553.808837, -1232.376586, 2785.808837, -1000.376586}},
  97. {"Glen Park", 1, NO_TEAM, {1785.413940, -1316.985839, 2097.414062, -1028.985839}},
  98.  
  99. {"Pershing Square", 2, NO_TEAM, {1449.186889, -1807.042236, 1657.186889, -1527.042236}},
  100.  
  101. {"El Corona", 3, NO_TEAM, {1638.658813, -2180.318359, 1910.658813, -1932.318359}},
  102. {"Market", 6, NO_TEAM, {1022.130126, -1370.191772, 1230.130126, -1130.191772}},
  103. {"Vinewood", 7, NO_TEAM, {1179.555541, -868.956359, 1371.555541, -708.956359}}
  104.  
  105. };
  106.  
  107. new
  108. g_MembersInTurf[sizeof(g_Turf)][sizeof(g_Team)],
  109. PlayerText: g_PlayerTurfTxt[MAX_PLAYERS][3],
  110. PlayerText: g_PlayerTurfNotifyTxt[MAX_PLAYERS][4],
  111. g_PlayerTurfNotifyTimer[MAX_PLAYERS][4]
  112. ;
  113.  
  114. public OnFilterScriptInit() {
  115. new
  116. iTeamTurfs[sizeof(g_Team)]
  117. ;
  118. for (new i, j = sizeof(g_Turf); i < j; i++) {
  119. g_Turf[i][turfId] = GangZoneCreate(g_Turf[i][turfPos][0], g_Turf[i][turfPos][1], g_Turf[i][turfPos][2], g_Turf[i][turfPos][3], COLOR_CHANGE_ALPHA(g_Team[g_Turf[i][turfOwner]][teamColor]), 1.8);
  120.  
  121. g_Turf[i][turfTimer] = -1;
  122.  
  123. for (new k, l = sizeof(g_Team); k < l; k++) {
  124. g_MembersInTurf[i][k] = 0;
  125. }
  126.  
  127. iTeamTurfs[g_Turf[i][turfOwner]]++;
  128. }
  129.  
  130. print(" ");
  131. print("_________________| Turfwar Script by kejo|_________________");
  132. print("Attempting to initialize ''turfs.amx''...");
  133. print(" ");
  134. for (new i, j = sizeof(g_Team); i < j; i++) {
  135. printf("Loaded %i turfs for team %s", iTeamTurfs[i], g_Team[i][teamName]);
  136. }
  137. print(" ");
  138. printf("Total %i turfs loaded", sizeof(g_Turf));
  139. print("_________________________________________________");
  140. print(" ");
  141.  
  142. return 1;
  143. }
  144.  
  145. public OnFilterScriptExit() {
  146. for (new i, j = sizeof(g_Turf); i < j; i++) {
  147. GangZoneDestroy(g_Turf[i][turfId]);
  148.  
  149. if (g_Turf[i][turfTimer] != -1) {
  150. KillTimer(g_Turf[i][turfTimer]);
  151. }
  152. g_Turf[i][turfTimer] = -1;
  153. }
  154.  
  155. return 1;
  156. }
  157.  
  158. public OnPlayerConnect(playerid) {
  159. g_PlayerTurfTxt[playerid][0] = CreatePlayerTextDraw(playerid,317.000000, 378.000000, "Turfwar in ~b~~h~~h~~h~Gangton");
  160. PlayerTextDrawAlignment(playerid,g_PlayerTurfTxt[playerid][0], 2);
  161. PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfTxt[playerid][0], 255);
  162. PlayerTextDrawFont(playerid,g_PlayerTurfTxt[playerid][0], 2);
  163. PlayerTextDrawLetterSize(playerid,g_PlayerTurfTxt[playerid][0], 0.240000, 1.200000);
  164. PlayerTextDrawColor(playerid,g_PlayerTurfTxt[playerid][0], -1);
  165. PlayerTextDrawSetOutline(playerid,g_PlayerTurfTxt[playerid][0], 1);
  166. PlayerTextDrawSetProportional(playerid,g_PlayerTurfTxt[playerid][0], 1);
  167. PlayerTextDrawSetSelectable(playerid,g_PlayerTurfTxt[playerid][0], 0);
  168.  
  169. g_PlayerTurfTxt[playerid][1] = CreatePlayerTextDraw(playerid,317.000000, 389.000000, "Grove~w~~h~: ~r~13 ~w~~h~kills with ~r~4 ~w~~h~players");
  170. PlayerTextDrawAlignment(playerid,g_PlayerTurfTxt[playerid][1], 2);
  171. PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfTxt[playerid][1], 255);
  172. PlayerTextDrawFont(playerid,g_PlayerTurfTxt[playerid][1], 2);
  173. PlayerTextDrawLetterSize(playerid,g_PlayerTurfTxt[playerid][1], 0.180000, 0.899999);
  174. PlayerTextDrawColor(playerid,g_PlayerTurfTxt[playerid][1], 16711935);
  175. PlayerTextDrawSetOutline(playerid,g_PlayerTurfTxt[playerid][1], 1);
  176. PlayerTextDrawSetProportional(playerid,g_PlayerTurfTxt[playerid][1], 1);
  177. PlayerTextDrawSetSelectable(playerid,g_PlayerTurfTxt[playerid][1], 0);
  178.  
  179. g_PlayerTurfTxt[playerid][2] = CreatePlayerTextDraw(playerid,317.000000, 397.000000, "Aztecas~w~~h~: ~r~16 ~w~~h~kills with ~r~7 ~w~~h~players");
  180. PlayerTextDrawAlignment(playerid,g_PlayerTurfTxt[playerid][2], 2);
  181. PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfTxt[playerid][2], 255);
  182. PlayerTextDrawFont(playerid,g_PlayerTurfTxt[playerid][2], 2);
  183. PlayerTextDrawLetterSize(playerid,g_PlayerTurfTxt[playerid][2], 0.180000, 0.899999);
  184. PlayerTextDrawColor(playerid,g_PlayerTurfTxt[playerid][2], 16777215);
  185. PlayerTextDrawSetOutline(playerid,g_PlayerTurfTxt[playerid][2], 1);
  186. PlayerTextDrawSetProportional(playerid,g_PlayerTurfTxt[playerid][2], 1);
  187. PlayerTextDrawSetSelectable(playerid,g_PlayerTurfTxt[playerid][2], 0);
  188.  
  189. g_PlayerTurfNotifyTxt[playerid][0] = CreatePlayerTextDraw(playerid,317.000000, 348.000000, "~g~We have won the turfwar against the ~b~~h~~h~~h~Grove ~g~in ~b~~h~~h~~h~Gangton ~g~(/turfs)");
  190. PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][0], 2);
  191. PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][0], 255);
  192. PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][0], 1);
  193. PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][0], 0.180000, 0.799999);
  194. PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][0], -1);
  195. PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][0], 1);
  196. PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][0], 1);
  197. PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][0], 0);
  198.  
  199. g_PlayerTurfNotifyTxt[playerid][1] = CreatePlayerTextDraw(playerid,317.000000, 355.000000, "~r~We have lost the turfwar against the ~b~~h~~h~~h~Azetecas ~r~in ~b~~h~~h~~h~LS. Beach ~r~(/turfs)");
  200. PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][1], 2);
  201. PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][1], 255);
  202. PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][1], 1);
  203. PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][1], 0.180000, 0.799999);
  204. PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][1], -1);
  205. PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][1], 1);
  206. PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][1], 1);
  207. PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][1], 0);
  208.  
  209. g_PlayerTurfNotifyTxt[playerid][2] = CreatePlayerTextDraw(playerid,317.000000, 362.000000, "~y~We have provoked a turfwar again ~b~~h~~h~~h~Vagos ~y~in ~b~~h~~h~~h~Blueberry ~y~(/findwar)");
  210. PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][2], 2);
  211. PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][2], 255);
  212. PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][2], 1);
  213. PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][2], 0.180000, 0.799999);
  214. PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][2], -1);
  215. PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][2], 1);
  216. PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][2], 1);
  217. PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][2], 0);
  218.  
  219. g_PlayerTurfNotifyTxt[playerid][3] = CreatePlayerTextDraw(playerid,317.000000, 369.000000, "~y~We have got a turfwar again ~b~~h~~h~~h~Vagos ~y~in ~b~~h~~h~~h~Blueberry ~y~(/findwar)");
  220. PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][3], 2);
  221. PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][3], 255);
  222. PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][3], 1);
  223. PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][3], 0.180000, 0.799999);
  224. PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][3], -1);
  225. PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][3], 1);
  226. PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][3], 1);
  227. PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][3], 0);
  228.  
  229. ShowAllGangZonesForPlayer(playerid);
  230.  
  231. return 1;
  232. }
  233.  
  234. public OnPlayerSpawn(playerid) {
  235. for (new i, j = sizeof(g_Turf); i < j; i++) {
  236. if (g_Turf[i][turfState] == TURF_STATE_ATTACKED) {
  237. GangZoneFlashForPlayer(playerid, g_Turf[i][turfId], COLOR_CHANGE_ALPHA(g_Team[g_Turf[i][turfAttacker]][teamColor]));
  238. }
  239. }
  240.  
  241. PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][0]);
  242. PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][1]);
  243. PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][2]);
  244.  
  245. PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][0]);
  246. PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][1]);
  247. PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][2]);
  248. PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][3]);
  249.  
  250. return 1;
  251. }
  252.  
  253. public OnPlayerRequestClass(playerid, classid) {
  254. PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][0]);
  255. PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][1]);
  256. PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][2]);
  257.  
  258. PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][0]);
  259. PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][1]);
  260. PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][2]);
  261. PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][3]);
  262.  
  263. return 1;
  264. }
  265.  
  266. NotifyTeam(team, type, text[]) {
  267. for (new i, j = GetPlayerPoolSize(); i <= j; i++) {
  268. if (IsPlayerConnected(i) && GetPlayerState(i) != PLAYER_STATE_WASTED && GetPlayerTeam(i) == team) {
  269. if (g_PlayerTurfNotifyTimer[i][type] != -1) {
  270. KillTimer(g_PlayerTurfNotifyTimer[i][type]);
  271. }
  272. g_PlayerTurfNotifyTimer[i][type] = SetTimerEx("OnTeamNotified", 5000, false, "ii", team, type);
  273.  
  274. PlayerTextDrawSetString(i, g_PlayerTurfNotifyTxt[i][type], text);
  275. PlayerTextDrawShow(i, g_PlayerTurfNotifyTxt[i][type]);
  276. }
  277. }
  278. }
  279.  
  280. forward OnTeamNotified(team, type);
  281. public OnTeamNotified(team, type) {
  282. for (new i, j = GetPlayerPoolSize(); i <= j; i++) {
  283. if (IsPlayerConnected(i) && GetPlayerTeam(i) == team) {
  284. g_PlayerTurfNotifyTimer[i][type] = -1;
  285.  
  286. PlayerTextDrawHide(i, g_PlayerTurfNotifyTxt[i][type]);
  287. }
  288. }
  289. }
  290.  
  291. public OnPlayerDeath(playerid, killerid, reason) {
  292. if (killerid != INVALID_PLAYER_ID) {
  293. if (0 <= GetPlayerTeam(playerid) < sizeof(g_Team) && 0 <= GetPlayerTeam(killerid) < sizeof(g_Team)) {
  294. for (new i, j = sizeof(g_Turf); i < j; i++) {
  295. if (IsPlayerInGangZone(playerid, g_Turf[i][turfId])) {
  296. if (g_Turf[i][turfState] == TURF_STATE_NORMAL) {
  297. if (GetPlayerTeam(killerid) != g_Turf[i][turfOwner]) {
  298. g_Turf[i][turfAttackerKills]++;
  299.  
  300. if (g_Turf[i][turfAttackerKills] >= TURF_REQUIRED_KILLS) {
  301. g_Turf[i][turfState] = TURF_STATE_ATTACKED;
  302. g_Turf[i][turfAttacker] = GetPlayerTeam(killerid);
  303. g_Turf[i][turfTimer] = SetTimerEx("OnTurfwarEnd", TURF_REQUIRED_CAPTURETIME, false, "i", i);
  304.  
  305. GangZoneFlashForAll(g_Turf[i][turfId], COLOR_CHANGE_ALPHA(g_Team[GetPlayerTeam(killerid)][teamColor]));
  306.  
  307. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  308. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[i][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
  309. new
  310. szBuffer[156]
  311. ;
  312. strcat(szBuffer, "Turfwar in ~b~~h~~h~~h~");
  313. strcat(szBuffer, g_Turf[i][turfName]);
  314. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][0], szBuffer);
  315. PlayerTextDrawShow(p, g_PlayerTurfTxt[p][0]);
  316.  
  317. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[i][turfOwner]][teamName], g_Turf[i][turfOwnerKills], g_MembersInTurf[i][g_Turf[i][turfOwner]]);
  318. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
  319. PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[i][turfOwner]][teamColor]);
  320. PlayerTextDrawShow(p, g_PlayerTurfTxt[p][1]);
  321.  
  322. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[i][turfAttacker]][teamName], g_Turf[i][turfAttackerKills], g_MembersInTurf[i][g_Turf[i][turfAttacker]]);
  323. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
  324. PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[i][turfAttacker]][teamColor]);
  325. PlayerTextDrawShow(p, g_PlayerTurfTxt[p][2]);
  326. }
  327. }
  328.  
  329. new
  330. szText[156]
  331. ;
  332. strcat(szText, "~y~We have provoked a turfwar against ~b~~h~~h~~h~");
  333. strcat(szText, g_Team[g_Turf[i][turfOwner]][teamName]);
  334. strcat(szText, " ~y~in ~b~~h~~h~~h~");
  335. strcat(szText, g_Turf[i][turfName]);
  336. strcat(szText, " ~y~(/findwar)");
  337. NotifyTeam(g_Turf[i][turfAttacker], 2, szText);
  338.  
  339. szText[0] = EOS;
  340. strcat(szText, "~y~We have been attacked by ~b~~h~~h~~h~");
  341. strcat(szText, g_Team[g_Turf[i][turfAttacker]][teamName]);
  342. strcat(szText, " ~y~in ~b~~h~~h~~h~");
  343. strcat(szText, g_Turf[i][turfName]);
  344. strcat(szText, " ~y~(/findwar)");
  345. NotifyTeam(g_Turf[i][turfOwner], 3, szText);
  346. }
  347. }
  348. }
  349. else if (g_Turf[i][turfState] == TURF_STATE_ATTACKED) {
  350. if (GetPlayerTeam(killerid) == g_Turf[i][turfOwner]) {
  351. g_Turf[i][turfOwnerKills]++;
  352.  
  353. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  354. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[i][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
  355. new
  356. szBuffer[156]
  357. ;
  358. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[i][turfOwner]][teamName], g_Turf[i][turfOwnerKills], g_MembersInTurf[i][g_Turf[i][turfOwner]]);
  359. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
  360. PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[i][turfOwner]][teamColor]);
  361. }
  362. }
  363. }
  364. else if (GetPlayerTeam(killerid) == g_Turf[i][turfAttacker]) {
  365. g_Turf[i][turfAttackerKills]++;
  366.  
  367. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  368. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[i][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
  369. new
  370. szBuffer[156]
  371. ;
  372. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[i][turfAttacker]][teamName], g_Turf[i][turfAttackerKills], g_MembersInTurf[i][g_Turf[i][turfAttacker]]);
  373. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
  374. PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[i][turfAttacker]][teamColor]);
  375. }
  376. }
  377. }
  378. }
  379.  
  380. return 1;
  381. }
  382. }
  383. }
  384. }
  385.  
  386. return 1;
  387. }
  388.  
  389. public OnPlayerEnterGangZone(playerid, zone) {
  390. if (0 <= GetPlayerTeam(playerid) < sizeof(g_Team) && GetPlayerState(playerid) != PLAYER_STATE_WASTED && ! GetPlayerInterior(playerid) && ! GetPlayerVirtualWorld(playerid)) {
  391. for (new i, j = sizeof(g_Turf); i < j; i++) {
  392. if (zone == g_Turf[i][turfId]) {
  393. new
  394. szTurfText[156]
  395. ;
  396. strcat(szTurfText, "~y~~h~");
  397. strcat(szTurfText, g_Team[g_Turf[i][turfOwner]][teamName]);
  398. strcat(szTurfText, "'s ");
  399. strcat(szTurfText, g_Turf[i][turfName]);
  400. GameTextForPlayer(playerid, szTurfText, 3000, 1);
  401.  
  402. g_MembersInTurf[i][GetPlayerTeam(playerid)]++;
  403.  
  404. if (GetPlayerTeam(playerid) != g_Turf[i][turfOwner]) {
  405. if (g_Turf[i][turfState] == TURF_STATE_NORMAL) {
  406. if (g_MembersInTurf[i][GetPlayerTeam(playerid)] >= TURF_REQUIRED_PLAYERS) {
  407. g_Turf[i][turfState] = TURF_STATE_PROVOKED;
  408. g_Turf[i][turfAttacker] = GetPlayerTeam(playerid);
  409. g_Turf[i][turfTimer] = SetTimerEx("OnTurfwarProvoked", TURF_REQUIRED_PROVOKETIME, false, "i", i);
  410.  
  411. return 1;
  412. }
  413. }
  414. }
  415. else if (g_Turf[i][turfState] == TURF_STATE_ATTACKED) {
  416. new
  417. szBuffer[156]
  418. ;
  419. strcat(szBuffer, "Turfwar in ~b~~h~~h~~h~");
  420. strcat(szBuffer, g_Turf[i][turfName]);
  421. PlayerTextDrawSetString(playerid, g_PlayerTurfTxt[playerid][0], szBuffer);
  422. PlayerTextDrawShow(playerid, g_PlayerTurfTxt[i][0]);
  423.  
  424. PlayerTextDrawColor(playerid, g_PlayerTurfTxt[playerid][1], g_Team[g_Turf[i][turfOwner]][teamColor]);
  425. PlayerTextDrawShow(playerid, g_PlayerTurfTxt[i][1]);
  426.  
  427. PlayerTextDrawColor(playerid, g_PlayerTurfTxt[playerid][2], g_Team[g_Turf[i][turfAttacker]][teamColor]);
  428. PlayerTextDrawShow(playerid, g_PlayerTurfTxt[i][2]);
  429.  
  430. if (GetPlayerTeam(playerid) == g_Turf[i][turfOwner]) {
  431. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  432. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[i][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
  433. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[i][turfOwner]][teamName], g_Turf[i][turfOwnerKills], g_MembersInTurf[i][g_Turf[i][turfOwner]]);
  434. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
  435. }
  436. }
  437. }
  438. else if (GetPlayerTeam(playerid) == g_Turf[i][turfAttacker]) {
  439. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  440. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[i][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
  441. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[i][turfOwner]][teamName], g_Turf[i][turfOwnerKills], g_MembersInTurf[i][g_Turf[i][turfOwner]]);
  442. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
  443. }
  444. }
  445. }
  446. }
  447.  
  448. return 1;
  449. }
  450. }
  451. }
  452.  
  453. return 1;
  454. }
  455.  
  456. forward OnTurfwarProvoked(turfid);
  457. public OnTurfwarProvoked(turfid) {
  458. g_Turf[turfid][turfState] = TURF_STATE_ATTACKED;
  459. g_Turf[turfid][turfTimer] = SetTimerEx("OnTurfwarEnd", TURF_REQUIRED_CAPTURETIME, false, "i", turfid);
  460.  
  461. new
  462. szText[156]
  463. ;
  464. strcat(szText, "~y~We have turfwar against ~b~~h~~h~~h~");
  465. strcat(szText, g_Team[g_Turf[turfid][turfOwner]][teamName]);
  466. strcat(szText, " ~y~in ~b~~h~~h~~h~");
  467. strcat(szText, g_Turf[turfid][turfName]);
  468. NotifyTeam(g_Turf[turfid][turfAttacker], 2, szText);
  469.  
  470. szText[0] = EOS;
  471. strcat(szText, "~y~Our turf is under attacked by ~b~~h~~h~~h~");
  472. strcat(szText, g_Team[g_Turf[turfid][turfAttacker]][teamName]);
  473. strcat(szText, " ~y~in ~b~~h~~h~~h~");
  474. strcat(szText, g_Turf[turfid][turfName]);
  475. NotifyTeam(g_Turf[turfid][turfOwner], 3, szText);
  476.  
  477. GangZoneFlashForAll(g_Turf[turfid][turfId], COLOR_CHANGE_ALPHA(g_Team[g_Turf[turfid][turfAttacker]][teamColor]));
  478.  
  479. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  480. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfid][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
  481. new
  482. szBuffer[156]
  483. ;
  484. strcat(szBuffer, "Turfwar in ~b~~h~~h~~h~");
  485. strcat(szBuffer, g_Turf[turfid][turfName]);
  486. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][0], szBuffer);
  487. PlayerTextDrawShow(p, g_PlayerTurfTxt[p][0]);
  488.  
  489. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfid][turfOwner]][teamName], g_Turf[turfid][turfOwnerKills], g_MembersInTurf[turfid][g_Turf[turfid][turfOwner]]);
  490. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
  491. PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[turfid][turfOwner]][teamColor]);
  492. PlayerTextDrawShow(p, g_PlayerTurfTxt[p][1]);
  493.  
  494. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfid][turfAttacker]][teamName], g_Turf[turfid][turfAttackerKills], g_MembersInTurf[turfid][g_Turf[turfid][turfAttacker]]);
  495. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
  496. PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[turfid][turfAttacker]][teamColor]);
  497. PlayerTextDrawShow(p, g_PlayerTurfTxt[p][2]);
  498. }
  499. }
  500. }
  501.  
  502. forward OnTurfwarEnd(turfid);
  503. public OnTurfwarEnd(turfid) {
  504. g_Turf[turfid][turfTimer] = -1;
  505.  
  506. new
  507. iScores[2],
  508. szText[156]
  509. ;
  510. iScores[0] = g_Turf[turfid][turfOwnerKills] + g_MembersInTurf[turfid][g_Turf[turfid][turfOwner]];
  511. iScores[1] = g_Turf[turfid][turfAttackerKills] + g_MembersInTurf[turfid][g_Turf[turfid][turfAttacker]];
  512. if (iScores[0] < iScores[1]) {
  513. strcat(szText, "[TURF SYSTEM]~y~Turf has been sucessfully captured Against ~b~~h~~h~~h~");
  514. strcat(szText, g_Team[g_Turf[turfid][turfOwner]][teamName]);
  515. strcat(szText, " ~y~in ~b~~h~~h~~h~");
  516. strcat(szText, g_Turf[turfid][turfName]);
  517. NotifyTeam(g_Turf[turfid][turfAttacker], 1, szText);
  518.  
  519. szText[0] = EOS;
  520. strcat(szText, "[TURF SYSTEM]~y~You have failed to attack ~b~~h~~h~~h~");
  521. strcat(szText, g_Team[g_Turf[turfid][turfAttacker]][teamName]);
  522. strcat(szText, " ~y~in ~b~~h~~h~~h~");
  523. strcat(szText, g_Turf[turfid][turfName]);
  524. NotifyTeam(g_Turf[turfid][turfOwner], 0, szText);
  525.  
  526. format(szText, sizeof(szText), "[TURF SYSTEM]"LIGHT":-The last turf score""\"%s\"were: %s - %i, %s - %i.", g_Turf[turfid][turfName], g_Team[g_Turf[turfid][turfOwner]][teamName], iScores[0], g_Team[g_Turf[turfid][turfAttacker]][teamName], iScores[1]);
  527. for (new i, j = sizeof(g_Team); i < j; i++) {
  528. if (GetPlayerTeam(i) == g_Turf[turfid][turfOwner]) {
  529. SendClientMessage(i, COLOR_GREEN, szText);
  530. }
  531. else if (GetPlayerTeam(i) == g_Turf[turfid][turfAttacker]) {
  532. GivePlayerMoney(i, 30000);
  533. SetPlayerScore(i, GetPlayerScore(i) + 8);
  534.  
  535. SendClientMessage(i, COLOR_GREEN,"[TURF SYSTEM]:-"GREEN""WHITE" You have earned {663300}+$30000 "WHITE" cash and {663300}+8 score"WHITE" for capturing the Turf. ");
  536. SendClientMessage(i, COLOR_WHITE, szText);
  537. }
  538. }
  539.  
  540. g_Turf[turfid][turfOwner] = g_Turf[turfid][turfAttacker];
  541. }
  542. else {
  543. strcat(szText, "[TURF SYSTEM]~y~Turf has been sucessfully captured Against ~b~~h~~h~~h~");
  544. strcat(szText, g_Team[g_Turf[turfid][turfAttacker]][teamName]);
  545. strcat(szText, " ~y~in ~b~~h~~h~~h~");
  546. strcat(szText, g_Turf[turfid][turfName]);
  547. NotifyTeam(g_Turf[turfid][turfOwner], 1, szText);
  548.  
  549. szText[0] = EOS;
  550. strcat(szText, "[TURF SYSTEM]~y~You have failed to attack ~b~~h~~h~~h~");
  551. strcat(szText, g_Team[g_Turf[turfid][turfOwner]][teamName]);
  552. strcat(szText, " ~y~in ~b~~h~~h~~h~");
  553. strcat(szText, g_Turf[turfid][turfName]);
  554. NotifyTeam(g_Turf[turfid][turfAttacker], 0, szText);
  555.  
  556. format(szText, sizeof(szText), "[TURF SYSTEM]"GREEN":-The last turf score""\"%s\"were: %s - %i, %s - %i.", g_Turf[turfid][turfName], g_Team[g_Turf[turfid][turfOwner]][teamName], iScores[0], g_Team[g_Turf[turfid][turfAttacker]][teamName], iScores[1]);
  557. for (new i, j = sizeof(g_Team); i < j; i++) {
  558. if (GetPlayerTeam(i) == g_Turf[turfid][turfOwner]) {
  559. GivePlayerMoney(i, 30000);
  560. SetPlayerScore(i, GetPlayerScore(i) + 8);
  561.  
  562. SendClientMessage(i, COLOR_GREEN, "[TURF SYSTEM]:-"WHITE"You have earned ,{663300}+$30000 "WHITE" cash and {663300}+8 score"WHITE" for capturing the Turf. ");
  563. SendClientMessage(i, COLOR_WHITE, szText);
  564. }
  565. else if (GetPlayerTeam(i) == g_Turf[turfid][turfAttacker]) {
  566. SendClientMessage(i, COLOR_WHITE, szText);
  567. }
  568. }
  569. }
  570.  
  571. g_Turf[turfid][turfState] = TURF_STATE_NORMAL;
  572.  
  573. g_Turf[turfid][turfAttacker] = NO_TEAM;
  574.  
  575. g_Turf[turfid][turfAttackerKills] = 0;
  576. g_Turf[turfid][turfOwnerKills] = 0;
  577.  
  578. GangZoneStopFlashForAll(g_Turf[turfid][turfId]);
  579. GangZoneShowForAll(g_Turf[turfid][turfId], COLOR_CHANGE_ALPHA(g_Team[g_Turf[turfid][turfOwner]][teamColor]));
  580.  
  581. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  582. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfid][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
  583. PlayerTextDrawHide(p, g_PlayerTurfTxt[p][0]);
  584.  
  585. PlayerTextDrawHide(p, g_PlayerTurfTxt[p][1]);
  586.  
  587. PlayerTextDrawHide(p, g_PlayerTurfTxt[p][2]);
  588. }
  589. }
  590. }
  591.  
  592. public OnPlayerLeaveGangZone(playerid, zone) {
  593. if (0 <= GetPlayerTeam(playerid) < sizeof(g_Team)) {
  594. for (new i, j = sizeof(g_Turf); i < j; i++) {
  595. if (zone == g_Turf[i][turfId]) {
  596. g_MembersInTurf[i][GetPlayerTeam(playerid)]--;
  597.  
  598. if (g_Turf[i][turfState] == TURF_STATE_PROVOKED) {
  599. if (g_MembersInTurf[i][GetPlayerTeam(playerid)] < TURF_REQUIRED_PLAYERS) {
  600. g_Turf[i][turfState] = TURF_STATE_NORMAL;
  601. g_Turf[i][turfAttacker] = NO_TEAM;
  602. KillTimer(g_Turf[i][turfTimer]);
  603. g_Turf[i][turfTimer] = -1;
  604.  
  605. return 1;
  606. }
  607. }
  608. else if (g_Turf[i][turfState] == TURF_STATE_ATTACKED) {
  609. PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][0]);
  610.  
  611. PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][1]);
  612.  
  613. PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][2]);
  614.  
  615. if (g_MembersInTurf[i][GetPlayerTeam(playerid)] < TURF_REQUIRED_PLAYERS) {
  616. OnTurfwarEnd(i);
  617.  
  618. KillTimer(g_Turf[i][turfTimer]);
  619. g_Turf[i][turfTimer] = -1;
  620.  
  621. g_Turf[i][turfState] = TURF_STATE_NORMAL;
  622.  
  623. g_Turf[i][turfAttacker] = NO_TEAM;
  624.  
  625. g_Turf[i][turfAttackerKills] = 0;
  626. g_Turf[i][turfOwnerKills] = 0;
  627.  
  628. GangZoneStopFlashForAll(g_Turf[i][turfId]);
  629. GangZoneShowForAll(g_Turf[i][turfId], COLOR_CHANGE_ALPHA(g_Team[g_Turf[i][turfOwner]][teamColor]));
  630.  
  631. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  632. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[i][turfId])) {
  633. PlayerTextDrawHide(p, g_PlayerTurfTxt[p][0]);
  634.  
  635. PlayerTextDrawHide(p, g_PlayerTurfTxt[p][1]);
  636.  
  637. PlayerTextDrawHide(p, g_PlayerTurfTxt[p][2]);
  638. }
  639. }
  640.  
  641. return 1;
  642. }
  643. else {
  644. if (GetPlayerTeam(playerid) == g_Turf[i][turfOwner]) {
  645. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  646. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[i][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
  647. new
  648. szBuffer[156]
  649. ;
  650. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[i][turfOwner]][teamName], g_Turf[i][turfOwnerKills], g_MembersInTurf[i][g_Turf[i][turfOwner]]);
  651. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
  652. PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[i][turfOwner]][teamColor]);
  653. }
  654. }
  655. }
  656. else if (GetPlayerTeam(playerid) == g_Turf[i][turfAttacker]) {
  657. for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
  658. if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[i][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
  659. new
  660. szBuffer[156]
  661. ;
  662. format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[i][turfOwner]][teamName], g_Turf[i][turfOwnerKills], g_MembersInTurf[i][g_Turf[i][turfOwner]]);
  663. PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
  664. PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[i][turfAttacker]][teamColor]);
  665. }
  666. }
  667. }
  668.  
  669. return 1;
  670. }
  671. }
  672. }
  673. }
  674. }
  675.  
  676. return 1;
  677. }
Add Comment
Please, Sign In to add comment