Guest User

saf12edfwt43g54z4g3fcaegerhae

a guest
Mar 9th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 62.27 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define FS_COL_GREY (0xFF2800FF)
  4. #define FS_COL_YELLOW (0xFFAA00FF)
  5. #define GANGFIGHT_DAUER 30 //Standart :60 Minuten
  6. #pragma tabsize 0
  7.  
  8.  
  9.  
  10. // Die folgenden beiden Funktionen in den Gamemode einfügen
  11. /*
  12. forward GetPlayerMember(playerid);
  13. public GetPlayerMember(playerid)
  14. {
  15. return PlayerInfo[playerid][pMember];
  16. }
  17. forward GetPlayerLeader(playerid);
  18. public GetPlayerLeader(playerid)
  19. {
  20. return PlayerInfo[playerid][pLeader];
  21. }
  22. */
  23.  
  24. stock GetZoneColorOfFaction(Faction){
  25. if(Faction == 5) return 0x19000095; // LCN
  26. else if(Faction == 6) return 0xF0F0F0CA; // Yakuza
  27. else if(Faction == 8) return 0x73000095; // Hitman
  28. else if(Faction == 12) return 0x82828295; // Triaden
  29. else if(Faction == 13) return 0xB9009D95; // Ballas
  30. else if(Faction == 14) return 0x008C009D; // Groove
  31. else if(Faction == 15) return 0x00FF9395; // Biker
  32. else if(Faction == 16) return 0xFFBE0095; // Vagos
  33. else if(Faction == 17) return 0x56FFFF95; // Aztekas
  34. else if(Faction == 18) return 0xFF460095; // Rifas
  35. else if(Faction == 19) return 0xFFAA00D6; // Carli Kartell
  36. else if(Faction == 21) return 0x00FF0095; // Wheelman
  37. else if(Faction == 23) return 0x14141495; // Brigada
  38.  
  39. else return 0x00FFB4FF; // NoN-Gang
  40. }
  41. stock GetFactionNameOfFaction(Faction){
  42. new FactionName[64];
  43. if(Faction == 5) format(FactionName,sizeof(FactionName),"LCN");
  44. else if(Faction == 6) format(FactionName,sizeof(FactionName),"Yakuza");
  45. else if(Faction == 8) format(FactionName,sizeof(FactionName),"Hitman");
  46. else if(Faction == 12) format(FactionName,sizeof(FactionName),"Triaden");
  47. else if(Faction == 13) format(FactionName,sizeof(FactionName),"Ballas");
  48. else if(Faction == 14) format(FactionName,sizeof(FactionName),"Groove");
  49. else if(Faction == 15) format(FactionName,sizeof(FactionName),"Biker");
  50. else if(Faction == 16) format(FactionName,sizeof(FactionName),"Vagos");
  51. else if(Faction == 17) format(FactionName,sizeof(FactionName),"Aztecas");
  52. else if(Faction == 18) format(FactionName,sizeof(FactionName),"Rifas");
  53. else if(Faction == 19) format(FactionName,sizeof(FactionName),"Carli Kartell");
  54. else if(Faction == 21) format(FactionName,sizeof(FactionName),"Wheelman");
  55. else if(Faction == 23) format(FactionName,sizeof(FactionName),"Brigada");
  56. else format(FactionName,sizeof(FactionName),"NoN-Gang");
  57. return FactionName;
  58. }
  59. stock IsAFightFaction(Faction){
  60. if(Faction == 5 ||Faction == 6 ||Faction == 8 || (Faction >= 12 && Faction <= 19) || Faction == 21|| Faction == 23)
  61. return 1;
  62. return 0;
  63. }
  64.  
  65. forward Fight_Init();
  66. forward Fight_Close();
  67. forward FightUpdate_1();
  68. forward FightUpdate_2();
  69.  
  70. enum fsSyS{
  71. Float:fsMinX,
  72. Float:fsMinY,
  73. Float:fsMaxX,
  74. Float:fsMaxY,
  75. Float:fsCTFx,
  76. Float:fsCTFy,
  77. Float:fsCTFz,
  78. fsOwnerFaction,
  79. fsAttackFaction,
  80. fsKillsOfOwner,
  81. fsKillsOfAttack,
  82. fsFightTime,
  83. fsCTF[3],
  84. fsLastFight,
  85. fsZoneID,
  86. fsFlag,
  87. Text:fsWinFaction,
  88. Text:fsLoseFaction,
  89. Text:fsWinKills,
  90. Text:fsLoseKills,
  91. Text:fsTime
  92. };
  93. new FightSystem[14][fsSyS]={
  94. /*MinX, MinY, MaxX, MaxY, CTFx, CTFy, CTFz*/
  95. {1060.145,-1721.339,1166.624,-1583.168,1072.4016,-1619.3834,20.4583},//Kaufhaus
  96. {-887.5186,1377.989,-583.8938,1634.903,-813.6335,1525.2080,26.5065},//Wüste (EDIT)
  97. {116.9961,-206.6548,325.0713,23.0153,184.0991,-132.7829,1.5781},//NÄHE BAUERNHOFF!
  98. {-1850.044,1438.284,-1710.987,1584.248,-1789.1478,1543.3608,7.1875},//Hafen
  99. {2757.3616,2282.8716,2918.1382,2555.8530,2834.3164,2345.0874,10.8130},//LV EINKAUFSZENTRUM!
  100. {2559.6809,-2564.0767,2809.9153,-2330.7429,2773.5503,-2503.6750,13.6346},//DOGS!
  101. {1828.318,-1938.465,2071.699,-1760.817,1958.6156,-1853.2424,4.3392},//Tankstelle (GS)
  102. {990.2909,1821.38,1177.724,2057.332,1067.5798,1884.2932,10.8203},//Container
  103. {-2506.7,740.0255,-2383.094,826.8147,2459.4094,787.3281,35.1719},//Markt
  104. {-1891.4263,857.8361,-1722.0261,1095.5897,-1720.0752,1018.2902,17.5859},//Bank
  105. {-2740.5977,344.5840,-2671.9817,406.6133,-2706.5498,376.1853,4.9687},//sf stadthalle...
  106. {1854.8732,-1471.0433,1947.8140,-1367.2166,1886.1451,-1425.1245,10.3594},//SKATE PARK!
  107. {2824.4021,-1485.0060,2785.6079,-1415.1707,2792.3425,-1429.5293,36.0938},//Parkhaus LS
  108. {2286.1406,-2260.2925,2061.2966,-2304.4919,2151.2476,-2255.7471,13.2985}//Hafen-LS
  109. //{}//ENDE!
  110.  
  111. };
  112. new Text:Fight,Text:FightUnderline;
  113. new FightTimer[2];
  114.  
  115. public OnFilterScriptInit(){
  116. Fight_Init();
  117. return 1;
  118. }
  119. public OnFilterScriptExit(){
  120. Fight_Close();
  121. return 1;
  122. }
  123. public OnPlayerConnect(playerid){
  124. SetPVarInt(playerid,"Spawned",0);
  125. for(new fs;fs<sizeof(FightSystem);fs++){
  126. GangZoneShowForPlayer(playerid,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsOwnerFaction]));
  127. }return 1;
  128. }
  129. public OnPlayerDisconnect(playerid, reason){
  130. for(new fs;fs<sizeof(FightSystem);fs++){
  131. if(FightSystem[fs][fsAttackFaction] != -255 && FightSystem[fs][fsFightTime]){
  132. if(FightSystem[fs][fsCTF][0] != -255 && FightSystem[fs][fsCTF][0] == playerid){
  133. new fsName[MAX_PLAYER_NAME];
  134. GetPlayerName(FightSystem[fs][fsCTF][0],fsName,MAX_PLAYER_NAME);
  135. new fsText[128];
  136. format(fsText,sizeof(fsText),"-|War Info: %s hat es leider nicht geschafft die Flagge zu erobern!",fsName);
  137. for(new i;i<MAX_PLAYERS;i++){
  138. if(IsPlayerConnected(i)){
  139. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction]){
  140. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  141. SendClientMessage(i,FS_COL_YELLOW,fsText);
  142. }
  143. }
  144. }
  145. FightSystem[fs][fsCTF][0] = -255;
  146. FightSystem[fs][fsCTF][1] = 0;
  147. FightSystem[fs][fsCTF][2] = 0;
  148. }
  149. if(GetPVarInt(playerid,"Spawned")==1){
  150. GangZoneStopFlashForPlayer(playerid,FightSystem[fs][fsZoneID]);
  151. if(GetPlayerFaction(playerid) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(playerid) == FightSystem[fs][fsAttackFaction]){
  152. TextDrawHideForPlayer(playerid,Fight);
  153. TextDrawHideForPlayer(playerid,FightUnderline);
  154. TextDrawHideForPlayer(playerid,FightSystem[fs][fsWinFaction]);
  155. TextDrawHideForPlayer(playerid,FightSystem[fs][fsLoseFaction]);
  156. TextDrawHideForPlayer(playerid,FightSystem[fs][fsWinKills]);
  157. TextDrawHideForPlayer(playerid,FightSystem[fs][fsLoseKills]);
  158. TextDrawHideForPlayer(playerid,FightSystem[fs][fsTime]);
  159. }
  160. }
  161. }GangZoneHideForPlayer(playerid,FightSystem[fs][fsZoneID]);
  162. }DeletePVar(playerid,"Spawned");
  163. return 1;
  164. }
  165. public OnPlayerSpawn(playerid){
  166. if(GetPVarInt(playerid,"Spawned")==0)
  167. {
  168. SetPVarInt(playerid,"Spawned",1);
  169. for(new fs;fs<sizeof(FightSystem);fs++)
  170. {
  171. if(FightSystem[fs][fsAttackFaction] != -255 && FightSystem[fs][fsFightTime])
  172. {
  173. GangZoneFlashForPlayer(playerid,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsAttackFaction]));
  174. if(GetPlayerFaction(playerid) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(playerid) == FightSystem[fs][fsAttackFaction])
  175. {
  176. TextDrawShowForPlayer(playerid,Fight);
  177. TextDrawShowForPlayer(playerid,FightUnderline);
  178. TextDrawShowForPlayer(playerid,FightSystem[fs][fsWinFaction]);
  179. TextDrawShowForPlayer(playerid,FightSystem[fs][fsLoseFaction]);
  180. TextDrawShowForPlayer(playerid,FightSystem[fs][fsWinKills]);
  181. TextDrawShowForPlayer(playerid,FightSystem[fs][fsLoseKills]);
  182. TextDrawShowForPlayer(playerid,FightSystem[fs][fsTime]);
  183. }
  184. }
  185. }
  186. }return 1;
  187. }if(GetPVarInt(playerid,"Spawned")==0)
  188. {
  189. SetPVarInt(playerid,"Spawned",1);
  190. for(new fs;fs<sizeof(FightSystem);fs++)
  191. {
  192. if(FightSystem[fs][fsAttackFaction] != -255 && FightSystem[fs][fsFightTime])
  193. {
  194. GangZoneFlashForPlayer(playerid,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsAttackFaction]));
  195. if(GetPlayerFaction(playerid) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(playerid) == FightSystem[fs][fsAttackFaction])
  196. {
  197. TextDrawShowForPlayer(playerid,Fight);
  198. TextDrawShowForPlayer(playerid,FightUnderline);
  199. TextDrawShowForPlayer(playerid,FightSystem[fs][fsWinFaction]);
  200. TextDrawShowForPlayer(playerid,FightSystem[fs][fsLoseFaction]);
  201. TextDrawShowForPlayer(playerid,FightSystem[fs][fsWinKills]);
  202. TextDrawShowForPlayer(playerid,FightSystem[fs][fsLoseKills]);
  203. TextDrawShowForPlayer(playerid,FightSystem[fs][fsTime]);
  204. }
  205. }
  206. }
  207. }
  208. public OnPlayerDeath(playerid, killerid, reason)
  209. {
  210. if(IsPlayerConnected(killerid))
  211. {
  212. if(IsAFightFaction(GetPlayerFaction(killerid)))
  213. {
  214. new TempZone = GetPlayerFightzone(killerid);
  215. if(TempZone != -255)
  216. {
  217. if(FightSystem[TempZone][fsFightTime] && FightSystem[TempZone][fsAttackFaction] != -255)
  218. {
  219. if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(killerid) || FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(killerid))
  220. {
  221. if(IsAFightFaction(GetPlayerFaction(playerid)))
  222. {
  223. new fsText[64];
  224. if(FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(killerid) && FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid))
  225. {
  226. PlayerPlaySound(killerid,1084,0.0,0.0,0.0);
  227. GameTextForPlayer(killerid,"~g~GANGZONEKILL",3125,3);
  228. GameTextForPlayer(playerid,"~r~GANGZONEKILL",3125,3);
  229. FightSystem[TempZone][fsKillsOfAttack]++;
  230. if(FightSystem[TempZone][fsKillsOfOwner] > FightSystem[TempZone][fsKillsOfAttack])
  231. {
  232. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  233. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  234. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  235. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  236. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  237. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  238. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  239. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  240. }
  241. else if(FightSystem[TempZone][fsKillsOfAttack] > FightSystem[TempZone][fsKillsOfOwner])
  242. {
  243. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  244. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  245. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  246. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  247. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  248. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  249. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  250. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  251. }
  252. else
  253. {
  254. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  255. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  256. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  257. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  258. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  259. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  260. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  261. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  262. }
  263. }
  264. else if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(killerid) && FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(playerid))
  265. {
  266. PlayerPlaySound(killerid,1084,0.0,0.0,0.0);
  267. GameTextForPlayer(killerid,"~g~GANGZONEKILL",3125,3);
  268. GameTextForPlayer(playerid,"~r~GANGZONEKILL",3125,3);
  269. FightSystem[TempZone][fsKillsOfOwner]++;
  270. if(FightSystem[TempZone][fsKillsOfOwner] > FightSystem[TempZone][fsKillsOfAttack])
  271. {
  272. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  273. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  274. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  275. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  276. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  277. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  278. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  279. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  280. }
  281. else if(FightSystem[TempZone][fsKillsOfAttack] > FightSystem[TempZone][fsKillsOfOwner])
  282. {
  283. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  284. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  285. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  286. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  287. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  288. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  289. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  290. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  291. }
  292. else
  293. {
  294. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  295. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  296. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[TempZone][fsKillsOfOwner]);
  297. TextDrawSetString(FightSystem[TempZone][fsWinKills],fsText);
  298. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsAttackFaction]));
  299. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  300. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[TempZone][fsKillsOfAttack]);
  301. TextDrawSetString(FightSystem[TempZone][fsLoseKills],fsText);
  302. }
  303. }
  304. }
  305. }
  306. }
  307. }
  308. }
  309. }
  310. if(IsAFightFaction(GetPlayerFaction(playerid))){
  311. new TempZone = GetPlayerFightzone(playerid);
  312. if(TempZone != -255){
  313. if(FightSystem[TempZone][fsFightTime] && FightSystem[TempZone][fsAttackFaction] != -255){
  314. if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid) || FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(playerid)){
  315. if(FightSystem[TempZone][fsCTF][0] == playerid){
  316. new fsName[MAX_PLAYER_NAME];
  317. GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
  318. new fsText[128];
  319. format(fsText,sizeof(fsText),"-|War Info: | %s hat es leider nicht geschafft die Flagge zu erobern!",fsName);
  320. for(new i;i<MAX_PLAYERS;i++){
  321. if(IsPlayerConnected(i)){
  322. if(GetPlayerFaction(i) == FightSystem[TempZone][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[TempZone][fsAttackFaction]){
  323. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  324. SendClientMessage(i,FS_COL_YELLOW,fsText);
  325. }
  326. }
  327. }
  328. FightSystem[TempZone][fsCTF][0] = -255;
  329. FightSystem[TempZone][fsCTF][1] = 0;
  330. FightSystem[TempZone][fsCTF][2] = 0;
  331. }
  332. }
  333. }
  334. }
  335. }return 1;
  336. }
  337. public OnPlayerCommandText(playerid, cmdtext[])
  338. {
  339. if(strcmp(cmdtext,"/ctf",true)==0){
  340. if(IsAFightFaction(GetPlayerFaction(playerid))){
  341. new TempZone = GetPlayerFightzone(playerid);
  342. if(TempZone != -255){
  343. if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
  344. return SendClientMessage(playerid,FS_COL_GREY,"** Du darfst das nur zu Fuß machen ...");
  345. if(!FightSystem[TempZone][fsFightTime] || FightSystem[TempZone][fsAttackFaction] == -255)
  346. return SendClientMessage(playerid,FS_COL_GREY,"** Hier gibt es nichts zu erobern.");
  347.  
  348. if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid) || FightSystem[TempZone][fsAttackFaction] == GetPlayerFaction(playerid)){
  349. if(IsPlayerInRangeOfPoint(playerid,5.0,FightSystem[TempZone][fsCTFx],FightSystem[TempZone][fsCTFy],FightSystem[TempZone][fsCTFz])){
  350. if(FightSystem[TempZone][fsCTF][0] != -255){
  351. if(GetPlayerFaction(FightSystem[TempZone][fsCTF][0]) != GetPlayerFaction(playerid))
  352. SendClientMessage(playerid,FS_COL_GREY,"** Die Flagge wird von deinen Feinden erobert, töte sie zuerst!");
  353. else
  354. SendClientMessage(playerid,FS_COL_GREY,"** Deine Gang / Mafia erobert bereits die Flagge!");
  355. return 1;
  356. }
  357. FightSystem[TempZone][fsCTF][0] = playerid;
  358. new fsName[MAX_PLAYER_NAME];
  359. GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
  360. new fsText[128];
  361. format(fsText,sizeof(fsText),"-|War Info:| %s hat angefangen die Flagge zu erobern!",fsName);
  362. for(new i;i<MAX_PLAYERS;i++)
  363. {
  364. if(IsPlayerConnected(i))
  365. //new TempZone;
  366. //TempZone = GetPlayerFightzone(i);
  367. //new fsText[128];
  368. {
  369. if(GetPlayerFaction(i) == FightSystem[GetPlayerFightzone(i)][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[GetPlayerFightzone(i)][fsAttackFaction])
  370. {
  371. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  372. SendClientMessage(i,FS_COL_YELLOW,fsText);
  373. }
  374. }
  375. }
  376. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist nicht in der nähe der Flagge!");
  377. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist nicht in diesem Fight verwickelt ...");
  378. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keinem Gebiet!");
  379. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keiner Gang / Mafia.");
  380. return 1;
  381. }
  382. if(strcmp(cmdtext,"/invade",true)==0){
  383. if(IsAFightFaction(GetPlayerFaction(playerid))){
  384. for(new fs;fs<sizeof(FightSystem);fs++){
  385. if((FightSystem[fs][fsOwnerFaction] == GetPlayerFaction(playerid) && FightSystem[fs][fsFightTime]) || FightSystem[fs][fsAttackFaction] == GetPlayerFaction(playerid))
  386. return SendClientMessage(playerid,FS_COL_GREY,"** Deine Gang / Mafia ist bereits in einem GangWar..!");
  387. }
  388. new TempZone = GetPlayerFightzone(playerid);
  389. if(TempZone != -255){
  390. if(!IsAFightFaction(FightSystem[TempZone][fsOwnerFaction]))
  391. return SendClientMessage(playerid,FS_COL_GREY,"Gebiet wurde ausgeschaltet.");
  392. if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid))
  393. return SendClientMessage(playerid,FS_COL_GREY,"** Man greift nicht seine eigenen Leute an.");
  394. if(FightSystem[TempZone][fsFightTime] || FightSystem[TempZone][fsAttackFaction] != -255)
  395. return SendClientMessage(playerid,FS_COL_GREY,"** In diesem Gebiet wird bereits geschossen.");
  396. if(FightSystem[TempZone][fsLastFight]){
  397. new fsText[178];
  398. format(fsText,sizeof(fsText),"Ganggebiet: Dieses Ganggebiet wurde bereits Angegriffen, wartet noch: '%d' Minuten.",FightSystem[TempZone][fsLastFight]);
  399. SendClientMessage(playerid,FS_COL_GREY,fsText);
  400. return 1;
  401. }
  402. for(new fs;fs<sizeof(FightSystem);fs++){
  403. if(FightSystem[fs][fsOwnerFaction] == FightSystem[TempZone][fsOwnerFaction] && FightSystem[fs][fsAttackFaction] != -255)
  404. return SendClientMessage(playerid,FS_COL_GREY,"Ganggebiet: Die Gang / Mafia der das Ganggebiet gehört hat bereits ein Kampf.");
  405. }
  406. new fsTextToOwner[255];
  407. format(fsTextToOwner,sizeof(fsTextToOwner),"-|War Info:| Ihr werden von: %s angegriffen, begebt euch zum GangWar..!",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
  408. new fsName[MAX_PLAYER_NAME];
  409. GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
  410. new fsTextToAttack[255];
  411. format(fsTextToAttack,sizeof(fsTextToAttack),"-|War Info: | %s hat ein GangWar mit: %s gestartet, ihr müsst sie nun ausschalten..!",fsName,GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  412. new fsText[64];
  413. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
  414. TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
  415. TextDrawSetString(FightSystem[TempZone][fsWinKills],"~y~00 Kills");
  416. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
  417. TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
  418. TextDrawSetString(FightSystem[TempZone][fsLoseKills],"~y~00 Kills");
  419. TextDrawSetString(FightSystem[TempZone][fsTime],"Ablauf Zeit: 2 min.");//ZEIT
  420. for(new i;i<MAX_PLAYERS;i++){
  421. if(IsPlayerConnected(i)){
  422. GangZoneFlashForPlayer(i,FightSystem[TempZone][fsZoneID],GetZoneColorOfFaction(GetPlayerFaction(playerid)));
  423. if(GetPlayerFaction(i) == FightSystem[TempZone][fsOwnerFaction]){
  424. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  425. SendClientMessage(i,FS_COL_YELLOW,fsTextToOwner);
  426. TextDrawShowForPlayer(i,Fight);
  427. TextDrawShowForPlayer(i,FightUnderline);
  428. TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinFaction]);
  429. TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinKills]);
  430. TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseFaction]);
  431. TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseKills]);
  432. TextDrawShowForPlayer(i,FightSystem[TempZone][fsTime]);
  433. }
  434. if(GetPlayerFaction(i) == GetPlayerFaction(playerid)){
  435. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  436. SendClientMessage(i,FS_COL_YELLOW,fsTextToAttack);
  437. TextDrawShowForPlayer(i,Fight);
  438. TextDrawShowForPlayer(i,FightUnderline);
  439. TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinFaction]);
  440. TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinKills]);
  441. TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseFaction]);
  442. TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseKills]);
  443. TextDrawShowForPlayer(i,FightSystem[TempZone][fsTime]);
  444. }
  445. }
  446. }
  447. FightSystem[TempZone][fsAttackFaction] = GetPlayerFaction(playerid);
  448. FightSystem[TempZone][fsKillsOfOwner] = 0;
  449. FightSystem[TempZone][fsKillsOfAttack] = 0;
  450. FightSystem[TempZone][fsFightTime] = GANGFIGHT_DAUER;//ZEIT
  451. FightSystem[TempZone][fsCTF][0] = -255;
  452. FightSystem[TempZone][fsCTF][1] = 0;
  453. FightSystem[TempZone][fsCTF][2] = 0;
  454. return 1;
  455. }return SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keinem Gebiet!");
  456. }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keiner Gang / Mafia.");
  457. return 1;
  458. }return 0;
  459. }
  460. public FightUpdate_1()
  461. {
  462. for(new fs;fs<sizeof(FightSystem);fs++)
  463. {
  464. if(FightSystem[fs][fsFightTime] && FightSystem[fs][fsAttackFaction] != -255)
  465. {
  466. new fsText[128];
  467. if(FightSystem[fs][fsCTF][0] != -255)
  468. {
  469. if(IsPlayerConnected(FightSystem[fs][fsCTF][0]))
  470. {
  471. if(IsPlayerInRangeOfPoint(FightSystem[fs][fsCTF][0],5.0,FightSystem[fs][fsCTFx],FightSystem[fs][fsCTFy],FightSystem[fs][fsCTFz]))
  472. {
  473. FightSystem[fs][fsCTF][2] = 5;
  474. FightSystem[fs][fsCTF][1]++;
  475. format(fsText,sizeof(fsText),"~n~~n~~n~~n~~n~~n~~n~~w~(1)Punkt in:~n~~r~%d ~w~sek.",(1-FightSystem[fs][fsCTF][1]));
  476. GameTextForPlayer(FightSystem[fs][fsCTF][0],fsText,1250,3);
  477. if(FightSystem[fs][fsCTF][1] >= 1)
  478. {
  479. new fsName[MAX_PLAYER_NAME];
  480. GetPlayerName(FightSystem[fs][fsCTF][0],fsName,MAX_PLAYER_NAME);
  481. FightSystem[fs][fsCTF][1] = 0;
  482. format(fsText,sizeof(fsText),"-|War Info:| %s hat die Flagge erfolgreich erobert..!",fsName);
  483. for(new i;i<MAX_PLAYERS;i++)
  484. {
  485. if(IsPlayerConnected(i))
  486. {
  487. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction])
  488. {
  489. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  490. SendClientMessage(i,FS_COL_YELLOW,fsText);
  491. }
  492. }
  493. }
  494. if(GetPlayerFaction(FightSystem[fs][fsCTF][0]) == FightSystem[fs][fsOwnerFaction]) FightSystem[fs][fsKillsOfOwner]++;
  495. if(GetPlayerFaction(FightSystem[fs][fsCTF][0]) == FightSystem[fs][fsAttackFaction]) FightSystem[fs][fsKillsOfAttack]++;
  496. if(FightSystem[fs][fsKillsOfOwner] > FightSystem[fs][fsKillsOfAttack])
  497. {
  498. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  499. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  500. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  501. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  502. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  503. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  504. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  505. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  506. }
  507. else if(FightSystem[fs][fsKillsOfAttack] > FightSystem[fs][fsKillsOfOwner])
  508. {
  509. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  510. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  511. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  512. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  513. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  514. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  515. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  516. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  517. }
  518. else
  519. {
  520. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  521. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  522. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  523. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  524. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  525. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  526. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  527. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  528. }
  529. FightSystem[fs][fsCTF][0] = -255;
  530. }
  531. }
  532. else
  533. {
  534. format(fsText,sizeof(fsText),"~n~~n~~n~~n~~n~~n~~n~~r~Erobere die Flagge!~n~~b~%d Sekunden",(1-FightSystem[fs][fsCTF][2]));
  535. GameTextForPlayer(FightSystem[fs][fsCTF][0],fsText,1250,3);
  536. FightSystem[fs][fsCTF][2]++;
  537. if(FightSystem[fs][fsCTF][2] >= 1)
  538. {
  539. new fsName[MAX_PLAYER_NAME];
  540. GetPlayerName(FightSystem[fs][fsCTF][0],fsName,MAX_PLAYER_NAME);
  541. format(fsText,sizeof(fsText),"-|War Info:| %s hat es leider nicht geschafft die Flagge zu erobern!",fsName);
  542. for(new i;i<MAX_PLAYERS;i++)
  543. {
  544. if(IsPlayerConnected(i))
  545. {
  546. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction])
  547. {
  548. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  549. SendClientMessage(i,FS_COL_YELLOW,fsText);
  550. }
  551. }
  552. }
  553. FightSystem[fs][fsCTF][0] = -255;
  554. FightSystem[fs][fsCTF][1] = 0;
  555. FightSystem[fs][fsCTF][2] = 0;
  556. }
  557. }
  558. }
  559. else
  560. {
  561. FightSystem[fs][fsCTF][0] = -255;
  562. FightSystem[fs][fsCTF][1] = 0;
  563. FightSystem[fs][fsCTF][2] = 0;
  564. }
  565. }
  566. }
  567. }return 1;
  568. }
  569. public FightUpdate_2(){
  570. for(new fs;fs<sizeof(FightSystem);fs++){
  571. if(FightSystem[fs][fsFightTime]){
  572. FightSystem[fs][fsFightTime]--;
  573. new fsText[64];
  574. format(fsText,sizeof(fsText),"Fight Zeit: %d min.",FightSystem[fs][fsFightTime]);
  575. TextDrawSetString(FightSystem[fs][fsTime],fsText);
  576. if(!FightSystem[fs][fsFightTime]){
  577. FightSystem[fs][fsLastFight] = 0;
  578. new fsTextToOwner[255];
  579. new fsTextToAttack[255];
  580. new fsType;
  581. if(FightSystem[fs][fsKillsOfOwner] > FightSystem[fs][fsKillsOfAttack]){
  582. fsType = 2;
  583. format(fsTextToOwner,sizeof(fsTextToOwner),"-|War Info: | Deine Gang/Mafia hat das GangWar gewonnen.");
  584. format(fsTextToAttack,sizeof(fsTextToAttack),"-|War Info: | Deine Gang/Mafia hat das GangWar verloren.");
  585. }
  586. else if(FightSystem[fs][fsKillsOfAttack] > FightSystem[fs][fsKillsOfOwner]){
  587. fsType = 3;
  588. format(fsTextToOwner,sizeof(fsTextToOwner),"-|War Info: | Deine Gang/Mafia hat das GangWar verloren.");
  589. format(fsTextToAttack,sizeof(fsTextToAttack),"-|War Info: | Deine Gang/Mafia hat das GangWar gewonnen.");
  590. }else{
  591. fsType = 1;
  592. format(fsTextToOwner,sizeof(fsTextToOwner),"-|War Info: | Es war,Unentschieden ihr werdet euer gebiet behalten.");
  593. format(fsTextToAttack,sizeof(fsTextToAttack),"-|War Info: | Es war,Unentschieden ihr müsst euch mehr anstrengen.");
  594. }
  595. for(new i;i<MAX_PLAYERS;i++){
  596. if(IsPlayerConnected(i)){
  597. GangZoneStopFlashForPlayer(i,FightSystem[fs][fsZoneID]);
  598. if(fsType == 3){
  599. GangZoneHideForPlayer(i,FightSystem[fs][fsZoneID]);
  600. GangZoneShowForPlayer(i,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsAttackFaction]));
  601. }
  602. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction]){
  603. PlayerPlaySound(i,1058,0.0,0.0,0.0);
  604. TextDrawHideForPlayer(i,Fight);
  605. TextDrawHideForPlayer(i,FightUnderline);
  606. TextDrawHideForPlayer(i,FightSystem[fs][fsWinFaction]);
  607. TextDrawHideForPlayer(i,FightSystem[fs][fsWinKills]);
  608. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseFaction]);
  609. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseKills]);
  610. TextDrawHideForPlayer(i,FightSystem[fs][fsTime]);
  611. SendClientMessage(i,FS_COL_YELLOW,fsTextToOwner);
  612. if(fsType == 3 && GetPlayerFightzone(i) == fs)
  613. SetPlayerHealth(i,0.0);
  614. }
  615. else if(GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction]){
  616. PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
  617. TextDrawHideForPlayer(i,Fight);
  618. TextDrawHideForPlayer(i,FightUnderline);
  619. TextDrawHideForPlayer(i,FightSystem[fs][fsWinFaction]);
  620. TextDrawHideForPlayer(i,FightSystem[fs][fsWinKills]);
  621. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseFaction]);
  622. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseKills]);
  623. TextDrawHideForPlayer(i,FightSystem[fs][fsTime]);
  624. SendClientMessage(i,FS_COL_YELLOW,fsTextToAttack);
  625. if(fsType != 3 && GetPlayerFightzone(i) == fs)
  626. SetPlayerHealth(i,0.0);
  627. }
  628. }
  629. }
  630. FightSystem[fs][fsKillsOfAttack] = 0;
  631. FightSystem[fs][fsKillsOfOwner] = 0;
  632. if(fsType == 3)
  633. FightSystem[fs][fsOwnerFaction] = FightSystem[fs][fsAttackFaction];
  634. FightSystem[fs][fsAttackFaction] = -255;
  635. FightSystem[fs][fsCTF][0] = -255;
  636. }
  637. }
  638. if(FightSystem[fs][fsLastFight])
  639. FightSystem[fs][fsLastFight]--;
  640. }return 1;
  641. }
  642. public Fight_Init(){
  643. Fight = TextDrawCreate(88.000000,244.000000,"GangWar:");
  644. TextDrawUseBox(Fight,1);
  645. TextDrawBoxColor(Fight,0x00000066);
  646. TextDrawTextSize(Fight,102.000000,124.000000);
  647. TextDrawAlignment(Fight,2);
  648. TextDrawBackgroundColor(Fight,0x4BFF00FF);
  649. TextDrawFont(Fight,2);
  650. TextDrawLetterSize(Fight,0.500000,1.000000);
  651. TextDrawColor(Fight,0x000000FF);
  652. TextDrawSetOutline(Fight,1);
  653. TextDrawSetProportional(Fight,1);
  654. FightUnderline = TextDrawCreate(91.000000,274.000000,".");
  655. TextDrawAlignment(FightUnderline,2);
  656. TextDrawBackgroundColor(FightUnderline,0x00FFE6FF);//0x000000ff
  657. TextDrawFont(FightUnderline,3);
  658. TextDrawLetterSize(FightUnderline,14.799997,1.000000);
  659. TextDrawColor(FightUnderline,0xffffffff);
  660. TextDrawSetProportional(FightUnderline,1);
  661. TextDrawSetShadow(FightUnderline,1);
  662. if(!fexist("Fightzones_Gangfight.cfg")){
  663. new File:fFile=fopen("Fightzones_Gangfight.cfg",io_write);
  664. for(new fs;fs<sizeof(FightSystem);fs++)
  665. fwrite(fFile,"5 -255 0 0 0\r\n");
  666. fclose(fFile);
  667. }
  668. new File:fFile=fopen("Fightzones_Gangfight.cfg",io_read),Content[64],fs;
  669. while(fread(fFile,Content) && fs < sizeof(FightSystem)){
  670. FightSystem[fs][fsWinFaction] = TextDrawCreate(26.000000,256.000000," ");
  671. TextDrawSetProportional(FightSystem[fs][fsWinFaction],1);
  672. TextDrawAlignment(FightSystem[fs][fsWinFaction],0);
  673. TextDrawBackgroundColor(FightSystem[fs][fsWinFaction],0x000000ff);
  674. TextDrawFont(FightSystem[fs][fsWinFaction],2);
  675. TextDrawLetterSize(FightSystem[fs][fsWinFaction],0.199999,1.000000);
  676. TextDrawColor(FightSystem[fs][fsWinFaction],0xffffffff);
  677. TextDrawSetOutline(FightSystem[fs][fsWinFaction],1);
  678. FightSystem[fs][fsLoseFaction] = TextDrawCreate(26.000000,267.000000," ");
  679. TextDrawSetProportional(FightSystem[fs][fsLoseFaction],1);
  680. TextDrawSetOutline(FightSystem[fs][fsLoseFaction],1);
  681. TextDrawColor(FightSystem[fs][fsLoseFaction],0xffffffff);
  682. TextDrawFont(FightSystem[fs][fsLoseFaction],2);
  683. TextDrawLetterSize(FightSystem[fs][fsLoseFaction],0.199999,0.899999);
  684. TextDrawBackgroundColor(FightSystem[fs][fsLoseFaction],0x000000ff);
  685. TextDrawAlignment(FightSystem[fs][fsLoseFaction],0);
  686. FightSystem[fs][fsWinKills] = TextDrawCreate(107.000000,256.000000," ");
  687. TextDrawSetProportional(FightSystem[fs][fsWinKills],1);
  688. TextDrawSetOutline(FightSystem[fs][fsWinKills],1);
  689. TextDrawColor(FightSystem[fs][fsWinKills],0xffffffff);
  690. TextDrawSetShadow(FightSystem[fs][fsWinKills],1);
  691. TextDrawFont(FightSystem[fs][fsWinKills],2);
  692. TextDrawLetterSize(FightSystem[fs][fsWinKills],0.199999,1.000000);
  693. TextDrawBackgroundColor(FightSystem[fs][fsWinKills],0x000000ff);
  694. TextDrawAlignment(FightSystem[fs][fsWinKills],0);
  695. FightSystem[fs][fsLoseKills] = TextDrawCreate(107.000000,267.000000," ");
  696. TextDrawSetProportional(FightSystem[fs][fsLoseKills],1);
  697. TextDrawSetShadow(FightSystem[fs][fsLoseKills],1);
  698. TextDrawSetOutline(FightSystem[fs][fsLoseKills],1);
  699. TextDrawColor(FightSystem[fs][fsLoseKills],0xffffffff);
  700. TextDrawFont(FightSystem[fs][fsLoseKills],2);
  701. TextDrawLetterSize(FightSystem[fs][fsLoseKills],0.199999,1.000000);
  702. TextDrawBackgroundColor(FightSystem[fs][fsLoseKills],0x000000ff);
  703. TextDrawAlignment(FightSystem[fs][fsLoseKills],0);
  704. FightSystem[fs][fsTime] = TextDrawCreate(26.000000,286.000000," ");
  705. TextDrawColor(FightSystem[fs][fsTime],0xffffffff);
  706. TextDrawAlignment(FightSystem[fs][fsTime],0);
  707. TextDrawBackgroundColor(FightSystem[fs][fsTime],0x000000ff);
  708. TextDrawFont(FightSystem[fs][fsTime],2);
  709. TextDrawLetterSize(FightSystem[fs][fsTime],0.199999,0.899999);
  710. TextDrawSetProportional(FightSystem[fs][fsTime],1);
  711. StripNewLine(Content);
  712. sscanf(Content,"ddddd",FightSystem[fs][fsOwnerFaction],FightSystem[fs][fsAttackFaction],FightSystem[fs][fsKillsOfOwner],FightSystem[fs][fsKillsOfAttack],FightSystem[fs][fsFightTime]);
  713. FightSystem[fs][fsCTF][0] = -255;
  714. FightSystem[fs][fsCTF][1] = 0;
  715. FightSystem[fs][fsCTF][2] = 0;
  716. FightSystem[fs][fsLastFight] = 0;
  717. FightSystem[fs][fsZoneID] = GangZoneCreate(FightSystem[fs][fsMinX],FightSystem[fs][fsMinY],FightSystem[fs][fsMaxX],FightSystem[fs][fsMaxY]);
  718. FightSystem[fs][fsFlag] = CreatePickup(2993,1,FightSystem[fs][fsCTFx],FightSystem[fs][fsCTFy],FightSystem[fs][fsCTFz],-1);
  719. if(FightSystem[fs][fsFightTime] && FightSystem[fs][fsAttackFaction] != -255){
  720. new fsText[64];
  721. format(fsText,sizeof(fsText),"Fight Zeit: %d min.",FightSystem[fs][fsFightTime]);
  722. TextDrawSetString(FightSystem[fs][fsTime],fsText);
  723. if(FightSystem[fs][fsKillsOfOwner] > FightSystem[fs][fsKillsOfAttack]){
  724. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  725. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  726. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  727. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  728. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  729. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  730. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  731. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  732. }
  733. else if(FightSystem[fs][fsKillsOfAttack] > FightSystem[fs][fsKillsOfOwner]){
  734. format(fsText,sizeof(fsText),"~g~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  735. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  736. format(fsText,sizeof(fsText),"~g~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  737. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  738. format(fsText,sizeof(fsText),"~r~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  739. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  740. format(fsText,sizeof(fsText),"~r~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  741. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  742. }else{
  743. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[fs][fsOwnerFaction]));
  744. TextDrawSetString(FightSystem[fs][fsWinFaction],fsText);
  745. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[fs][fsKillsOfOwner]);
  746. TextDrawSetString(FightSystem[fs][fsWinKills],fsText);
  747. format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[fs][fsAttackFaction]));
  748. TextDrawSetString(FightSystem[fs][fsLoseFaction],fsText);
  749. format(fsText,sizeof(fsText),"~y~%d Kills",FightSystem[fs][fsKillsOfAttack]);
  750. TextDrawSetString(FightSystem[fs][fsLoseKills],fsText);
  751. }
  752. }
  753. for(new i;i<MAX_PLAYERS;i++){
  754. if(IsPlayerConnected(i)){
  755. SetPVarInt(i,"Spawned",1);
  756. GangZoneShowForPlayer(i,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsOwnerFaction]));
  757. if(FightSystem[fs][fsAttackFaction] && FightSystem[fs][fsFightTime]){
  758. GangZoneFlashForPlayer(i,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsAttackFaction]));
  759. if(GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction] || GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction]){
  760. TextDrawShowForPlayer(i,Fight);
  761. TextDrawShowForPlayer(i,FightUnderline);
  762. TextDrawShowForPlayer(i,FightSystem[fs][fsWinFaction]);
  763. TextDrawShowForPlayer(i,FightSystem[fs][fsLoseFaction]);
  764. TextDrawShowForPlayer(i,FightSystem[fs][fsWinKills]);
  765. TextDrawShowForPlayer(i,FightSystem[fs][fsLoseKills]);
  766. TextDrawShowForPlayer(i,FightSystem[fs][fsTime]);
  767. }
  768. }
  769. }
  770. }
  771. fs++;
  772. }
  773. fclose(fFile);
  774. FightTimer[0] = SetTimer("FightUpdate_1",1003,true);
  775. FightTimer[1] = SetTimer("FightUpdate_2",60017,true);
  776. return 1;
  777. }
  778. public Fight_Close(){
  779. KillTimer(FightTimer[0]);
  780. KillTimer(FightTimer[1]);
  781. if(fexist("Fightzones_Gangfight.cfg")) fremove("Fightzones_Gangfight.cfg");
  782. new File:fFile=fopen("Fightzones_Gangfight.cfg",io_append),Content[64];
  783. for(new fs;fs<sizeof(FightSystem);fs++){
  784. if(FightSystem[fs][fsAttackFaction] != -255 && FightSystem[fs][fsFightTime]){
  785. GangZoneStopFlashForAll(FightSystem[fs][fsZoneID]);
  786. for(new i;i<MAX_PLAYERS;i++){
  787. if(IsPlayerConnected(i)){
  788. DeletePVar(i,"Spawned");
  789. if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction]){
  790. TextDrawHideForPlayer(i,Fight);
  791. TextDrawHideForPlayer(i,FightUnderline);
  792. TextDrawHideForPlayer(i,FightSystem[fs][fsWinFaction]);
  793. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseFaction]);
  794. TextDrawHideForPlayer(i,FightSystem[fs][fsWinKills]);
  795. TextDrawHideForPlayer(i,FightSystem[fs][fsLoseKills]);
  796. TextDrawHideForPlayer(i,FightSystem[fs][fsTime]);
  797. }
  798. }
  799. }
  800. }
  801. TextDrawDestroy(FightSystem[fs][fsWinFaction]);
  802. TextDrawDestroy(FightSystem[fs][fsLoseFaction]);
  803. TextDrawDestroy(FightSystem[fs][fsWinKills]);
  804. TextDrawDestroy(FightSystem[fs][fsLoseKills]);
  805. TextDrawDestroy(FightSystem[fs][fsTime]);
  806. GangZoneHideForAll(FightSystem[fs][fsZoneID]);
  807. GangZoneDestroy(FightSystem[fs][fsZoneID]);
  808. DestroyPickup(FightSystem[fs][fsFlag]);
  809. format(Content,sizeof(Content),"%d %d %d %d %d\r\n",FightSystem[fs][fsOwnerFaction],FightSystem[fs][fsAttackFaction],FightSystem[fs][fsKillsOfOwner],FightSystem[fs][fsKillsOfAttack],FightSystem[fs][fsFightTime]);
  810. fwrite(fFile,Content);
  811. }
  812. fclose(fFile);
  813. TextDrawDestroy(Fight);
  814. TextDrawDestroy(FightUnderline);
  815. return 1;
  816. }
  817. stock GetPlayerFightzone(playerid)
  818. {
  819. new Float:GangZone[3];
  820. GetPlayerPos(playerid,GangZone[0],GangZone[1],GangZone[2]);
  821. for(new fs;fs<sizeof(FightSystem);fs++)
  822. {
  823. if((GangZone[0] >= FightSystem[fs][fsMinX] && GangZone[0] <= FightSystem[fs][fsMaxX]) && (GangZone[1] >= FightSystem[fs][fsMinY] && GangZone[1] <= FightSystem[fs][fsMaxY]) && GangZone[2] <= 500)
  824. return fs;
  825. }return -255;
  826. }
  827.  
  828.  
  829. stock GetPlayerFaction(playerid){
  830. new Member = CallRemoteFunction("GetPlayerMember","i",playerid);
  831. if(Member)
  832. return Member;
  833. new Leader = CallRemoteFunction("GetPlayerLeader","i",playerid);
  834. if(Leader)
  835. return Leader;
  836. return 0;
  837. }
  838.  
  839. stock sscanf(string[],format[],{Float,_}:...){
  840. new formatPos=0,stringPos=0,paramPos=2,paramCount=numargs();
  841. while(paramPos < paramCount && string[stringPos]){
  842. switch (format[formatPos++]){
  843. case '\0':{return 0;}case 'i','d':{
  844. new neg=1,num=0,ch=string[stringPos];
  845. if(ch=='-'){neg=-1;ch=string[++stringPos];}
  846. do{ stringPos++;
  847. if(ch>='0'&&ch<='9'){num=(num*10)+(ch-'0');}else{return 1;}
  848. }while((ch=string[stringPos])&&ch!=' ');setarg(paramPos,0,num*neg);}
  849. case 'h','x':{
  850. new ch,num=0;while((ch=string[stringPos++])){
  851. switch (ch){
  852. case 'x','X':{num=0;continue;}case '0'..'9':{num=(num<<4)|(ch-'0');}
  853. case 'a'..'f':{num=(num<<4)|(ch-('a'-10));}case 'A'..'F':{num=(num<<4)|(ch-('A'-10));}
  854. case ' ':{break;}default:{return 1;}}
  855. }setarg(paramPos,0,num);}
  856. case 'c':{setarg(paramPos,0,string[stringPos++]);}
  857. case 'f':{
  858. new tmp[25];
  859. strmid(tmp,string,stringPos,stringPos+sizeof(tmp)-2);
  860. setarg(paramPos,0,_:floatstr(tmp));}
  861. case 's','z':{
  862. new i=0,ch;
  863. if(format[formatPos]){
  864. while ((ch=string[stringPos++])&&ch!=' '){
  865. setarg(paramPos,i++,ch);
  866. }if(!i)return 1;
  867. }else{while((ch=string[stringPos++])){setarg(paramPos,i++,ch);}
  868. }stringPos--;setarg(paramPos,i,'\0');
  869. }default:{continue;}}
  870. while(string[stringPos]&&string[stringPos]!=' '){stringPos++;}
  871. while(string[stringPos]==' '){stringPos++;}
  872. paramPos++;}
  873. while(format[formatPos]=='z')formatPos++;
  874. return format[formatPos];
  875. }
  876. stock StripNewLine(string[]){
  877. new len=strlen(string);
  878. if(string[0]==0) return ;
  879. if((string[len-1]=='\n')||(string[len - 1]=='\r')){
  880. string[len - 1] = 0;
  881. if(string[0]==0) return ;
  882. if((string[len-2]=='\n')||(string[len-2]=='\r')) string[len-2]=0;
  883. }
  884. }
  885.  
  886. //0x00000066
Advertisement
Add Comment
Please, Sign In to add comment