Advertisement
Guest User

Gangfight

a guest
Mar 18th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.72 KB | None | 0 0
  1. #include <a_samp>
  2. //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  3. #define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]== 0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+ 1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2])))))return 1
  4. #define FS_COL_GREY (0xAFAFAFAA)
  5. #define FS_COL_YELLOW (0xFFFF00FF)
  6. //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  7. forward Fight_Init();
  8. forward Fight_Close();
  9. forward FightUpdate_1();
  10. forward FightUpdate_2();
  11. //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  12. enum fsSyS{
  13. Float:fsMinX,
  14. Float:fsMinY,
  15. Float:fsMaxX,
  16. Float:fsMaxY,
  17. Float:fsCTFx,
  18. Float:fsCTFy,
  19. Float:fsCTFz,
  20. fsOwnerFaction,
  21. fsAttackFaction,
  22. fsKillsOfOwner,
  23. fsKillsOfAttack,
  24. fsFightTime,
  25. fsCTF[3],
  26. fsLastFight,
  27. fsZoneID,
  28. fsFlag,
  29. Text:fsWinFaction,
  30. Text:fsLoseFaction,
  31. Text:fsWinKills,
  32. Text:fsLoseKills,
  33. Text:fsTime
  34. };
  35. new FightSystem[][fsSyS]={
  36. /*MinX, MinY, MaxX, MaxY, CTFx, CTFy, CTFz*/
  37. {1828.318,-1938.465,2071.699,-1760.817,1958.6156,-1853.2424,4.3392},//Tanke
  38. {1060.145,-1721.339,1166.624,-1583.168,1072.4016,-1619.3834,20.4583},//Kaufhaus
  39. {990.2909,1821.38,1177.724,2057.332,1067.5798,1884.2932,10.8203},//Container
  40. {-887.5186,1377.989,-583.8938,1634.903,-813.6335,1525.2080,26.5065},//Wüste
  41. {-2506.7,740.0255,-2383.094,826.8147,2459.4094,787.3281,35.1719},//Markt
  42. {-1850.044,1438.284,-1710.987,1584.248,-1789.1478,1543.3608,7.1875},//Hafen
  43. {-1891.4263,857.8361,-1722.0261,1095.5897,-1720.0752,1018.2902,17.5859},//Bank
  44. {1828.0573,-2161.2705,1956.4136,-2057.7964,1924.0941,-2125.0146,13.5826}//Airport(LS)
  45. };
  46. new Text:Fight,Text:FightUnderline,Text:FightOverline;
  47. new FightTimer[2];
  48. public OnFilterScriptInit(){
  49. AntiDeAMX();
  50. SetTimer("Fight_Init",5000,false);
  51. return 1;
  52. }
  53. public OnFilterScriptExit(){
  54. Fight_Close();
  55. return 1;
  56. }
  57. public OnPlayerConnect(playerid){
  58. SetPVarInt(playerid,"Spawned",0);
  59. for(new fs;fs<sizeof(FightSystem);fs++){
  60. GangZoneShowForPlayer(playerid,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsOwnerFaction]));
  61. }return 1;
  62. }
  63. public OnPlayerDisconnect(playerid, reason){
  64. for(new fs;fs<sizeof(FightSystem);fs++){
  65. if(FightSystem[fs][fsAttackFaction] != -255 && FightSystem[fs][fsFightTime]){
  66. if(FightSystem[fs][fsCTF][0] != -255 && FightSystem[fs][fsCTF][0] == playerid){
  67. new fsName[MAX_PLAYER_NAME];
  68. GetPlayerName(FightSystem[fs][fsCTF][0],fsName,MAX_PLAYER_NAME);
  69. new fsText[128];
  70. format(fsText,sizeof(fsText),">>> Fight <<< | %s hat es nicht geschafft die Flagge zu erobern!",fsName);
  71. for(new i;i<MAX_PLAYERS;i++){
  72. if(IsPlayerConnected(i)){
  73. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction]){
  74. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  75. SendClientMessage(i,FS_COL_YELLOW,fsText);
  76. }
  77. }
  78. }
  79. FightSystem[fs][fsCTF][0] = -255;
  80. FightSystem[fs][fsCTF][1] = 0;
  81. FightSystem[fs][fsCTF][2] = 0;
  82. }
  83. if(GetPVarInt(playerid,"Spawned")==1){
  84. GangZoneStopFlashForPlayer(playerid,FightSystem[fs][fsZoneID]);
  85. if(GetPlayerFaction(playerid) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(playerid) == FightSystem[fs][fsAttackFaction]){
  86. TextDrawHideForPlayer(playerid,Fight);
  87. TextDrawHideForPlayer(playerid,FightOverline);
  88. TextDrawHideForPlayer(playerid,FightUnderline);
  89. TextDrawHideForPlayer(playerid,FightSystem[fs][fsWinFaction]);
  90. TextDrawHideForPlayer(playerid,FightSystem[fs][fsLoseFaction]);
  91. TextDrawHideForPlayer(playerid,FightSystem[fs][fsWinKills]);
  92. TextDrawHideForPlayer(playerid,FightSystem[fs][fsLoseKills]);
  93. TextDrawHideForPlayer(playerid,FightSystem[fs][fsTime]);
  94. }
  95. }
  96. }GangZoneHideForPlayer(playerid,FightSystem[fs][fsZoneID]);
  97. }DeletePVar(playerid,"Spawned");
  98. return 1;
  99. }
  100. public OnPlayerSpawn(playerid){
  101. if(!GetPVarInt(playerid,"Spawned")){
  102. SetPVarInt(playerid,"Spawned",1);
  103. for(new fs;fs<sizeof(FightSystem);fs++){
  104. if(FightSystem[fs][fsAttackFaction] != -255 && FightSystem[fs][fsFightTime]){
  105. GangZoneFlashForPlayer(playerid,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsAttackFaction]));
  106. if(GetPlayerFaction(playerid) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(playerid) == FightSystem[fs][fsAttackFaction]){
  107. TextDrawShowForPlayer(playerid,Fight);
  108. TextDrawShowForPlayer(playerid,FightOverline);
  109. TextDrawShowForPlayer(playerid,FightUnderline);
  110. TextDrawShowForPlayer(playerid,FightSystem[fs][fsWinFaction]);
  111. TextDrawShowForPlayer(playerid,FightSystem[fs][fsLoseFaction]);
  112. TextDrawShowForPlayer(playerid,FightSystem[fs][fsWinKills]);
  113. TextDrawShowForPlayer(playerid,FightSystem[fs][fsLoseKills]);
  114. TextDrawShowForPlayer(playerid,FightSystem[fs][fsTime]);
  115. }
  116. }
  117. }
  118. }return 1;
  119. }
  120. public OnPlayerDeath(playerid, killerid, reason){
  121. if(IsPlayerConnected(killerid)){
  122. if(IsAFightFaction(GetPlayerFaction(killerid))){
  123. new TempZone = GetPlayerFightzone(killerid);
  124. if(TempZone != -255){
  125. if(FightSystem[TempZone][fsFightTime] && FightSystem[TempZone][fsAttackFaction] != -255){
  126. if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(killerid) || FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(killerid)){
  127. if(IsAFightFaction(GetPlayerFaction(playerid))){
  128. new fsText[64];
  129. if(FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(killerid) && FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid)){
  130. PlayerPlaySound(killerid,1084,0.0,0.0,0.0);
  131. GameTextForPlayer(killerid,"~g~GANGFIGHTKILL",3125,3);
  132. GameTextForPlayer(playerid,"~r~GANGFIGHTKILL",3125,3);
  133. FightSystem[TempZone][fsKillsOfAttack]++;
  134. if(FightSystem[TempZone][fsKillsOfOwner] > FightSystem[TempZone][fsKillsOfAttack]){
  135. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  136. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  137. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  138. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  139. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  140. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  141. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  142. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  143. }
  144. else if(FightSystem[TempZone][fsKillsOfAttack] > FightSystem[TempZone][fsKillsOfOwner]){
  145. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  146. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  147. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  148. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  149. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  150. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  151. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  152. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  153. }else{
  154. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  155. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  156. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  157. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  158. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  159. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  160. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  161. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  162. }
  163. }
  164. else if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(killerid) && FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(playerid)){
  165. PlayerPlaySound(killerid,1084,0.0,0.0,0.0);
  166. GameTextForPlayer(killerid,"~g~GANGFIGHTKILL",3125,3);
  167. GameTextForPlayer(playerid,"~r~GANGFIGHTKILL",3125,3);
  168. FightSystem[TempZone][fsKillsOfOwner]++;
  169. if(FightSystem[TempZone][fsKillsOfOwner] > FightSystem[TempZone][fsKillsOfAttack]){
  170. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  171. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  172. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  173. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  174. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  175. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  176. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  177. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  178. }
  179. else if(FightSystem[TempZone][fsKillsOfAttack] > FightSystem[TempZone][fsKillsOfOwner]){
  180. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  181. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  182. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  183. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  184. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  185. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  186. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  187. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  188. }else{
  189. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  190. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  191. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  192. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  193. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  194. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  195. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  196. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  197. }
  198. }
  199. }
  200. }
  201. }
  202. }
  203. }
  204. }
  205. if(IsAFightFaction(GetPlayerFaction(playerid))){
  206. new TempZone = GetPlayerFightzone(playerid);
  207. if(TempZone != -255){
  208. if(FightSystem[TempZone][fsFightTime] && FightSystem[TempZone][fsAttackFaction] != -255){
  209. if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid) || FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(playerid)){
  210. if(FightSystem[TempZone][fsCTF][0] == playerid){
  211. new fsName[MAX_PLAYER_NAME];
  212. GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
  213. new fsText[128];
  214. format(fsText,sizeof(fsText),">>> Fight <<< | %s hat es nicht geschafft die Flagge zu erobern.",fsName);
  215. for(new i;i<MAX_PLAYERS;i++){
  216. if(IsPlayerConnected(i)){
  217. if(GetPlayerFaction(i) == FightSystem[TempZone][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[TempZone][fsAttackFaction]){
  218. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  219. SendClientMessage(i,FS_COL_YELLOW,fsText);
  220. }
  221. }
  222. }
  223. FightSystem[TempZone][fsCTF][0] = -255;
  224. FightSystem[TempZone][fsCTF][1] = 0;
  225. FightSystem[TempZone][fsCTF][2] = 0;
  226. }
  227. }
  228. }
  229. }
  230. }return 1;
  231. }
  232. public OnPlayerCommandText(playerid, cmdtext[]){
  233. if(strcmp(cmdtext,"/ctf",true)==0){
  234. if(IsAFightFaction(GetPlayerFaction(playerid))){
  235. new TempZone = GetPlayerFightzone(playerid);
  236. if(TempZone != -255){
  237. if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
  238. return SendClientMessage(playerid,FS_COL_GREY,"** Du darfst das nur zu Fuß machen ...");
  239. if(!FightSystem[TempZone][fsFightTime] || FightSystem[TempZone][fsAttackFaction] == -255)
  240. return SendClientMessage(playerid,FS_COL_GREY,"** Hier gibt es nichts zu erobern.");
  241.  
  242. if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid) || FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(playerid)){
  243. if(IsPlayerInRangeOfPoint(playerid,5.0,FightSystem[TempZone][fsCTFx],FightSystem[TempZone][fsCTFy],FightSystem[TempZone][fsCTFz])){
  244. if(FightSystem[TempZone][fsCTF][0] != -255){
  245. if(GetPlayerFaction(FightSystem[TempZone][fsCTF][0]) != GetPlayerFaction(playerid))
  246. SendClientMessage(playerid,FS_COL_GREY,"** Die Flagge wird von deinen Feinden erobert, töte sie zuerst!");
  247. else
  248. SendClientMessage(playerid,FS_COL_GREY,"** Deine Gang / Mafia erobert bereits die Flagge!");
  249. return 1;
  250. }
  251. FightSystem[TempZone][fsCTF][0] = playerid;
  252. new fsName[MAX_PLAYER_NAME];
  253. GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
  254. new fsText[128];
  255. format(fsText,sizeof(fsText),">>> Fight <<< | %s hat begonnen die Flagge zu erobern!",fsName);
  256. for(new i;i<MAX_PLAYERS;i++){
  257. if(IsPlayerConnected(i)){
  258. if(GetPlayerFaction(i) == FightSystem[TempZone][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[TempZone][fsAttackFaction]){
  259. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  260. SendClientMessage(i,FS_COL_YELLOW,fsText);
  261. }
  262. }
  263. }
  264. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist nicht in der nähe der Flagge!");
  265. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist nicht in diesem Fight verwickelt ...");
  266. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keinem Gebiet!");
  267. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keiner Gang / Mafia.");
  268. return 1;
  269. }
  270. if(strcmp(cmdtext,"/invade",true)==0){
  271. if(IsAFightFaction(GetPlayerFaction(playerid))){
  272. for(new fs;fs<sizeof(FightSystem);fs++){
  273. if((FightSystem[fs][fsOwnerFaction] == GetPlayerFaction(playerid) && FightSystem[fs][fsFightTime]) || FightSystem[fs][fsAttackFaction] == GetPlayerFaction(playerid))
  274. return SendClientMessage(playerid,FS_COL_GREY,"** Deine Gang / Mafia ist bereits in einem Fight.");
  275. }
  276. new TempZone = GetPlayerFightzone(playerid);
  277. if(TempZone != -255){
  278. if(!IsAFightFaction(FightSystem[TempZone][fsOwnerFaction]))
  279. return SendClientMessage(playerid,FS_COL_GREY,"Gebiet wurde ausgeschaltet.");
  280. if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid))
  281. return SendClientMessage(playerid,FS_COL_GREY,"** Man greift nicht seine eigenen Leute an.");
  282. if(FightSystem[TempZone][fsFightTime] || FightSystem[TempZone][fsAttackFaction] != -255)
  283. return SendClientMessage(playerid,FS_COL_GREY,"** In diesem Gebiet wird bereits geschossen.");
  284. if(FightSystem[TempZone][fsLastFight]){
  285. new fsText[178];
  286. format(fsText,sizeof(fsText),"Ganggebiet: Dieses Ganggebiet wurde bereits Angegriffen, wartet noch: '%d' Minuten.",FightSystem[TempZone][fsLastFight]);
  287. SendClientMessage(playerid,FS_COL_GREY,fsText);
  288. return 1;
  289. }
  290. for(new fs;fs<sizeof(FightSystem);fs++){
  291. if(FightSystem[fs][fsOwnerFaction] == FightSystem[TempZone][fsOwnerFaction] && FightSystem[fs][fsAttackFaction] != -255)
  292. return SendClientMessage(playerid,FS_COL_GREY,"Ganggebiet: Die Gang / Mafia der das Ganggebiet gehört hat bereits ein Kampf.");
  293. }
  294. new fsTextToOwner[255];
  295. format(fsTextToOwner,sizeof(fsTextToOwner),">>> Fight <<< | Ihr werden von: %s angegriffen, setzt euch zur wehr!",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
  296. new fsName[MAX_PLAYER_NAME];
  297. GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
  298. new fsTextToAttack[255];
  299. format(fsTextToAttack,sizeof(fsTextToAttack),">>> Fight <<< | %s hat ein Kampf mit: %s begonnen, macht sie Platt!",fsName,GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  300. new fsText[64];
  301. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  302. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  303. TextDrawSetString(FightSystem[TempZone][fsWinKills],"~y~00 Kills");
  304. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
  305. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  306. TextDrawSetString(FightSystem[TempZone][fsLoseKills],"~y~00 Kills");
  307. TextDrawSetString(FightSystem[TempZone][fsTime],"Verbl. Zeit: 10 Minuten");
  308. for(new i;i<MAX_PLAYERS;i++){
  309. if(IsPlayerConnected(i)){
  310. GangZoneFlashForPlayer(i,FightSystem[TempZone][fsZoneID],GetZoneColorOfFaction(GetPlayerFaction(playerid)));
  311. if(GetPlayerFaction(i) == FightSystem[TempZone][fsOwnerFaction]){
  312. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  313. SendClientMessage(i,FS_COL_YELLOW,fsTextToOwner);
  314. TextDrawShowForPlayer(i,Fight);
  315. TextDrawShowForPlayer(i,FightOverline);
  316. TextDrawShowForPlayer(i,FightUnderline);
  317. TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinFaction]);
  318. TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinKills]);
  319. TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseFaction]);
  320. TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseKills]);
  321. TextDrawShowForPlayer(i,FightSystem[TempZone][fsTime]);
  322. }
  323. if(GetPlayerFaction(i) == GetPlayerFaction(playerid)){
  324. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  325. SendClientMessage(i,FS_COL_YELLOW,fsTextToAttack);
  326. TextDrawShowForPlayer(i,Fight);
  327. TextDrawShowForPlayer(i,FightOverline);
  328. TextDrawShowForPlayer(i,FightUnderline);
  329. TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinFaction]);
  330. TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinKills]);
  331. TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseFaction]);
  332. TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseKills]);
  333. TextDrawShowForPlayer(i,FightSystem[TempZone][fsTime]);
  334. }
  335. }
  336. }
  337. FightSystem[TempZone][fsAttackFaction] = GetPlayerFaction(playerid);
  338. FightSystem[TempZone][fsKillsOfOwner] = 0;
  339. FightSystem[TempZone][fsKillsOfAttack] = 0;
  340. FightSystem[TempZone][fsFightTime] = 10;
  341. FightSystem[TempZone][fsCTF][0] = -255;
  342. FightSystem[TempZone][fsCTF][1] = 0;
  343. FightSystem[TempZone][fsCTF][2] = 0;
  344. return 1;
  345. }return SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keinem Gebiet!");
  346. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keiner Gang / Mafia.");
  347. return 1;
  348. }return 0;
  349. }
  350. public FightUpdate_1(){
  351. for(new fs;fs<sizeof(FightSystem);fs++){
  352. if(FightSystem[fs][fsFightTime] && FightSystem[fs][fsAttackFaction] != -255){
  353. new fsText[128];
  354. if(FightSystem[fs][fsCTF][0] != -255){
  355. if(IsPlayerConnected(FightSystem[fs][fsCTF][0])){
  356. if(IsPlayerInRangeOfPoint(FightSystem[fs][fsCTF][0],5.0,FightSystem[fs][fsCTFx],FightSystem[fs][fsCTFy],FightSystem[fs][fsCTFz])){
  357. FightSystem[fs][fsCTF][2] = 0;
  358. FightSystem[fs][fsCTF][1]++;
  359. format(fsText,sizeof(fsText),"~n~~n~~n~~n~~n~~n~~n~~w~Bonus in:~n~~r~%d ~w~Sekunden",(60-FightSystem[fs][fsCTF][1]));
  360. GameTextForPlayer(FightSystem[fs][fsCTF][0],fsText,1250,3);
  361. if(FightSystem[fs][fsCTF][1] >= 60){
  362. new fsName[MAX_PLAYER_NAME];
  363. GetPlayerName(FightSystem[fs][fsCTF][0],fsName,MAX_PLAYER_NAME);
  364. FightSystem[fs][fsCTF][1] = 0;
  365. format(fsText,sizeof(fsText),">>> Fight <<< | %s hat die Flagge erobert!",fsName);
  366. for(new i;i<MAX_PLAYERS;i++){
  367. if(IsPlayerConnected(i)){
  368. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction]){
  369. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  370. SendClientMessage(i,FS_COL_YELLOW,fsText);
  371. }
  372. }
  373. }
  374. if(GetPlayerFaction(FightSystem[fs][fsCTF][0]) == FightSystem[fs][fsOwnerFaction])
  375. FightSystem[fs][fsKillsOfOwner]++;
  376. if(GetPlayerFaction(FightSystem[fs][fsCTF][0]) == FightSystem[fs][fsAttackFaction])
  377. FightSystem[fs][fsKillsOfAttack]++;
  378. if(FightSystem[fs][fsKillsOfOwner] > FightSystem[fs][fsKillsOfAttack]){
  379. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  380. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  381. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  382. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  383. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  384. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  385. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  386. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  387. }
  388. else if(FightSystem[fs][fsKillsOfAttack] > FightSystem[fs][fsKillsOfOwner]){
  389. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  390. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  391. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  392. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  393. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  394. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  395. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  396. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  397. }else{
  398. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  399. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  400. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  401. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  402. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  403. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  404. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  405. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  406. }FightSystem[fs][fsCTF][0] = -255;
  407. }
  408. }else{
  409. format(fsText,sizeof(fsText),"~n~~n~~n~~n~~n~~n~~n~~r~Erobere die Flagge!~n~~b~%d Sekunden",(10-FightSystem[fs][fsCTF][2]));
  410. GameTextForPlayer(FightSystem[fs][fsCTF][0],fsText,1250,3);
  411. FightSystem[fs][fsCTF][2]++;
  412. if(FightSystem[fs][fsCTF][2] >= 10){
  413. new fsName[MAX_PLAYER_NAME];
  414. GetPlayerName(FightSystem[fs][fsCTF][0],fsName,MAX_PLAYER_NAME);
  415. format(fsText,sizeof(fsText),">>> Fight <<< | %s hat es nicht geschafft die Flagge zu erobern!",fsName);
  416. for(new i;i<MAX_PLAYERS;i++){
  417. if(IsPlayerConnected(i)){
  418. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction]){
  419. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  420. SendClientMessage(i,FS_COL_YELLOW,fsText);
  421. }
  422. }
  423. }
  424. FightSystem[fs][fsCTF][0] = -255;
  425. FightSystem[fs][fsCTF][1] = 0;
  426. FightSystem[fs][fsCTF][2] = 0;
  427. }
  428. }
  429. }else{
  430. FightSystem[fs][fsCTF][0] = -255;
  431. FightSystem[fs][fsCTF][1] = 0;
  432. FightSystem[fs][fsCTF][2] = 0;
  433. }
  434. }
  435. }
  436. }return 1;
  437. }
  438. public FightUpdate_2(){
  439. for(new fs;fs<sizeof(FightSystem);fs++){
  440. if(FightSystem[fs][fsFightTime]){
  441. FightSystem[fs][fsFightTime]--;
  442. new fsText[64];
  443. format(fsText,sizeof(fsText),"Verbl. Zeit: %d Minuten",FightSystem[fs][fsFightTime]);
  444. TextDrawSetString(FightSystem[fs][fsTime],fsText);
  445. if(!FightSystem[fs][fsFightTime]){
  446. FightSystem[fs][fsLastFight] = 1440;
  447. new fsTextToOwner[255];
  448. new fsTextToAttack[255];
  449. new fsType;
  450. if(FightSystem[fs][fsKillsOfOwner] > FightSystem[fs][fsKillsOfAttack]){
  451. fsType = 2;
  452. format(fsTextToOwner,sizeof(fsTextToOwner),">>> Fight <<< | Ihr habt gewonnen...");
  453. format(fsTextToAttack,sizeof(fsTextToAttack),">>> Fight <<< | Ihr habt verloren...");
  454. }
  455. else if(FightSystem[fs][fsKillsOfAttack] > FightSystem[fs][fsKillsOfOwner]){
  456. fsType = 3;
  457. format(fsTextToOwner,sizeof(fsTextToOwner),">>> Fight <<< | Ihr habt verloren...");
  458. format(fsTextToAttack,sizeof(fsTextToAttack),">>> Fight <<< | Ihr habt gewonnen...");
  459. }else{
  460. fsType = 1;
  461. format(fsTextToOwner,sizeof(fsTextToOwner),">>> Fight <<< | Unentschieden, ihr behaltet euer gebiet.");
  462. format(fsTextToAttack,sizeof(fsTextToAttack),">>> Fight <<< | Unentschieden, ihr müsst euch mehr antrengen.");
  463. }
  464. for(new i;i<MAX_PLAYERS;i++){
  465. if(IsPlayerConnected(i)){
  466. GangZoneStopFlashForPlayer(i,FightSystem[fs][fsZoneID]);
  467. if(fsType == 3){
  468. GangZoneHideForPlayer(i,FightSystem[fs][fsZoneID]);
  469. GangZoneShowForPlayer(i,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsAttackFaction]));
  470. }
  471. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction]){
  472. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  473. TextDrawHideForPlayer(i,Fight);
  474. TextDrawHideForPlayer(i,FightOverline);
  475. TextDrawHideForPlayer(i,FightUnderline);
  476. TextDrawHideForPlayer(i,FightSystem[fs][fsWinFaction]);
  477. TextDrawHideForPlayer(i,FightSystem[fs][fsWinKills]);
  478. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseFaction]);
  479. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseKills]);
  480. TextDrawHideForPlayer(i,FightSystem[fs][fsTime]);
  481. SendClientMessage(i,FS_COL_YELLOW,fsTextToOwner);
  482. if(fsType == 3 && GetPlayerFightzone(i) == fs)
  483. SetPlayerHealth(i,0.0);
  484. }
  485. else if(GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction]){
  486. PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
  487. TextDrawHideForPlayer(i,Fight);
  488. TextDrawHideForPlayer(i,FightOverline);
  489. TextDrawHideForPlayer(i,FightUnderline);
  490. TextDrawHideForPlayer(i,FightSystem[fs][fsWinFaction]);
  491. TextDrawHideForPlayer(i,FightSystem[fs][fsWinKills]);
  492. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseFaction]);
  493. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseKills]);
  494. TextDrawHideForPlayer(i,FightSystem[fs][fsTime]);
  495. SendClientMessage(i,FS_COL_YELLOW,fsTextToAttack);
  496. if(fsType != 3 && GetPlayerFightzone(i) == fs)
  497. SetPlayerHealth(i,0.0);
  498. }
  499. }
  500. }
  501. FightSystem[fs][fsKillsOfAttack] = 0;
  502. FightSystem[fs][fsKillsOfOwner] = 0;
  503. if(fsType == 3)
  504. FightSystem[fs][fsOwnerFaction] = FightSystem[fs][fsAttackFaction];
  505. FightSystem[fs][fsAttackFaction] = -255;
  506. FightSystem[fs][fsCTF][0] = -255;
  507. }
  508. }
  509. if(FightSystem[fs][fsLastFight])
  510. FightSystem[fs][fsLastFight]--;
  511. }return 1;
  512. }
  513. public Fight_Init(){
  514. Fight = TextDrawCreate(91.000000,275.000000,"Gangfight:~n~_~n~_~n~_~n~_");
  515. TextDrawUseBox(Fight,1);
  516. TextDrawBoxColor(Fight,0x00000066);
  517. TextDrawTextSize(Fight,1.000000,136.000000);
  518. TextDrawAlignment(Fight,2);
  519. TextDrawFont(Fight,0);
  520. TextDrawLetterSize(Fight,1.000000,1.300000);
  521. TextDrawColor(Fight,0xff0000ff);
  522. TextDrawSetOutline(Fight,1);
  523. TextDrawSetProportional(Fight,1);
  524. TextDrawBackgroundColor(Fight,0x000000ff);
  525. FightOverline = TextDrawCreate(94.000000,286.000000,".");
  526. TextDrawAlignment(FightOverline,2);
  527. TextDrawFont(FightOverline,3);
  528. TextDrawLetterSize(FightOverline,16.199998,0.699999);
  529. TextDrawColor(FightOverline,0xff0000ff);
  530. TextDrawSetProportional(FightOverline,1);
  531. TextDrawBackgroundColor(FightOverline,0x000000ff);
  532. FightUnderline = TextDrawCreate(95.000000,315.000000,".");
  533. TextDrawAlignment(FightUnderline,2);
  534. TextDrawFont(FightUnderline,3);
  535. TextDrawLetterSize(FightUnderline,16.300003,0.799999);
  536. TextDrawColor(FightUnderline,0xff0000ff);
  537. TextDrawSetProportional(FightUnderline,1);
  538. TextDrawBackgroundColor(FightUnderline,0x000000ff);
  539. if(!fexist("Fightzones.cfg")){
  540. new File:fFile=fopen("Fightzones.cfg",io_write);
  541. for(new fs;fs<sizeof(FightSystem);fs++)
  542. fwrite(fFile,"1 -255 0 0 0\r\n");
  543. fclose(fFile);
  544. }
  545. new File:fFile=fopen("Fightzones.cfg",io_read),Content[64],fs;
  546. while(fread(fFile,Content) && fs < sizeof(FightSystem)){
  547. FightSystem[fs][fsWinFaction] = TextDrawCreate(25.000000,294.000000," ");
  548. TextDrawAlignment(FightSystem[fs][fsWinFaction],1);
  549. TextDrawBackgroundColor(FightSystem[fs][fsWinFaction],0x000000ff);
  550. TextDrawFont(FightSystem[fs][fsWinFaction],2);
  551. TextDrawLetterSize(FightSystem[fs][fsWinFaction],0.199999,1.000000);
  552. TextDrawColor(FightSystem[fs][fsWinFaction],0xffff00ff);
  553. TextDrawSetProportional(FightSystem[fs][fsWinFaction],1);
  554. FightSystem[fs][fsLoseFaction] = TextDrawCreate(25.000000,307.000000," ");
  555. TextDrawAlignment(FightSystem[fs][fsLoseFaction],1);
  556. TextDrawBackgroundColor(FightSystem[fs][fsLoseFaction],0x000000ff);
  557. TextDrawFont(FightSystem[fs][fsLoseFaction],2);
  558. TextDrawLetterSize(FightSystem[fs][fsLoseFaction],0.199999,1.000000);
  559. TextDrawColor(FightSystem[fs][fsLoseFaction],0xffff00ff);
  560. TextDrawSetProportional(FightSystem[fs][fsLoseFaction],1);
  561. FightSystem[fs][fsWinKills] = TextDrawCreate(106.000000,294.000000," ");
  562. TextDrawAlignment(FightSystem[fs][fsWinKills],0);
  563. TextDrawFont(FightSystem[fs][fsWinKills],2);
  564. TextDrawLetterSize(FightSystem[fs][fsWinKills],0.199999,1.000000);
  565. TextDrawBackgroundColor(FightSystem[fs][fsWinKills],0x000000ff);
  566. TextDrawColor(FightSystem[fs][fsWinKills],0xffff00ff);
  567. TextDrawSetProportional(FightSystem[fs][fsWinKills],1);
  568. FightSystem[fs][fsLoseKills] = TextDrawCreate(106.000000,307.000000," ");
  569. TextDrawAlignment(FightSystem[fs][fsLoseKills],0);
  570. TextDrawBackgroundColor(FightSystem[fs][fsLoseKills],0x000000ff);
  571. TextDrawFont(FightSystem[fs][fsLoseKills],2);
  572. TextDrawLetterSize(FightSystem[fs][fsLoseKills],0.199999,1.000000);
  573. TextDrawColor(FightSystem[fs][fsLoseKills],0xffff00ff);
  574. TextDrawSetProportional(FightSystem[fs][fsLoseKills],1);
  575. FightSystem[fs][fsTime] = TextDrawCreate(24.000000,323.000000," ");
  576. TextDrawAlignment(FightSystem[fs][fsTime],1);
  577. TextDrawBackgroundColor(FightSystem[fs][fsTime],0x000000ff);
  578. TextDrawFont(FightSystem[fs][fsTime],2);
  579. TextDrawLetterSize(FightSystem[fs][fsTime],0.199999,1.000000);
  580. TextDrawColor(FightSystem[fs][fsTime],0xff0000ff);
  581. TextDrawSetProportional(FightSystem[fs][fsTime],1);
  582. StripNewLine(Content);
  583. sscanf(Content,"dddddd",FightSystem[fs][fsOwnerFaction],FightSystem[fs][fsAttackFaction],FightSystem[fs][fsKillsOfOwner],FightSystem[fs][fsKillsOfAttack],FightSystem[fs][fsFightTime],FightSystem[fs][fsLastFight]);
  584. FightSystem[fs][fsCTF][0] = -255;
  585. FightSystem[fs][fsCTF][1] = 0;
  586. FightSystem[fs][fsCTF][2] = 0;
  587. FightSystem[fs][fsZoneID] = GangZoneCreate(FightSystem[fs][fsMinX],FightSystem[fs][fsMinY],FightSystem[fs][fsMaxX],FightSystem[fs][fsMaxY]);
  588. FightSystem[fs][fsFlag] = CreatePickup(1314,1,FightSystem[fs][fsCTFx],FightSystem[fs][fsCTFy],FightSystem[fs][fsCTFz],-1);
  589. if(FightSystem[fs][fsFightTime] && FightSystem[fs][fsAttackFaction] != -255){
  590. new fsText[64];
  591. format(fsText,sizeof(fsText),"Verbl. Zeit: %d Minuten",FightSystem[fs][fsFightTime]);
  592. TextDrawSetString(FightSystem[fs][fsTime],fsText);
  593. if(FightSystem[fs][fsKillsOfOwner] > FightSystem[fs][fsKillsOfAttack]){
  594. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  595. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  596. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  597. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  598. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  599. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  600. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  601. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  602. }
  603. else if(FightSystem[fs][fsKillsOfAttack] > FightSystem[fs][fsKillsOfOwner]){
  604. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  605. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  606. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  607. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  608. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  609. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  610. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  611. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  612. }else{
  613. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  614. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  615. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  616. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  617. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  618. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  619. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  620. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  621. }
  622. }
  623. for(new i;i<MAX_PLAYERS;i++){
  624. if(IsPlayerConnected(i)){
  625. SetPVarInt(i,"Spawned",1);
  626. GangZoneShowForPlayer(i,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsOwnerFaction]));
  627. if(FightSystem[fs][fsAttackFaction] && FightSystem[fs][fsFightTime]){
  628. GangZoneFlashForPlayer(i,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsAttackFaction]));
  629. if(GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction] || GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction]){
  630. TextDrawShowForPlayer(i,Fight);
  631. TextDrawShowForPlayer(i,FightOverline);
  632. TextDrawShowForPlayer(i,FightUnderline);
  633. TextDrawShowForPlayer(i,FightSystem[fs][fsWinFaction]);
  634. TextDrawShowForPlayer(i,FightSystem[fs][fsLoseFaction]);
  635. TextDrawShowForPlayer(i,FightSystem[fs][fsWinKills]);
  636. TextDrawShowForPlayer(i,FightSystem[fs][fsLoseKills]);
  637. TextDrawShowForPlayer(i,FightSystem[fs][fsTime]);
  638. }
  639. }
  640. }
  641. }fs++;
  642. }
  643. fclose(fFile);
  644. FightTimer[0] = SetTimer("FightUpdate_1",1003,true);
  645. FightTimer[1] = SetTimer("FightUpdate_2",60017,true);
  646. return 1;
  647. }
  648. public Fight_Close(){
  649. KillTimer(FightTimer[0]);
  650. KillTimer(FightTimer[1]);
  651. if(fexist("Fightzones.cfg")) fremove("Fightzones.cfg");
  652. new File:fFile=fopen("Fightzones.cfg",io_append),Content[64];
  653. for(new fs;fs<sizeof(FightSystem);fs++){
  654. if(FightSystem[fs][fsAttackFaction] != -255 && FightSystem[fs][fsFightTime]){
  655. GangZoneStopFlashForAll(FightSystem[fs][fsZoneID]);
  656. for(new i;i<MAX_PLAYERS;i++){
  657. if(IsPlayerConnected(i)){
  658. DeletePVar(i,"Spawned");
  659. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction]){
  660. TextDrawHideForPlayer(i,Fight);
  661. TextDrawHideForPlayer(i,FightOverline);
  662. TextDrawHideForPlayer(i,FightUnderline);
  663. TextDrawHideForPlayer(i,FightSystem[fs][fsWinFaction]);
  664. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseFaction]);
  665. TextDrawHideForPlayer(i,FightSystem[fs][fsWinKills]);
  666. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseKills]);
  667. TextDrawHideForPlayer(i,FightSystem[fs][fsTime]);
  668. }
  669. }
  670. }
  671. }
  672. TextDrawDestroy(FightSystem[fs][fsWinFaction]);
  673. TextDrawDestroy(FightSystem[fs][fsLoseFaction]);
  674. TextDrawDestroy(FightSystem[fs][fsWinKills]);
  675. TextDrawDestroy(FightSystem[fs][fsLoseKills]);
  676. TextDrawDestroy(FightSystem[fs][fsTime]);
  677. GangZoneHideForAll(FightSystem[fs][fsZoneID]);
  678. GangZoneDestroy(FightSystem[fs][fsZoneID]);
  679. DestroyPickup(FightSystem[fs][fsFlag]);
  680. format(Content,sizeof(Content),"%d %d %d %d %d %d\r\n",FightSystem[fs][fsOwnerFaction],FightSystem[fs][fsAttackFaction],FightSystem[fs][fsKillsOfOwner],FightSystem[fs][fsKillsOfAttack],FightSystem[fs][fsFightTime],FightSystem[fs][fsLastFight]);
  681. fwrite(fFile,Content);
  682. }
  683. fclose(fFile);
  684. TextDrawDestroy(Fight);
  685. TextDrawDestroy(FightOverline);
  686. TextDrawDestroy(FightUnderline);
  687. return 1;
  688. }
  689. stock GetPlayerFightzone(playerid){
  690. new Float:GangZone[3];
  691. GetPlayerPos(playerid,GangZone[0],GangZone[1],GangZone[2]);
  692. for(new fs;fs<sizeof(FightSystem);fs++){
  693. if((GangZone[0] >= FightSystem[fs][fsMinX] && GangZone[0] <= FightSystem[fs][fsMaxX]) && (GangZone[1] >= FightSystem[fs][fsMinY] && GangZone[1] <= FightSystem[fs][fsMaxY]) && GangZone[2] <= 500)
  694. return fs;
  695. }return -255;
  696. }
  697. stock IsAFightFaction(Faction){
  698. if(Faction == 8) return true;
  699. if(Faction == 9) return true;
  700. if(Faction == 10) return true;
  701. if(Faction == 11) return true;
  702. if(Faction == 12) return true;
  703. if(Faction == 16) return true;
  704. if(Faction == 17) return true;
  705. if(Faction == 18) return true;
  706. if(Faction == 21) return true;
  707. return false;
  708. }
  709. stock GetZoneColorOfFaction(Faction){
  710. if(Faction == 8) return 0xFFFFFFFF;
  711. else if(Faction == 9) return 0x8C8C8CFF;
  712. else if(Faction == 10) return 0xFF00A5FF;
  713. else if(Faction == 11) return 0x00FF0AFF;
  714. else if(Faction == 12) return 0xA5FF00FF;
  715. else if(Faction == 16) return 0xFF8C00FF;
  716. else if(Faction == 17) return 0xFFBE00FF;
  717. else if(Faction == 18) return 0xFF6400FF;
  718. else if(Faction == 21) return 0xFF6200FF;
  719. else return 0x00000000;//NoN-Gang
  720. }
  721. stock GetFactionNameOfFaction(Faction){
  722. new FactionName[64];
  723. if(Faction == 8) format(FactionName,sizeof(FactionName),"Russenmafia");
  724. else if(Faction == 9) format(FactionName,sizeof(FactionName),"Yakuza");
  725. else if(Faction == 10) format(FactionName,sizeof(FactionName),"Ballas");
  726. else if(Faction == 11) format(FactionName,sizeof(FactionName),"Grove Street");
  727. else if(Faction == 12) format(FactionName,sizeof(FactionName),"Uzunu Clan");
  728. else if(Faction == 16) format(FactionName,sizeof(FactionName),"Punkx Bikergang");
  729. else if(Faction == 17) format(FactionName,sizeof(FactionName),"Aztecas");
  730. else if(Faction == 18) format(FactionName,sizeof(FactionName),"Vagos");
  731. else if(Faction == 21) format(FactionName,sizeof(FactionName),"Al Qaida");
  732. else format(FactionName,sizeof(FactionName),"NoN-Gang");
  733. return FactionName;
  734. }
  735. stock GetPlayerFaction(playerid){
  736. new Member = CallRemoteFunction("GetPlayerMember","i",playerid);
  737. if(Member)
  738. return Member;
  739. new Leader = CallRemoteFunction("GetPlayerLeader","i",playerid);
  740. if(Leader)
  741. return Leader;
  742. return 0;
  743. }
  744. stock sscanf(string[],format[],{Float,_}:...){
  745. new formatPos=0,stringPos=0,paramPos=2,paramCount=numargs();
  746. while(paramPos < paramCount && string[stringPos]){
  747. switch (format[formatPos++]){
  748. case '\0':{return 0;}case 'i','d':{
  749. new neg=1,num=0,ch=string[stringPos];
  750. if(ch=='-'){neg=-1;ch=string[++stringPos];}
  751. do{ stringPos++;
  752. if(ch>='0'&&ch<='9'){num=(num*10)+(ch-'0');}else{return 1;}
  753. }while((ch=string[stringPos])&&ch!=' ');setarg(paramPos,0,num*neg);}
  754. case 'h','x':{
  755. new ch,num=0;while((ch=string[stringPos++])){
  756. switch (ch){
  757. case 'x','X':{num=0;continue;}case '0'..'9':{num=(num<<4)|(ch-'0');}
  758. case 'a'..'f':{num=(num<<4)|(ch-('a'-10));}case 'A'..'F':{num=(num<<4)|(ch-('A'-10));}
  759. case ' ':{break;}default:{return 1;}}
  760. }setarg(paramPos,0,num);}
  761. case 'c':{setarg(paramPos,0,string[stringPos++]);}
  762. case 'f':{
  763. new tmp[25];
  764. strmid(tmp,string,stringPos,stringPos+sizeof(tmp)-2);
  765. setarg(paramPos,0,_:floatstr(tmp));}
  766. case 's','z':{
  767. new i=0,ch;
  768. if(format[formatPos]){
  769. while ((ch=string[stringPos++])&&ch!=' '){
  770. setarg(paramPos,i++,ch);
  771. }if(!i)return 1;
  772. }else{while((ch=string[stringPos++])){setarg(paramPos,i++,ch);}
  773. }stringPos--;setarg(paramPos,i,'\0');
  774. }default:{continue;}}
  775. while(string[stringPos]&&string[stringPos]!=' '){stringPos++;}
  776. while(string[stringPos]==' '){stringPos++;}
  777. paramPos++;}
  778. while(format[formatPos]=='z')formatPos++;
  779. return format[formatPos];
  780. }
  781. stock StripNewLine(string[]){
  782. new len=strlen(string);
  783. if(string[0]==0) return ;
  784. if((string[len-1]=='\n')||(string[len - 1]=='\r')){
  785. string[len - 1] = 0;
  786. if(string[0]==0) return ;
  787. if((string[len-2]=='\n')||(string[len-2]=='\r')) string[len-2]=0;
  788. }
  789. }
  790. AntiDeAMX(){
  791. new a[][]={
  792. "Unarmed (Fist)",
  793. "Brass K"
  794. };
  795. #pragma unused a
  796. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement