Advertisement
Guest User

Gangfight System

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