Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 87.65 KB | None | 0 0
  1. unit BattlefieldMod;
  2.  
  3. interface
  4.     //To add to fix: Napraw blad z blednym ustawieniem ammo jesli zmiana mapy lub dolaczenie do gry
  5.     //Changes: - New RandomClassSystem, Update Translitions, Fix small bugs, Fix wrong working /getammo, Change big time to get ammo to 18, Change time to get new weapon to 25,
  6.     //           Fix bug for fast get of weapons,
  7. implementation
  8. var Decl, ai, ab: byte;
  9.  
  10. const
  11.     DeaglleAmmo = 28;   // deagles WepAmmos maximum 4 Magazines
  12.     Mp5Ammo     = 180;  // mp5 WepAmmos maximum     5 Magazines
  13.     AkAmmo      = 160;  // ak WepAmmos maximum      4 Magazines
  14.     AugAmmo     = 150;  // aug WepAmmos maximum     6 Magazines
  15.     SpasAmmo    = 42;   // spas WepAmmos maximum    42 Bullets
  16.     RugerAmmo   = 24;   // ruger WepAmmos maximum   6 Magazines
  17.     M79Ammo     = 6;    // m79 WepAmmos maximum     6 Bullets
  18.     BarrettAmmo = 15;   // barret WepAmmos maximum  15 Bullets
  19.     MinimiAmmo  = 150;  // minimi WepAmmos maximum  3 Magazines
  20.     MinigunAmmo = 120;  // minigun WepAmmos maximum 3 Magazines
  21.     LawAmmo     = 4;    // law WepAmmos maximum     4 Bullets
  22.     PistolAmmo  = 48;   // socom WepAmmos maximum   4 Magazines
  23.     SawPaliwo   = 800;  // saw WepAmmos maximum     Working time about 18 seconds
  24.     KNIFE       = 1;    // Dont Edit
  25.     FlameFuel   = 200;  // Flamer fuel
  26.     ARambo      = 50;   // Rambo shoots
  27.     AFlameRambo = 20;   // Rambo flame shoots
  28.  
  29.     MinDeaglleAmmo  = 7;
  30.     MinMp5Ammo      = 30;
  31.     MinAkAmmo       = 35;
  32.     MinAugAmmo      = 30;
  33.     MinSpasAmmo     = 7;
  34.     MinRugerAmmo    = 4;
  35.     MinM79Ammo      = 1;
  36.     MinBarrettAmmo  = 10;
  37.     MinMinimiAmmo   = 50;
  38.     MinMinigunAmmo  = 40;
  39.     MinLawAmmo      = 1;
  40.     MinPistolAmmo   = 12;
  41.     MinSawPaliwo    = 800;
  42.     MinKNIFE        = 1;
  43.     MinFlameFuel    = 200;
  44.     MinARambo       = 50;
  45.     MinAFlameRambo  = 20;
  46.  
  47.     RanDropAmmo     = 0.65;
  48.  
  49.     AssistMinimumDamagePercent = 65; // Damage minimum to get assist
  50.     CooldownTimer = 0;              // Time from injury after which you can not already get assist
  51.     TimeCon = 6;                   // Time from injury after which you can not get savior
  52.  
  53.     MaxPlayersInGame    = 16;   //Max players in server non work now
  54.     RandomMethodClass   = 2;    //1 Specyfic, 2 specyfic -1, Random 1..4.
  55.     FullHeal            = 150.0;
  56.  
  57.     AmmoGivenLimit      = 4;    //M79, LAW, ammo give must get 4 and he get ammo
  58.     BaretAmmoGivenLimit = 3;
  59.     RugerAmmoGiven      = 2;
  60.     SawAmmoAdd          = 20;
  61.  
  62.     AutomaticRifleInfo  = 8;
  63.     BarrettInfo         = 4;
  64.     SocomInfo           = 6;
  65.     NoAutoInfo          = 4;
  66.     ExplodeInfo         = 2;
  67.     SawInfo             = 110;
  68.     MaxDispLowAmmo      = 3;
  69.  
  70.     TimeToGetAmmoNormal = 5;
  71.     TimeToGetAmmoBig    = 18;
  72.     TimeToGetWeapon     = 8;
  73.     TimeToGetWeaponBig  = 25;
  74.  
  75.     VestEnginerRepair   = 8;
  76.     DeffaultRockeTtype  = 2;    //1 normal 2 extra
  77.     MaxExtraRocket      = 1;    //Max extra rocket
  78.  
  79.     HealMedykHealing    = 12;
  80.     MedkitTimeAdd       = 25;
  81.     DefiblirateToNext   = 90;
  82.     GranadekitTimeAdd   = 20;
  83.     WTT                 = 15;
  84.     WC                  = 60;
  85.     WsparcieDist        = 640;
  86.     StatCreate          = 40;
  87.     StatActiveTime      = 12;
  88.     CursorMaxSearch     = 125;
  89.     MozdzierzTime       = 40;
  90.     SniperBandageTime   = 50;
  91.     //Layers
  92.     HK  = 1;            //To kill default layers text - DONT EDIT!
  93.     HH  = 150;          //Hud heal
  94.     HV  = 151;          //Hud vest
  95.     BS  = 133;          //Blood screen
  96.     HP  = 107;          //Hud points
  97.     HA  = 103;          //Hud ammo
  98.     HS1 = 100;          //Hud skill 1
  99.     HS2 = 101;          //Hud skill 2
  100.     LA  = 102;          //Low ammo info
  101.     RA = 89;            //Result Red Team
  102.     RB = 90;            //Result Blue Team
  103.     AW = 91;            //Ammo and weapon                       | Number + 1, Example is number 91 this is between 91-92.
  104.     WR = 100;           //WorldText Layer Resuscitation Text    | Number + MaxPlayers(32), Example is number 100 this is between 100-132.
  105.     WT = 67;            //WorldText Layer Rocket Tracked        | Number + MaxPlayers(32), Example is number 67 this is between 67-99.
  106.     WM = 34;            //WorldText Layer Sniper Mortar         | Number + MaxPlayers(32), Example is number 34 this is between 34-66.
  107.  
  108. type tMissile = record
  109.     owner_ID, target_ID: Byte;
  110.     Active, poly_coll, target_coll: Boolean;
  111.     n: Word;
  112.     X, Y, X2, Y2, dist, next_dist_x, next_dist_y, prev_dist_x, prev_dist_y, rd: Single;
  113. end;
  114.  
  115. type tMozdziez = record
  116.     Active: Boolean;
  117.     shoots: integer;
  118.     X, R: Single;
  119.     Xplayer: byte;
  120. end;
  121.  
  122. type tPlayerInfo = record
  123.     ClassID, LastClassID: byte;
  124.     Points: int64;
  125.     Gives, NumDisp: integer;
  126.     AmmoGiven, BarrettAmmoGiven: integer;
  127.  
  128.     Resp, CanGetAmmo, CanGetWeapon, CanReset: boolean;
  129.     GetsW, GetsA:integer;
  130.     Wep1,Wep2: byte;
  131.     LastX:single;
  132.     TimerOnSpawn:integer;
  133.  
  134.     Medkit, SpawnedID:integer;
  135.  
  136.     WsparcieDT:integer;
  137.  
  138.     DeadX,DeadY:single;
  139.  
  140.     StatTime: integer;
  141.     StatID:integer;
  142.     RocketType:integer;
  143.     RocketAmmo:integer;
  144.     ShootMis:integer;
  145.  
  146.     MozdziezT:integer;
  147.     SniperBandage:integer;
  148. end;
  149.  
  150. type tCombo = record
  151.     H,T: integer;
  152. end;
  153.  
  154. type PlayerAssist = record
  155.     DamageRecievedByID: array[1..33] of double;
  156.     DamageRecievedByCooldown: array[1..33] of integer;
  157.     KilledBy: integer;
  158. end;
  159.  
  160. var
  161.     PlayerHealth: array [1..32] of single;
  162.     PlayerInfo: array[1..32] of tPlayerInfo;
  163.     PlayersInfoArr: array[1..32] of PlayerAssist;
  164.     Missile: array[1..32] of TMissile;
  165.     Mozdziez: array[1..32] of tMozdziez;
  166.     Combo: array [1..32] of tCombo;
  167.     Revenge: array [1..32] of string;
  168.     WepAmmo: array[0..17] of array[1..32] of Integer;
  169.     DefiblirateTime, Ttimer: array [1..32] of integer;
  170.     Ammo, Weap, atc: array[1..32] of byte;
  171.     AlphaPlayerrrs: array of integer;
  172.     flaggrabed: array[1..2] of boolean;
  173.     PointsEvents: array[1..32] of array of string;
  174.     FlagX, FlagY: array[1..2] of single;
  175.     firstBlood, w1,w2: byte;
  176.     MaxHealth: integer;
  177.     change, isCompile: boolean;
  178.  
  179. function GetMaxAmmo(ID:integer):integer;
  180. begin
  181.     Case (ID) of
  182.         0: Result:= PistolAmmo;
  183.         1: Result:= DeaglleAmmo;
  184.         2: Result:= Mp5Ammo;
  185.         3: Result:= AkAmmo;
  186.         4: Result:= AugAmmo;
  187.         5: Result:= SpasAmmo;
  188.         6: Result:= RugerAmmo;
  189.         7: Result:= M79Ammo;
  190.         8: Result:= BarrettAmmo;
  191.         9: Result:= MinimiAmmo;
  192.         10: Result:= MinigunAmmo;
  193.         11: Result:= KNIFE;
  194.         12: Result:= SawPaliwo;
  195.         13: Result:= LawAmmo;
  196.         14: Result:= FlameFuel;
  197.         15: Result:= ARambo;
  198.         16: Result:= AFlameRambo;
  199.         17: Result:=MinKNIFE;
  200.     end;    //14 flame //15 rambo //16 flame rambo
  201. end;
  202.  
  203. function GetMinAmmo(ID:byte):integer;
  204. begin
  205.     Case (ID) of
  206.         0: Result:= MinPistolAmmo;
  207.         1: Result:= MinDeaglleAmmo;
  208.         2: Result:= MinMp5Ammo;
  209.         3: Result:= MinAkAmmo;
  210.         4: Result:= MinAugAmmo;
  211.         5: Result:= MinSpasAmmo;
  212.         6: Result:= MinRugerAmmo;
  213.         7: Result:= MinM79Ammo;
  214.         8: Result:= MinBarrettAmmo;
  215.         9: Result:= MinMinimiAmmo;
  216.         10: Result:= MinMinigunAmmo;
  217.         11: Result:= MinKNIFE;
  218.         12: Result:= MinSawPaliwo;
  219.         13: Result:= MinLawAmmo;
  220.         14: Result:= MinFlameFuel;
  221.         15: Result:= MinARambo;
  222.         16: Result:= MinAFlameRambo;
  223.         255: Result:= MinKNIFE;
  224.     end;    //14 flame //15 rambo //16 flame rambo
  225. end;
  226.  
  227. function GetDmg(ID:byte):integer;
  228. begin
  229.     case (ID) of
  230.         0: Result:=252;
  231.         1: Result:=486;
  232.         2: Result:=127;
  233.         3: Result:=110;
  234.         4: Result:=68;
  235.         5: Result:=250;
  236.         6: Result:=440;
  237.         7: Result:=960000;
  238.         8: Result:=543;
  239.         9: Result:=81;
  240.         10: Result:=47;
  241.         11: Result:=22500000;
  242.         12: Result:=4200;
  243.         13: Result:=150000;
  244.         14: Result:=1200;
  245.         15: Result:=1200;
  246.         16: Result:=800;
  247.     end;
  248. end;
  249.  
  250. function GetWeaponName(Weapon: Byte): String;
  251. begin
  252.     case (Weapon) of
  253.         0: Result := 'USSOCOM';
  254.         1: Result := 'Desert Eagles';
  255.         2: Result := 'HK MP5';
  256.         3: Result := 'Ak-74';
  257.         4: Result := 'Steyr AUG';
  258.         5: Result := 'Spas-12';
  259.         6: Result := 'Ruger 77';
  260.         7: Result := 'M79';
  261.         8: Result := 'Barret M82A1';
  262.         9: Result := 'FN Minimi';
  263.         10: Result := 'XM214 Minigun';
  264.         11: Result:= 'Combat Knife';
  265.         12: Result:= 'Chainsaw';
  266.         13: Result:= 'M72 LAW';
  267.         14: Result:= 'Flamer';
  268.         15: Result:= 'Rambo Bow';
  269.         16: Result:= 'Flamed Arrows';
  270.         else Result := '';
  271.     end;
  272. end;
  273.  
  274. procedure SetPlayerHealth(Player: TActivePlayer; Health, Vest: Single);
  275. var chealth, cvest, delta: Single;
  276. begin
  277.     chealth := Player.Health;   cvest := Player.Vest;
  278.     if ((chealth=health) and (cvest=vest)) then exit;
  279.     if (chealth = 0) then Player.Damage(Player.ID,1000);
  280.     if (vest = 0) then begin
  281.         while (cvest > 0) do begin
  282.             Player.Damage(Player.ID,2);
  283.             cvest := (cvest - 1);
  284.         end;
  285.         Player.Damage(Player.ID,(chealth-health));
  286.         exit;
  287.     end else
  288.     begin
  289.         if (cvest = 0) then begin
  290.             Player.GiveBonus(3);    Player.BigText(HK,'',1,$D0D21D,0.112,20,360);
  291.             cvest := 100;
  292.         end;
  293.         while (chealth <> health) do begin
  294.             if (chealth < health) then delta := -1 else delta := 1;
  295.             Player.Damage(Player.ID,3*delta);
  296.             chealth := (chealth - delta);      
  297.             cvest := (cvest - delta);
  298.             if (cvest < 0) then cvest := 0;    
  299.             if (cvest > 100) then cvest := 100;
  300.             if (cvest = 0) then begin
  301.                 Player.GiveBonus(3);    Player.BigText(HK,'',1,$D0D21D,0.112,20,360);
  302.                 cvest := 100;
  303.             end;
  304.             if (cvest <> vest) then begin
  305.                 if (cvest < vest) then delta := -1 else delta := 1;
  306.                 Player.Damage(Player.ID,2*delta);
  307.                 cvest := (cvest - delta);
  308.             end;
  309.         end;
  310.         while (cvest <> vest) do begin
  311.             if (cvest < vest) then delta := -1 else delta := 1;
  312.             Player.Damage(Player.ID,2*delta);
  313.             cvest := (cvest - delta);
  314.         end;
  315.         exit;
  316.     end;
  317.     Player.GiveBonus(3);    Player.BigText(HK,'',1,$D0D21D,0.112,20,360);
  318.     cvest := 100;
  319.     while (cvest > vest) do begin
  320.         Player.Damage(Player.ID,2);
  321.         cvest := (cvest-1);
  322.     end;
  323. end;
  324.  
  325. procedure PokazKim(Player: TActivePlayer);
  326. begin
  327.     case (PlayerInfo[Player.ID].ClassID) of
  328.         1: begin Player.WriteConsole('                     ',$FF00CC);Player.WriteConsole(chr(13)+chr(10)+'Your class is          Type !class to class information.',$D0D21D); Player.WriteConsole('              assault!',$FF00CC); end;
  329.         2: begin Player.WriteConsole('                     ',$FF00CC);Player.WriteConsole(chr(13)+chr(10)+'Your class is        Type !class to class information.',$D0D21D); Player.WriteConsole('              medic!',$FF00CC);end;
  330.         3: begin Player.WriteConsole('                     ',$FF00CC);Player.WriteConsole(chr(13)+chr(10)+'Your class is         Type !class to class information.',$D0D21D); Player.WriteConsole('              sniper!',$FF00CC);end;
  331.         4: begin Player.WriteConsole('                     ',$FF00CC);Player.WriteConsole(chr(13)+chr(10)+'Your class is          Type !class to class information.',$D0D21D); Player.WriteConsole('              enginer!',$FF00CC);end;
  332.     end;
  333. end;
  334.  
  335. function Sort(input: array of integer): array of integer;
  336. var i,ii,first,last,len,cur: integer; used: array of boolean;
  337. begin
  338.     len := getarraylength(input);
  339.     setarraylength(result,len);
  340.     setarraylength(used,len);
  341.     for i := 0 to len-1 do begin
  342.         for ii := 0 to len-1 do if not (used[ii]) then begin
  343.             cur := input[ii];
  344.             first := ii;
  345.             break;
  346.         end;
  347.         last := first;
  348.         for ii := first to len-1 do if not (used[ii]) then if (input[ii] > cur) then begin
  349.             cur := input[ii];
  350.             last := ii;
  351.         end;
  352.         result[i] := cur;
  353.         used[last] := true;
  354.     end;
  355. end;
  356.  
  357. function RandomClass(ID:byte): byte;
  358. var i,c,x: byte; CanRandom: array of byte; List, List2: array of integer;
  359. begin
  360.     x:=0;
  361.     if (RandomMethodClass=1) or (RandomMethodClass=2) then begin
  362.         setarraylength(List,4); setarraylength(List2,4);
  363.         for i := 1 to 32 do if (Players[i].Active) then begin
  364.             if ((Players[ID].Team=Players[i].Team) and (PlayerInfo[i].ClassID>0)) then begin
  365.                 case (PlayerInfo[i].ClassID) of
  366.                     1: List[0] := List[0]+1;
  367.                     2: List[1] := List[1]+1;
  368.                     3: List[2] := List[2]+1;
  369.                     4: List[3] := List[3]+1;
  370.                 end;
  371.             end;
  372.         end;
  373.         List2:=Sort(List);
  374.         if (RandomMethodClass=2) then c:=1 else c:=0;  
  375.         for i := 0 to 3 do if (List[i]<=List2[3]+c) then begin
  376.             setarraylength(CanRandom,x+1);
  377.             CanRandom[x]:=(i+1);
  378.             x:=x+1;
  379.         end;
  380.         x:=CanRandom[Random(0,GetArrayLength(CanRandom))];
  381.     end else if (RandomMethodClass=3) then x:= Random(1,5);
  382.     Result := x;
  383. end;
  384.  
  385. procedure ClassSet(ID:byte; ChangeClass:boolean);
  386. var i:byte;
  387. begin
  388.     if (ChangeClass) then begin
  389.         i:=RandomClass(ID);
  390.         PlayerInfo[ID].ClassID := i;
  391.     end else i:=PlayerInfo[ID].ClassID;
  392.     case (i) of
  393.         1:  begin
  394.                 Players[id].WeaponActive[1] := true;
  395.                 Players[id].WeaponActive[2] := false;
  396.                 Players[id].WeaponActive[3] := true;
  397.                 Players[id].WeaponActive[4] := true;
  398.                 Players[id].WeaponActive[5] := false;
  399.                 Players[id].WeaponActive[6] := false;
  400.                 Players[id].WeaponActive[7] := false;
  401.                 Players[id].WeaponActive[8] := false;
  402.                 Players[id].WeaponActive[9] := false;
  403.                 Players[id].WeaponActive[10] := false;
  404.                 Players[id].WeaponActive[11] := true;
  405.                 Players[id].WeaponActive[12] := true;
  406.                 Players[id].WeaponActive[13] := false;
  407.                 Players[id].WeaponActive[14] := false;
  408.             end;
  409.         2:  begin
  410.                 Players[id].WeaponActive[1] := false;
  411.                 Players[id].WeaponActive[2] := true;
  412.                 Players[id].WeaponActive[3] := false;
  413.                 Players[id].WeaponActive[4] := false;
  414.                 Players[id].WeaponActive[5] := false;
  415.                 Players[id].WeaponActive[6] := false;
  416.                 Players[id].WeaponActive[7] := false;
  417.                 Players[id].WeaponActive[8] := false;
  418.                 Players[id].WeaponActive[9] := true;
  419.                 Players[id].WeaponActive[10] := true;
  420.                 Players[id].WeaponActive[11] := true;
  421.                 Players[id].WeaponActive[12] := true;
  422.                 Players[id].WeaponActive[13] := false;
  423.                 Players[id].WeaponActive[14] := false;
  424.             end;
  425.         3:  begin
  426.                 Players[id].WeaponActive[1] := false;
  427.                 Players[id].WeaponActive[2] := false;
  428.                 Players[id].WeaponActive[3] := false;
  429.                 Players[id].WeaponActive[4] := false;
  430.                 Players[id].WeaponActive[5] := true;
  431.                 Players[id].WeaponActive[6] := true;
  432.                 Players[id].WeaponActive[7] := false;
  433.                 Players[id].WeaponActive[8] := true;
  434.                 Players[id].WeaponActive[9] := false;
  435.                 Players[id].WeaponActive[10] := false;
  436.                 Players[id].WeaponActive[11] := true;
  437.                 Players[id].WeaponActive[12] := true;
  438.                 Players[id].WeaponActive[13] := false;
  439.                 Players[id].WeaponActive[14] := false;
  440.             end;
  441.         4:  begin
  442.                 Players[id].WeaponActive[1] := false;
  443.                 Players[id].WeaponActive[2] := true;
  444.                 Players[id].WeaponActive[3] := false;
  445.                 Players[id].WeaponActive[4] := true;
  446.                 Players[id].WeaponActive[5] := false;
  447.                 Players[id].WeaponActive[6] := false;
  448.                 Players[id].WeaponActive[7] := true;
  449.                 Players[id].WeaponActive[8] := false;
  450.                 Players[id].WeaponActive[9] := false;
  451.                 Players[id].WeaponActive[10] := false;
  452.                 Players[id].WeaponActive[11] := false;
  453.                 Players[id].WeaponActive[12] := false;
  454.                 Players[id].WeaponActive[13] := true;
  455.                 Players[id].WeaponActive[14] := true;
  456.             end;
  457.     end;
  458. end;
  459.  
  460. function CheckPlayerWeapons(Player: TActivePlayer; Method: byte): boolean;
  461. var ob:byte;
  462. begin
  463.     Result:=false;  w1:=255; w2:=255; ob:=0;
  464.     if (Method=1) then begin
  465.         case (PlayerInfo[Player.ID].ClassID) of
  466.             1:  begin
  467.                     if (Player.Primary.Wtype=1) or (Player.Primary.Wtype=3) or (Player.Primary.Wtype=4) or (Player.Primary.Wtype=0) or (Player.Primary.Wtype=11) then begin
  468.                         w1:=Player.Primary.Wtype;
  469.                         ob:=1;
  470.                     end;
  471.                     if (Player.Secondary.Wtype=1) or (Player.Secondary.Wtype=3) or (Player.Secondary.Wtype=4) or (Player.Secondary.Wtype=0) or (Player.Secondary.Wtype=11) then begin
  472.                         w2:=Player.Secondary.Wtype;
  473.                         ob:=1;
  474.                     end;
  475.                 end;
  476.             2:  begin
  477.                     if (Player.Primary.Wtype=2) or (Player.Primary.Wtype=9) or (Player.Primary.Wtype=10) or (Player.Primary.Wtype=0) or (Player.Primary.Wtype=11) then begin
  478.                         w1:=Player.Primary.Wtype;
  479.                         ob:=1;
  480.                     end;
  481.                     if (Player.Secondary.Wtype=2) or (Player.Secondary.Wtype=9) or (Player.Secondary.Wtype=10) or (Player.Secondary.Wtype=0) or (Player.Secondary.Wtype=11) then begin
  482.                         w2:=Player.Secondary.Wtype;
  483.                         ob:=1;
  484.                     end;
  485.                 end;
  486.             3:  begin
  487.                     if (Player.Primary.Wtype=5) or (Player.Primary.Wtype=6) or (Player.Primary.Wtype=8) or (Player.Primary.Wtype=0) or (Player.Primary.Wtype=11) then begin
  488.                         w1:=Player.Primary.Wtype;
  489.                         ob:=1;
  490.                     end;
  491.                     if (Player.Secondary.Wtype=5) or (Player.Secondary.Wtype=6) or (Player.Secondary.Wtype=8) or (Player.Secondary.Wtype=0) or (Player.Secondary.Wtype=11) then begin
  492.                         w2:=Player.Secondary.Wtype;
  493.                         ob:=1;
  494.                     end;
  495.                 end;
  496.             4:  begin
  497.                     if (Player.Primary.Wtype=2) or (Player.Primary.Wtype=4) or (Player.Primary.Wtype=7) or (Player.Primary.Wtype=12) or (Player.Primary.Wtype=13) then begin
  498.                         w1:=Player.Primary.Wtype;
  499.                         ob:=1;
  500.                     end;
  501.                     if (Player.Secondary.Wtype=2) or (Player.Secondary.Wtype=4) or (Player.Secondary.Wtype=7) or (Player.Secondary.Wtype=12) or (Player.Secondary.Wtype=13) then begin
  502.                         w2:=Player.Secondary.Wtype;
  503.                         ob:=1;
  504.                     end;
  505.                 end;
  506.         end;
  507.         if (ob=1) then Result:=true;
  508.     end;
  509.     if (Method=2) then begin
  510.         case (PlayerInfo[Player.ID].ClassID) of
  511.             1:  if (Player.Primary.Wtype=1) or (Player.Primary.Wtype=3) or (Player.Primary.Wtype=4) or (Player.Primary.Wtype=0) or (Player.Primary.Wtype=11) then Result:=true;
  512.             2:  if (Player.Primary.Wtype=2) or (Player.Primary.Wtype=9) or (Player.Primary.Wtype=10) or (Player.Primary.Wtype=0) or (Player.Primary.Wtype=11) then Result:=true;
  513.             3:  if (Player.Primary.Wtype=5) or (Player.Primary.Wtype=6) or (Player.Primary.Wtype=8) or (Player.Primary.Wtype=0) or (Player.Primary.Wtype=11) then Result:=true;
  514.             4:  if (Player.Primary.Wtype=2) or (Player.Primary.Wtype=4) or (Player.Primary.Wtype=7) or (Player.Primary.Wtype=12) or (Player.Primary.Wtype=13) then Result:=true;
  515.         end;
  516.     end;
  517. end;
  518.  
  519. procedure WeaponAmmoChangeLimit(ID:byte);
  520. var NW,NS:TNewWeapon; WeapChangeRan:byte;
  521. begin
  522.     case (PlayerInfo[id].ClassID) of
  523.         1:  begin
  524.                 if (PlayerInfo[ID].Resp=False) then begin
  525.                     if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
  526.                     if (Players[id].Secondary.Wtype>16) then PlayerInfo[ID].Wep2 := 17 else PlayerInfo[ID].Wep2 := Players[id].Secondary.Wtype;
  527.                     if (PlayerInfo[ID].Wep1<18) and (PlayerInfo[ID].Wep2<18) then begin
  528.                         WepAmmo[PlayerInfo[ID].Wep1][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep1);
  529.                         WepAmmo[PlayerInfo[ID].Wep2][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep2);
  530.                     end;
  531.                     if (PlayerInfo[ID].Wep2=12) or (PlayerInfo[ID].Wep2=13) then begin
  532.                         WeapChangeRan:=iif(Random(1,3)=1,11,0);
  533.                         NS:=TNewWeapon.Create();    NS.WType:=PlayerInfo[ID].Wep1;  NS.Ammo:=GetMinAmmo(PlayerInfo[ID].Wep1);
  534.                         NW:=TNewWeapon.Create();    NW.WType:=WeapChangeRan;        NW.Ammo:=GetMinAmmo(WeapChangeRan);
  535.                         WepAmmo[PlayerInfo[ID].Wep2][ID]:=(GetMinAmmo(PlayerInfo[ID].Wep2)-Random(0,1+Trunc(RanDropAmmo*GetMinAmmo(PlayerInfo[ID].Wep2))));
  536.                         WepAmmo[WeapChangeRan][ID]:=GetMaxAmmo(WeapChangeRan);
  537.                         Players[ID].ForceWeapon(NS,NW);
  538.                         NS.Free(); NW.Free();
  539.                     end;
  540.                 end else
  541.                 begin
  542.                     WepAmmo[1][ID]:=GetMaxAmmo(1);
  543.                     WepAmmo[3][ID]:=GetMaxAmmo(3);
  544.                     WepAmmo[4][ID]:=GetMaxAmmo(4);
  545.                     WepAmmo[0][ID]:=GetMaxAmmo(0);
  546.                     WepAmmo[11][ID]:=GetMaxAmmo(11);
  547.                 end;
  548.             end;
  549.         2:  begin
  550.                 if (PlayerInfo[ID].Resp=False) then begin
  551.                     if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
  552.                     if (Players[id].Secondary.Wtype>16) then PlayerInfo[ID].Wep2 := 17 else PlayerInfo[ID].Wep2 := Players[id].Secondary.Wtype;
  553.                     if (PlayerInfo[ID].Wep1<18) and (PlayerInfo[ID].Wep2<18) then begin
  554.                         WepAmmo[PlayerInfo[ID].Wep1][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep1);
  555.                         WepAmmo[PlayerInfo[ID].Wep2][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep2);
  556.                     end;
  557.                     if (PlayerInfo[ID].Wep2=12) or (PlayerInfo[ID].Wep2=13) then begin
  558.                         WeapChangeRan:=iif(Random(1,3)=1,11,0);
  559.                         NS:=TNewWeapon.Create();    NS.WType:=PlayerInfo[ID].Wep1;  NS.Ammo:=GetMinAmmo(PlayerInfo[ID].Wep1);
  560.                         NW:=TNewWeapon.Create();    NW.WType:=WeapChangeRan;        NW.Ammo:=GetMinAmmo(WeapChangeRan);
  561.                         WepAmmo[PlayerInfo[ID].Wep2][ID]:=(GetMinAmmo(PlayerInfo[ID].Wep2)-Random(0,1+Trunc(RanDropAmmo*GetMinAmmo(PlayerInfo[ID].Wep2))));
  562.                         WepAmmo[WeapChangeRan][ID]:=GetMaxAmmo(WeapChangeRan);
  563.                         Players[ID].ForceWeapon(NS,NW);
  564.                         NS.Free(); NW.Free();
  565.                     end;
  566.                 end else
  567.                 begin
  568.                     WepAmmo[2][ID]:=GetMaxAmmo(2);
  569.                     WepAmmo[9][ID]:=GetMaxAmmo(9);
  570.                     WepAmmo[10][ID]:=GetMaxAmmo(10);
  571.                     WepAmmo[0][ID]:=GetMaxAmmo(0);
  572.                     WepAmmo[11][ID]:=GetMaxAmmo(11);
  573.                 end;
  574.             end;
  575.         3:  begin
  576.                 if (PlayerInfo[ID].Resp=False) then begin
  577.                     if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
  578.                     if (Players[id].Secondary.Wtype>16) then PlayerInfo[ID].Wep2 := 17 else PlayerInfo[ID].Wep2 := Players[id].Secondary.Wtype;
  579.                     if (PlayerInfo[ID].Wep1<18) and (PlayerInfo[ID].Wep2<18) then begin
  580.                         WepAmmo[PlayerInfo[ID].Wep1][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep1);
  581.                         WepAmmo[PlayerInfo[ID].Wep2][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep2);
  582.                     end;
  583.                     if (PlayerInfo[ID].Wep2=12) or (PlayerInfo[ID].Wep2=13) then begin
  584.                         WeapChangeRan:=iif(Random(1,3)=1,11,0);
  585.                         NS:=TNewWeapon.Create();    NS.WType:=PlayerInfo[ID].Wep1;  NS.Ammo:=GetMinAmmo(PlayerInfo[ID].Wep1);
  586.                         NW:=TNewWeapon.Create();    NW.WType:=WeapChangeRan;        NW.Ammo:=GetMinAmmo(WeapChangeRan);
  587.                         WepAmmo[PlayerInfo[ID].Wep2][ID]:=(GetMinAmmo(PlayerInfo[ID].Wep2)-Random(0,1+Trunc(RanDropAmmo*GetMinAmmo(PlayerInfo[ID].Wep2))));
  588.                         WepAmmo[WeapChangeRan][ID]:=GetMaxAmmo(WeapChangeRan);
  589.                         Players[ID].ForceWeapon(NS,NW);
  590.                         NS.Free(); NW.Free();
  591.                     end;
  592.                 end else
  593.                 begin
  594.                     WepAmmo[5][ID]:=GetMaxAmmo(5);
  595.                     WepAmmo[6][ID]:=GetMaxAmmo(6);
  596.                     WepAmmo[8][ID]:=GetMaxAmmo(8);
  597.                     WepAmmo[0][ID]:=GetMaxAmmo(0);
  598.                     WepAmmo[11][ID]:=GetMaxAmmo(11);
  599.                 end;
  600.             end;
  601.         4:  begin
  602.                 if (PlayerInfo[ID].Resp=False) then begin
  603.                     if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
  604.                     if (Players[id].Secondary.Wtype>16) then PlayerInfo[ID].Wep2 := 17 else PlayerInfo[ID].Wep2 := Players[id].Secondary.Wtype;
  605.                     if (PlayerInfo[ID].Wep1<18) and (PlayerInfo[ID].Wep2<18) then begin
  606.                         WepAmmo[PlayerInfo[ID].Wep1][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep1);
  607.                         WepAmmo[PlayerInfo[ID].Wep2][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep2);
  608.                     end;
  609.                     if (PlayerInfo[ID].Wep2=17) or (PlayerInfo[ID].Wep2=0) or (PlayerInfo[ID].Wep2=11) then begin
  610.                         NS:=TNewWeapon.Create();    NS.WType:=PlayerInfo[ID].Wep1;  NS.Ammo:=GetMinAmmo(PlayerInfo[ID].Wep1);
  611.                         NW:=TNewWeapon.Create();    NW.WType:=13;                   NW.Ammo:=GetMinAmmo(13);
  612.                         if (PlayerInfo[ID].Wep2<>17) then WepAmmo[PlayerInfo[ID].Wep2][ID]:=(GetMinAmmo(PlayerInfo[ID].Wep2)-Random(0,1+Trunc(RanDropAmmo*GetMinAmmo(PlayerInfo[ID].Wep2))));
  613.                         WepAmmo[13][ID]:=GetMaxAmmo(13);
  614.                         Players[ID].ForceWeapon(NS,NW);
  615.                         NS.Free(); NW.Free();
  616.                     end;
  617.                 end else
  618.                 begin
  619.                     WepAmmo[2][ID]:=GetMaxAmmo(2);
  620.                     WepAmmo[4][ID]:=GetMaxAmmo(4);
  621.                     WepAmmo[7][ID]:=GetMaxAmmo(7);
  622.                     WepAmmo[12][ID]:=GetMaxAmmo(12);
  623.                     WepAmmo[13][ID]:=GetMaxAmmo(13);
  624.                 end;
  625.             end;
  626.     end;
  627. end;
  628.  
  629. procedure LowAmmoInfo(ID, Weapon: byte);
  630. begin   //Saw is in AmmoDisplay() section;
  631.     if (Weapon>0) and (Weapon<>1) and (Weapon<5) then begin //HK mp5, ak, aug
  632.         if(WepAmmo[Weapon][ID]<=AutomaticRifleInfo) then begin
  633.             PlayerInfo[id].NumDisp := 0;
  634.             if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
  635.                 PlayerInfo[id].CanGetAmmo:=true;
  636.                 Players[ID].WriteConsole('  ',$D0D21D);
  637.                 Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
  638.             end;
  639.         end;
  640.     end;
  641.     if (Weapon>8) and (Weapon<11) then begin    //Minimi, minigun
  642.         if (WepAmmo[Weapon][ID]<=AutomaticRifleInfo) then begin
  643.             PlayerInfo[id].NumDisp := 0;
  644.             if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
  645.                 PlayerInfo[id].CanGetAmmo:=true;
  646.                 Players[ID].WriteConsole('  ',$D0D21D);
  647.                 Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
  648.             end;
  649.         end;
  650.     end;
  651.    
  652.     if (Weapon=0) then begin //Socom
  653.         if (WepAmmo[Weapon][ID]<=SocomInfo) then begin
  654.             PlayerInfo[id].NumDisp := 0;
  655.             if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
  656.                 PlayerInfo[id].CanGetAmmo:=true;
  657.                 Players[ID].WriteConsole('  ',$D0D21D);
  658.                 Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
  659.             end;
  660.         end;
  661.     end;
  662.     if (Weapon=8) then begin //Barrett
  663.         if (WepAmmo[Weapon][ID]<=BarrettInfo) then begin
  664.             PlayerInfo[id].NumDisp := 0;
  665.             if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
  666.                 PlayerInfo[id].CanGetAmmo:=true;
  667.                 Players[ID].WriteConsole('  ',$D0D21D);
  668.                 Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
  669.             end;
  670.         end;
  671.     end;
  672.    
  673.     if (Weapon=1) or (Weapon=5) or (Weapon=6) then begin    //Deagle, ruger, spas
  674.         if (WepAmmo[Weapon][ID]<=NoAutoInfo) then begin
  675.             PlayerInfo[id].NumDisp := 0;
  676.             if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
  677.                 PlayerInfo[id].CanGetAmmo:=true;
  678.                 Players[ID].WriteConsole('  ',$D0D21D);
  679.                 Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
  680.             end;
  681.         end;
  682.     end;
  683.     if (Weapon=7) or (Weapon=13) then begin //M79, law
  684.         if (WepAmmo[Weapon][ID]<=ExplodeInfo) then begin
  685.             PlayerInfo[id].NumDisp := 0;
  686.             if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
  687.                 PlayerInfo[id].CanGetAmmo:=true;
  688.                 Players[ID].WriteConsole('  ',$D0D21D);
  689.                 Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
  690.             end;
  691.         end;
  692.     end;
  693. end;
  694.  
  695. procedure OnPlayerShoot(ID, Weapon: byte);
  696. begin
  697.     if (PlayerInfo[ID].Resp) then begin
  698.         PlayerInfo[ID].Resp:=false;
  699.         WeaponAmmoChangeLimit(ID);
  700.     end;
  701.     if (PlayerInfo[ID].Resp=false) then begin
  702.         if (Weapon<>255) and (Weapon<>11) then begin
  703.             WepAmmo[Weapon][ID]:=(WepAmmo[Weapon][ID]-1);
  704.             if (WepAmmo[Weapon][ID]<>0) then LowAmmoInfo(ID,Weapon) else begin
  705.                 if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetWeapon=false) then begin
  706.                     PlayerInfo[id].NumDisp := MaxDispLowAmmo;
  707.                     Players[id].BigText(LA,'No ammo! Back base to take weapon.', 220,$990000,0.15,85,222);  //How center: x := 640-Round(len*16.3235);
  708.                     Players[ID].WriteConsole('  ',$D0D21D);
  709.                     Players[ID].WriteConsole('You can go back to base to take a new weapon.',$D0D21D);
  710.                     PlayerInfo[id].CanGetAmmo:=false;
  711.                     PlayerInfo[id].CanGetWeapon:=true;
  712.                 end;
  713.             end;
  714.         end;
  715.     end;
  716. end;
  717.  
  718. procedure ShootKeyCheck();
  719. var i: byte;
  720. begin
  721.     for i := 1 to 32 do if (Players[i].Active) and (Players[i].Primary.ammo<>Ammo[i]) then begin
  722.         if (Players[i].KeyShoot=true) and (Players[i].Primary.wtype = Weap[i]) and (Players[i].Primary.ammo >= 0) and (Players[i].Primary.ammo < Ammo[i]) then OnPlayerShoot(i,Players[i].Primary.wtype);
  723.         Weap[i] := Players[i].Primary.wtype;
  724.         Ammo[i] := Players[i].Primary.ammo;
  725.     end;
  726. end;
  727.  
  728. Procedure AmmoDisplay(Ticks:integer);
  729. var i,b: byte; Punch: TNewWeapon;
  730. begin
  731.     for i := 1 to 32 do if (Players[i].Active) then begin
  732.         if (Players[i].Alive) then begin
  733.             if (PlayerInfo[i].Resp=false) then begin
  734.                 for b := 0 to 16 do begin
  735.                     if (Players[i].Primary.wtype=255) then begin
  736.                         Players[i].BigText(HA,'Punch!', 100,$FFB300,0.055,12,435);
  737.                         break;
  738.                     end;
  739.                     if (Players[i].Primary.wtype=b) then begin
  740.                         if (b<>11) then begin
  741.                             if (b=12) then begin
  742.                                 if ((Ticks mod 2) = 0) then WepAmmo[b][i]:=(WepAmmo[b][i]-1);
  743.                                 Players[i].BigText(HA,'Fuel: '+inttostr(WepAmmo[b][i]),100,$FFB300,0.055,12,435);
  744.                                 if (WepAmmo[b][i]<=SawInfo) then begin
  745.                                     if (WepAmmo[b][i]<=0) then begin
  746.                                         PlayerInfo[i].NumDisp := MaxDispLowAmmo;
  747.                                         Players[i].BigText(LA,'No ammo! Back base to take weapon.', 220,$990000,0.15,85,222);   //How center: x := 640-Round(len*16.3235);
  748.                                         Players[i].WriteConsole('  ',$D0D21D);
  749.                                         Players[i].WriteConsole('You can go back to base to take a new weapon.',$D0D21D);
  750.                                         PlayerInfo[i].CanGetAmmo:=false;
  751.                                         PlayerInfo[i].CanGetWeapon:=true;
  752.                                     end else
  753.                                     begin
  754.                                         PlayerInfo[i].NumDisp := 0;
  755.                                         if (PlayerInfo[i].CanGetAmmo=false) then begin
  756.                                             PlayerInfo[i].CanGetAmmo:=true;
  757.                                             Players[i].WriteConsole('  ',$D0D21D);
  758.                                             Players[i].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
  759.                                         end;
  760.                                     end;
  761.                                 end;
  762.                             end else Players[i].BigText(HA,'Ammo: '+inttostr(WepAmmo[b][i]),100,$FFB300,0.055,12,435);
  763.                         end else Players[i].BigText(HA,'Knife!',100,$FFB300,0.055,12,435);
  764.                         if (WepAmmo[b][i]=0) then begin
  765.                             Punch:=TNewWeapon.Create();
  766.                             Punch.WType:=255;
  767.                             Players[i].ForceWeapon(Punch,Players[i].Secondary);
  768.                             Punch.Free();
  769.                         end;
  770.                     end;
  771.                 end;
  772.             end else Players[i].BigText(HA,'Ammo: Choosing!',100,$FFB300,0.055,12,435);
  773.         end else Players[i].BigText(HA,'',100,$FFB300,0.055,12,435);
  774.     end;
  775. end;
  776.  
  777. procedure AddToPointsEventList(Player: TActivePlayer; Text: String; Add: integer);
  778. var len: integer;
  779. begin
  780.     len := GetArrayLength(PointsEvents[Player.ID]);
  781.     SetArrayLength(PointsEvents[Player.ID],len+1);
  782.     PointsEvents[Player.ID][len] := Text;
  783.     PlayerInfo[Player.ID].Points:=(PlayerInfo[Player.ID].Points+Add);
  784. end;
  785.  
  786. procedure OnPlayerDeathGiveAssists(Victim: TActivePlayer);
  787. var i: byte;
  788. begin
  789.     for i := 1 to 32 do if (Players[i].Active) then if (Victim.ID <> i) and (PlayersInfoArr[Victim.ID].KilledBy <> i) then begin
  790.         if (PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[i] > 0) or (CooldownTimer = 0) then begin
  791.             if (PlayersInfoArr[Victim.ID].DamageRecievedByID[i] > AssistMinimumDamagePercent) then begin
  792.                 AddToPointsEventList(Victim,'+60 Assist!',60);
  793.             end;
  794.         end;
  795.     end;
  796. end;
  797.  
  798. Procedure RemoveAllDamageToOnDeath(ID:byte);
  799. var i: byte;
  800. Begin
  801.     for i := 1 to 32 do begin
  802.         PlayersInfoArr[i].DamageRecievedByCooldown[ID] := 0;
  803.         PlayersInfoArr[i].DamageRecievedByID[33] := PlayersInfoArr[i].DamageRecievedByID[33] + PlayersInfoArr[i].DamageRecievedByID[ID];
  804.         PlayersInfoArr[i].DamageRecievedByID[ID] := 0;
  805.     end;
  806. end;
  807.  
  808. Function TotalPercentDamageRecieved(ID:byte): double;
  809. var i: byte; TotalDamagePercent: double;
  810. Begin
  811.     TotalDamagePercent := 0;
  812.     for i := 1 to 33 do if (PlayersInfoArr[ID].DamageRecievedByID[i] <> 0) then TotalDamagePercent := TotalDamagePercent +  PlayersInfoArr[ID].DamageRecievedByID[i];
  813.     result := TotalDamagePercent;
  814. end;
  815.  
  816. Function MostPercentDamagedoneBy(ID:byte): integer;
  817. var i: byte; MostPercentDamagedone: double;
  818. Begin
  819.     MostPercentDamagedone := 0;
  820.     for i := 1 to 33 do if (PlayersInfoArr[ID].DamageRecievedByID[i] > MostPercentDamagedone) then begin
  821.         MostPercentDamagedone := PlayersInfoArr[ID].DamageRecievedByID[i];
  822.         result := i;
  823.     end;
  824. end;
  825.  
  826. Procedure RemoveDamageDoneBy(ID: byte; DamagePercent: Double);
  827. var i: byte; CountAttackers: integer; DividedDamagePercent: double; DamagePercentLeft: double;
  828. Begin
  829.     CountAttackers := 0;
  830.     for i := 1 to 32 do if (Players[i].Active) then if (PlayersInfoArr[ID].DamageRecievedByID[i] <> 0) then CountAttackers:=(CountAttackers+1);
  831.     if (CountAttackers > 0) then begin
  832.         DividedDamagePercent := (DamagePercent/CountAttackers);
  833.         for i := 1 to 33 do if (PlayersInfoArr[ID].DamageRecievedByID[i] <> 0) then begin
  834.             if ((PlayersInfoArr[ID].DamageRecievedByID[i] - DividedDamagePercent) < 0) then begin          
  835.                 PlayersInfoArr[ID].DamageRecievedByID[i] := 0;
  836.                 DamagePercentLeft := (DividedDamagePercent - PlayersInfoArr[ID].DamageRecievedByID[i]);
  837.             end else PlayersInfoArr[ID].DamageRecievedByID[i] := (PlayersInfoArr[ID].DamageRecievedByID[i] - DividedDamagePercent);
  838.         end;
  839.     end;
  840.     if (DamagePercentLeft <> 0) then RemoveDamageDoneBy(ID,DamagePercentLeft);
  841. end;
  842.  
  843. procedure DestoryStat(Stat, i: byte);
  844. begin
  845.     Map.CreateBullet(Map.Objects[Stat].X,Map.Objects[Stat].Y+6,0,0,1000,5,Players[i]);
  846.     Map.CreateBullet(Map.Objects[Stat].X-8,Map.Objects[Stat].Y+6,0,0,1000,5,Players[i]);
  847.     Map.CreateBullet(Map.Objects[Stat].X+8,Map.Objects[Stat].Y+6,0,0,1000,5,Players[i]);
  848.     Map.CreateBullet(Map.Objects[Stat].X,Map.Objects[Stat].Y,0,0,1000,5,Players[i]);
  849.     //PlaySound(0,'cluster-explosion.wav',Map.Objects[Stat].X,Map.Objects[Stat].Y);
  850.     PlayerInfo[i].StatID:=-1;
  851.     Map.Objects[Stat].Kill;
  852. end;
  853.  
  854. procedure DestoryObjectMG(id:byte);
  855. begin
  856.     if (PlayerInfo[id].SpawnedID<>0) then begin
  857.         if (Map.Objects[PlayerInfo[id].SpawnedID].Active) and ((Map.Objects[PlayerInfo[id].SpawnedID].Style=16) or (Map.Objects[PlayerInfo[id].SpawnedID].Style=17)) then Map.Objects[PlayerInfo[id].SpawnedID].Kill;
  858.         PlayerInfo[id].SpawnedID:=0;
  859.     end;
  860. end;
  861.  
  862. procedure ResVar(ID:byte; recompile:boolean);
  863. var i:byte;
  864. begin
  865.     //~~~ Type ~~~
  866.     PlayerInfo[ID].ClassID:=0;
  867.     PlayerInfo[ID].Gives:=0;
  868.     PlayerInfo[ID].Wep1:=17;
  869.     PlayerInfo[ID].Wep2:=17;
  870.     PlayerInfo[ID].AmmoGiven:=0;
  871.     PlayerInfo[ID].BarrettAmmoGiven:=0;
  872.     PlayerInfo[id].NumDisp := MaxDispLowAmmo;
  873.     PlayerInfo[id].CanGetAmmo:=false;
  874.     PlayerInfo[id].CanGetWeapon:=false;
  875.     PlayerInfo[id].GetsW:=-1;
  876.     PlayerInfo[id].GetsA:=-1;
  877.     PlayerInfo[id].CanReset:=true;
  878.  
  879.     Revenge[id] := '';
  880.     Ttimer[id] := 0;
  881.  
  882.     Combo[ID].H:=0;
  883.     Combo[ID].T:=0;
  884.  
  885.     //~~~ AMMO ~~~
  886.     for i := 0 to 16 do if ((i<>7) and (i<>8) and (i<>13)) then WepAmmo[i][ID]:=(GetMinAmmo(i)-Random(0,1+Trunc(RanDropAmmo*GetMinAmmo(i)))) else begin
  887.         case (i) of
  888.             7:  WepAmmo[i][ID]:=Random(1,3);
  889.             8:  WepAmmo[i][ID]:=Random(1,5);
  890.             13: WepAmmo[i][ID]:=Random(1,2);
  891.         end;
  892.     end;
  893.  
  894.     DefiblirateTime[ID]:=0;
  895.     PlayerInfo[ID].Medkit:=0;
  896.     DestoryObjectMG(id);
  897.  
  898.     PlayerInfo[id].WsparcieDT:=0;
  899.     if (PlayerInfo[id].StatID<>-1) then begin
  900.         if (recompile) then PlayerInfo[id].StatID:=-1 else DestoryStat(PlayerInfo[id].StatID,id);
  901.         PlayerInfo[id].StatTime:=0;
  902.         PlayerInfo[id].StatID:=-1;
  903.     end;
  904.     PlayerInfo[id].RocketType:=deffaultrockettype;
  905.     PlayerInfo[id].RocketAmmo:=MaxExtraRocket;
  906.     PlayerInfo[id].StatTime:=0;
  907.  
  908.     PlayerInfo[id].MozdziezT:=0;
  909.     PlayerInfo[id].SniperBandage:=0;
  910. end;
  911.  
  912. function Commands(Player: TActivePlayer; Text: string): Boolean;
  913. var b, OB: byte; MediTemp: TNewMapObject;  ObjData:TActiveMapObject; tempx, tempy:single;
  914. begin
  915.     if (Player.IsAdmin) then begin
  916.         if (Text='/1') then begin PlayerInfo[Player.id].ClassID := 1; ClassSet(Player.ID,false); end;
  917.         if (Text='/2') then begin PlayerInfo[Player.id].ClassID := 2; ClassSet(Player.ID,false); end;
  918.         if (Text='/3') then begin PlayerInfo[Player.id].ClassID := 3; ClassSet(Player.ID,false); end;
  919.         if (Text='/4') then begin PlayerInfo[Player.id].ClassID := 4; ClassSet(Player.ID,false); end;
  920.     end;
  921.     if (Text='/getweapon') then begin
  922.         if (PlayerInfo[player.id].GetsA=-1) then begin
  923.             if (PlayerInfo[player.id].GetsW=-1) then begin
  924.                 if (Player.Team=1) then begin tempx:=FlagX[1]; tempy:=Flagy[1]; end else if (Player.Team=2) then begin tempx:=FlagX[2]; tempy:=Flagy[2]; end;
  925.                 if (Distance(Player.X,Player.Y,tempx,tempy)<=43) then begin
  926.                     if (PlayerInfo[player.id].CanGetWeapon) then PlayerInfo[player.id].GetsW := TimeToGetWeapon else PlayerInfo[player.id].GetsW := TimeToGetWeaponBig;
  927.                 end else Player.WriteConsole('Move closer to your flag.',$D0D21D);
  928.             end else Player.WriteConsole('Already waiting for a supply of weapons.',$D0D21D);
  929.         end else Player.WriteConsole('Currently waiting for a supply of ammunition.',$D0D21D);
  930.     end;
  931.     if (Text='/getammo') then begin
  932.         if (PlayerInfo[player.id].GetsW=-1) then begin
  933.             if (PlayerInfo[player.id].GetsA=-1) then begin
  934.                 if (Player.Team=1) then begin tempx:=FlagX[1]; tempy:=Flagy[1]; end else if (Player.Team=2) then begin tempx:=FlagX[2]; tempy:=Flagy[2]; end;
  935.                 if (Distance(Player.X,Player.Y,tempx,tempy)<=43) then begin
  936.                     if (CheckPlayerWeapons(Player,1)) then begin
  937.                         ob:=0;  if (w1<>255) then if (WepAmmo[w1][player.id]<GetMaxAmmo(w1)) then ob:=1;    if (w2<>255) then if (WepAmmo[w2][player.id]<GetMaxAmmo(w2)) then ob:=1;
  938.                         if (ob>0) then begin
  939.                             if (PlayerInfo[player.id].CanGetAmmo) then PlayerInfo[player.id].GetsA := TimeToGetAmmoNormal else PlayerInfo[player.id].GetsA := TimeToGetAmmoBig;
  940.                         end else Player.WriteConsole('You have a maximum amount of ammunition in all weapons.',$D0D21D);
  941.                     end else Player.WriteConsole('Do not have the appropriate weapons, type /getweapon to get new.',$D0D21D);
  942.                 end else Player.WriteConsole('Move closer to your flag.',$D0D21D);
  943.             end else Player.WriteConsole('Already waiting for a supply of ammunition.',$D0D21D);
  944.         end else Player.WriteConsole('Currently waiting for a supply of weapons.',$D0D21D);
  945.     end;
  946.     if (Text='/cc1') then begin
  947.         if (PlayerInfo[Player.id].ClassID=1) and (PlayerInfo[Player.id].WsparcieDT<=0) and (Player.Alive) then PlayerInfo[Player.id].WsparcieDT:=(WTT+WC);      //Wsparcie
  948.         if (PlayerInfo[Player.id].ClassID=2) and (DefiblirateTime[Player.id]<=0) and (Player.Alive) then begin      //Defiblirate
  949.             for b := 1 to 32 do if (Players[b].Active) then begin
  950.                 if (Players[b].Alive=false) and (Player.Team = Players[b].Team) then if (Distance(Player.X,Player.Y,Players[b].X,Players[b].Y) <= 22) then begin
  951.                     Players[b].Alive:=True;
  952.                     PlayerInfo[Players[b].ID].ClassID := PlayerInfo[Players[b].ID].LastClassID;
  953.                     case (PlayerInfo[Players[b].ID].ClassID) of
  954.                         1: Players[b].WriteConsole('You come back to game as the assault, rescued by '+Player.Name,$D0D21D);
  955.                         2: Players[b].WriteConsole('You come back to game as theo medic, rescued by '+Player.Name,$D0D21D);
  956.                         3: Players[b].WriteConsole('You come back to game as the sniper, rescued by '+Player.Name,$D0D21D);
  957.                         4: Players[b].WriteConsole('You come back to game as the enginer, rescued by '+Player.Name,$D0D21D);
  958.                     end;
  959.                     Players[b].Move(Player.x,Player.y);
  960.                     DefiblirateTime[Player.id]:=DefiblirateToNext;
  961.                     AddToPointsEventList(Player,'+50 Defibrillation!',50);
  962.                 end;
  963.             end;
  964.         end;
  965.         if (PlayerInfo[Player.id].ClassID=3) then begin
  966.             if (PlayerInfo[Player.id].SniperBandage<=0) and (Player.Health<MaxHealth) and (Player.Alive) then begin
  967.                 PlayerInfo[Player.id].SniperBandage:=SniperBandageTime;
  968.                 if ((Player.Health+round(0.42*MaxHealth))>MaxHealth) then SetPlayerHealth(Player,MaxHealth,Player.Vest) else SetPlayerHealth(Player,Player.Health+round(0.42*MaxHealth),Player.Vest);
  969.             end;
  970.         end;
  971.         if (PlayerInfo[Player.id].ClassID=4) then begin
  972.             if (Player.Primary.wtype=13) or (Player.Secondary.wtype=13) then begin
  973.                 if (PlayerInfo[Player.id].RocketType=1) then begin
  974.                     if (PlayerInfo[Player.id].RocketAmmo<=0) then Player.BigText(HS1,'RocketType: Extra(NoAmmo)',130,$B80000,0.055,12,405) else PlayerInfo[Player.id].RocketType:=2;   
  975.                 end else PlayerInfo[Player.id].RocketType:=1;
  976.             end else Player.BigText(HS1,'Rocket: Lack-M72 LAW',130,$B80000,0.055,12,405);
  977.         end;
  978.     end;
  979.     if (Text='/cc2') then begin
  980.         if (PlayerInfo[Player.id].ClassID=1) and (PlayerInfo[Player.id].Medkit<=0) and (Player.Alive) then begin        //Create Granadekit
  981.             DestoryObjectMG(Player.ID);
  982.             MediTemp := TNewMapObject.Create;
  983.             MediTemp.X := Player.X+iif((Player.Direction=1),-19,25);
  984.             MediTemp.Y := Player.Y-12;
  985.             MediTemp.Style := 17;
  986.             ObjData:=Map.AddObject(MediTemp);   PlayerInfo[Player.id].SpawnedID := ObjData.id;
  987.             MediTemp.Free;
  988.             PlayerInfo[Player.id].Medkit:=GranadekitTimeAdd;
  989.             AddToPointsEventList(Player,'+10 Granadekit!',10);
  990.         end;
  991.         if (PlayerInfo[Player.id].ClassID=2) and (PlayerInfo[Player.id].Medkit<=0) and (Player.Alive) then begin        //Create Medkit
  992.             DestoryObjectMG(Player.ID);
  993.             MediTemp := TNewMapObject.Create;
  994.             MediTemp.X := Player.X+iif((Player.Direction=1),-19,25);
  995.             MediTemp.Y := Player.Y-12;
  996.             MediTemp.Style := 16;
  997.             ObjData:=Map.AddObject(MediTemp);   PlayerInfo[Player.id].SpawnedID := ObjData.id;
  998.             MediTemp.Free;
  999.             PlayerInfo[Player.id].Medkit:=MedkitTimeAdd;
  1000.             AddToPointsEventList(Player,'+10 Medkit!',10);
  1001.         end;
  1002.         if (PlayerInfo[Player.id].ClassID=3) then begin
  1003.             if (PlayerInfo[Player.id].MozdziezT<=0) and (Player.Alive) then begin
  1004.                 Mozdziez[Player.id].X:=Player.MouseAimX;
  1005.                 if (Player.X<Player.MouseAimX) then Mozdziez[Player.id].Xplayer:=1 else Mozdziez[Player.id].Xplayer:=0;
  1006.                 Mozdziez[Player.id].Shoots:=9;
  1007.                 Mozdziez[Player.id].R:=Player.MouseAimY-1000;
  1008.                 PlayerInfo[Player.id].MozdziezT:=MozdzierzTime;
  1009.                 repeat
  1010.                     Mozdziez[Player.id].R:=Mozdziez[Player.id].R+20;
  1011.                 until Map.RayCast(Mozdziez[Player.id].X, Mozdziez[Player.id].R, Mozdziez[Player.id].X, Mozdziez[Player.id].R, false, false, true, true, 2);
  1012.                 Mozdziez[Player.id].Active:=true;
  1013.             end;
  1014.         end;
  1015.         if (PlayerInfo[Player.id].ClassID=4) and (PlayerInfo[Player.id].StatTime<=0) and (Player.Alive) then begin  //Create Stat
  1016.             if (Player.OnGround) then begin
  1017.                 PlayerInfo[Player.id].StatTime := (StatCreate+StatActiveTime);
  1018.                 MediTemp := TNewMapObject.Create;
  1019.                 MediTemp.X := Player.X+iif((Player.Direction=1),8,-8);
  1020.                 MediTemp.Y := Player.Y;
  1021.                 MediTemp.Style := 27;
  1022.                 ObjData:=Map.AddObject(MediTemp);   PlayerInfo[Player.id].StatID := ObjData.id;
  1023.                 MediTemp.Free;
  1024.                 AddToPointsEventList(Player,'+25 Create!',25);
  1025.             end else Player.WriteConsole('You stand on the ground to create a stationary gun.',$FF0000);
  1026.         end;
  1027.     end;
  1028.     Result := false;
  1029. end;
  1030.  
  1031. procedure DisPlayPointsList(Player:TActivePlayer);
  1032. var i,b:byte; AlphaStr:string; c,x:integer; useid: array[1..32] of boolean;
  1033. begin
  1034.     AlphaStr:='';   x := 0;
  1035.     for i:= 1 to 32 do if (Players[i].Active) then begin
  1036.         if (Players[i].Team = 1) then begin
  1037.             SetArrayLength(AlphaPlayerrrs, x + 1);
  1038.             AlphaPlayerrrs[x] := PlayerInfo[i].Points;
  1039.             x:=(x+1);
  1040.         end;
  1041.     end;
  1042.     AlphaPlayerrrs:=Sort(AlphaPlayerrrs);
  1043.     for c:= 0 to GetArrayLength(AlphaPlayerrrs)-1 do begin
  1044.         for b:= 1 to 32 do if (Players[b].Active) and (Players[b].Team=1) then begin
  1045.             if (AlphaPlayerrrs[c]=PlayerInfo[b].Points) and (useid[b]=false) then begin
  1046.                 AlphaStr:=AlphaStr+inttostr(c+1)+': '+Players[b].Name+' - '+inttostr(PlayerInfo[b].Points)+chr(13)+chr(10);
  1047.                 useid[b]:=true;
  1048.                 break;
  1049.             end;
  1050.         end;
  1051.     end;
  1052.     for b:= 1 to 32 do if (Players[b].Active) then useid[b]:=false;
  1053.     if (AlphaStr='') then AlphaStr:='None';
  1054.     Player.BigText(RA,'Alpha Team:'+chr(13)+chr(10)+AlphaStr,630,$F15D70,0.06,5,63);
  1055.     AlphaStr:='';   x := 0;
  1056.     for i:= 1 to 32 do if (Players[i].Active) then begin
  1057.         if (Players[i].Team = 2) then begin
  1058.             SetArrayLength(AlphaPlayerrrs, x + 1);
  1059.             AlphaPlayerrrs[x] := PlayerInfo[i].Points;
  1060.             x:=(x+1);
  1061.         end;
  1062.     end;
  1063.     AlphaPlayerrrs:=Sort(AlphaPlayerrrs);
  1064.     for c:= 0 to GetArrayLength(AlphaPlayerrrs)-1 do begin
  1065.         for b:= 1 to 32 do if (Players[B].Active) and (Players[b].Team = 2) then begin
  1066.             if (AlphaPlayerrrs[c]=PlayerInfo[b].Points) and (useid[b]=false) then begin
  1067.                 AlphaStr:=AlphaStr+inttostr(c+1)+': '+Players[b].Name+' - '+inttostr(PlayerInfo[b].Points)+chr(13)+chr(10);
  1068.                 useid[b]:=true;
  1069.                 break;
  1070.             end;
  1071.         end;
  1072.     end;
  1073.     for b:= 1 to 32 do if (Players[b].Active) then useid[b]:=false;
  1074.     if (AlphaStr='') then AlphaStr:='None';
  1075.     Player.BigText(RB,'Bravo Team:'+chr(13)+chr(10)+AlphaStr,630,$0066CC,0.06,325,63);
  1076. end;
  1077.  
  1078. procedure Speak(Player: TActivePlayer; Text: string);
  1079. var c,c2: boolean; d: integer;
  1080. begin
  1081.     if ExecRegExpr('^!(classlist|listclass)$',LowerCase(Text)) then begin
  1082.         Player.WriteConsole('__Class:___ID:__                                                      ',$D0D21D);
  1083.         Player.WriteConsole('- Assault   1  |                                                      ',$D0D21D);
  1084.         Player.WriteConsole('- Medyk     2  |                                                      ',$D0D21D);
  1085.         Player.WriteConsole('- Sniper    3  |                                                      ',$D0D21D);
  1086.         Player.WriteConsole('- Enginer   4  |__________________________________________________    ',$D0D21D);
  1087.         Player.WriteConsole('Write !class <ID> to learn more about the class.                 |    ',$D0D21D);
  1088.         Player.WriteConsole('_________________________________________________________________|    ',$D0D21D);
  1089.     end;
  1090.     if (Text='!class') or (Copy(Text,1,7) = '!class ') then begin
  1091.         c2 := true;
  1092.         if (Length(Text) > 7) then begin
  1093.             try
  1094.                 d := StrToInt(Copy(Text,7,length(Text)));
  1095.                 if (d > 0) and (d<5) then c := true else begin
  1096.                     Player.WriteConsole('You have entered invalid class ID.                                    ',$D0D21D);
  1097.                     c2 := false;
  1098.                 end;
  1099.             except
  1100.                 c2 := false;
  1101.                 Player.WriteConsole('You have entered invalid class ID.                                    ',$D0D21D);
  1102.             end;
  1103.         end else c := false;
  1104.         if (c2=true) then case (iif(c=true,d,PlayerInfo[Player.ID].ClassID)) of
  1105.             1:  begin
  1106.                     if ((c) and (PlayerInfo[Player.ID].ClassID<>d)) then Player.WriteConsole('[Class] Class assault!',$D0D21D) else Player.WriteConsole('[Class] Your class is assault!',$D0D21D);
  1107.                     Player.WriteConsole('[Ammo] Give ammo yourself and friends from team. Give ammunition to get more points.                                    ',$D0D21D);
  1108.                     Player.WriteConsole('[Granade] Once on '+inttostr(GranadekitTimeAdd)+' seconds, you can place granadekit. Place granadekit and get more points.                             ',$D0D21D);
  1109.                     Player.WriteConsole('[Granade] Additionally respawning you get extra pack of grenades.                                                       ',$D0D21D);
  1110.                     Player.WriteConsole('[Support] Call support and everyone friends who dies near you, respawning on you.                                       ',$D0D21D);
  1111.                     Player.WriteConsole('[Support] For each player respawning on you, you get more points.                                                       ',$D0D21D);
  1112.                     Player.WriteConsole('[HowUse] Ammo: Automatically, Support /cc1, Granade /cc2.                                                               ',$D0D21D);
  1113.                     Player.WriteConsole('[Weapons] Desert Eagles, AK-74, Steyr AUG, USSOCOM, Combat Knife                                                        ',$D0D21D);
  1114.                 end;
  1115.             2:  begin
  1116.                     if ((c) and (PlayerInfo[Player.ID].ClassID<>d)) then Player.WriteConsole('[Class] Class medic!',$D0D21D) else Player.WriteConsole('[Class] Your class is medic!',$D0D21D);
  1117.                     Player.WriteConsole('[Heal] You healing yourself and friends of the team. Healing friends to get more points.                                ',$D0D21D);
  1118.                     Player.WriteConsole('[Defibrillation] If someone from team dies u see over his body "Res!". It means that you can defibrillation him.        ',$D0D21D);
  1119.                     Player.WriteConsole('[Defibrillation] Go to this text and crouch+change weapon key or write /cc1.                                            ',$D0D21D);
  1120.                     Player.WriteConsole('[Defibrillation] Interval between the defibrillation are 1.5 seconds.                                                   ',$D0D21D);
  1121.                     Player.WriteConsole('[Medkit] Once on '+inttostr(MedkitTimeAdd)+' seconds, you can place medkit. Place medkit and get more points.                                      ',$D0D21D);
  1122.                     Player.WriteConsole('[HowUse] Heal: Automatically, Defibrillation: Crouch+ChangeWeapon key or /cc1, Medkit: /cc2.                            ',$D0D21D);
  1123.                     Player.WriteConsole('[Weapons] HK MP5, Steyr AUG, FN Minimi, USSOCOM, Combat Knife                                                           ',$D0D21D);
  1124.                 end;
  1125.             3:  begin
  1126.                     if ((c) and (PlayerInfo[Player.ID].ClassID<>d)) then Player.WriteConsole('[Class] Class sniper!',$D0D21D) else Player.WriteConsole('[Class] Your class is sniper!',$D0D21D);
  1127.                     Player.WriteConsole('[Barrett] When you prone or crouch on ground, your barrett m81a1 inflicts damage increased by 250%.                     ',$D0D21D);
  1128.                     Player.WriteConsole('[Ruger 77] When you prone, your ruger 77 inflicts damage increased by 45%.                                              ',$D0D21D);
  1129.                     Player.WriteConsole('[DistKill] Killing from a large distance get about +50% more points, than other class.                                  ',$D0D21D);
  1130.                     Player.WriteConsole('[Bandage] Activate to restore yourself 42% maximum value of health. Use /cc1, cooldown '+inttostr(SniperBandageTime)+' seconds.                        ',$D0D21D);
  1131.                     Player.WriteConsole('[Mortar] Once on '+inttostr(MozdzierzTime)+' seconds you can call in mortar shelling. Use /cc2, appears in place crosshair.                        ',$D0D21D);
  1132.                     Player.WriteConsole('[HowUse] Bandage: /cc1, Mortar: /cc2, Barrett: Must prone or crouch + shooting, Ruger 77: Must prone + shooting.        ',$D0D21D);
  1133.                     Player.WriteConsole('[Weapons] Spas-12, Ruger 77, Barrett M82A1, USSOCOM, Combat Knife                                                       ',$D0D21D);
  1134.                 end;
  1135.             4:  begin
  1136.                     if ((c) and (PlayerInfo[Player.ID].ClassID<>d)) then Player.WriteConsole('[Class] Class enginer!',$D0D21D) else Player.WriteConsole('[Class] Your class is enginer!',$D0D21D);
  1137.                     Player.WriteConsole('[Repair] You repair yourself and friends vest. Repairing friends vest to get more points.                               ',$D0D21D);
  1138.                     Player.WriteConsole('[ExtraRocket] When you have M72 LAW in hands, you can shoot homing missile. Can change rocket type /cc1.                ',$D0D21D);
  1139.                     Player.WriteConsole('[ExtraRocket] Rocket types: Normal, Extra. How shoot u must crouch or prone and change rocket type to extra.            ',$D0D21D);
  1140.                     Player.WriteConsole('[ExtraRocket] Targeting player is marked [Traced]. Targeting is player nearest the crosshair. ExtraRocket ammo: '+inttostr(MaxExtraRocket)+'        ',$D0D21D);
  1141.                     Player.WriteConsole('[StationartGun] Once on '+inttostr(StatCreate)+' seconds you can place stationary gun. Gun is active '+inttostr(StatActiveTime)+' seconds and explode. Use /cc2.           ',$D0D21D);
  1142.                     Player.WriteConsole('[HowUse] Repair: Automatically; ExtraRocket: Change /cc1, Shooting Prone or Crouch + Shoot key; StationartGun: /cc2.    ',$D0D21D);
  1143.                     Player.WriteConsole('[Weapons] HK MP5, Steyr AUG, M79, Chainsaw, M72 LAW                                                                     ',$D0D21D);
  1144.                 end;
  1145.         end;
  1146.     end;
  1147.     if ExecRegExpr('^!(pointslist)$',LowerCase(Text)) then DisPlayPointsList(Player);
  1148.     if ExecRegExpr('^!(help)$',LowerCase(Text)) then begin
  1149.         Player.WriteConsole('Battlefield Mode! Commands:',$D0D21D);
  1150.         Player.WriteConsole('!classlist            - List of all classes.                                                                            ',$D0D21D);
  1151.         Player.WriteConsole('!class <ID_Class>     - Description of the class indicated.                                                             ',$D0D21D);
  1152.         Player.WriteConsole('!class                - A description of your class.                                                                    ',$D0D21D);
  1153.         Player.WriteConsole('!pointslist           - List of points of all players.                                                                  ',$D0D21D);
  1154.     end;
  1155. end;
  1156.  
  1157. procedure OnKill(Killer, Victim: TActivePlayer; BulletId: Byte);
  1158. var ID: integer; dis:single;
  1159. begin
  1160.     PlayerInfo[Victim.ID].DeadX:=Victim.X;  PlayerInfo[Victim.ID].DeadY:=Victim.Y;
  1161.     if (firstBlood > 0) and (Killer.ID <> Victim.ID) and (Killer.Team<>Victim.Team)then begin
  1162.         firstBlood := 0;
  1163.         AddToPointsEventList(Killer,'+200 First!',200);
  1164.     end;
  1165.     if (Killer.ID=Victim.ID) then AddToPointsEventList(Killer,'-50 SelfKill!',-50);
  1166.     PlayerInfo[Victim.ID].LastClassID := PlayerInfo[Victim.ID].ClassID;
  1167.     ResVar(Victim.ID,false);            //Restart Zmiennych
  1168.     if (Victim.Team<>5) then begin
  1169.         ClassSet(Victim.ID, true);
  1170.         PokazKim(Victim);
  1171.     end;
  1172.     RemoveAllDamageToOnDeath(Victim.ID);
  1173.     PlayersInfoArr[Victim.ID].KilledBy := Killer.ID;
  1174.     OnPlayerDeathGiveAssists(Victim);
  1175.     if (Killer.ID <> Victim.ID) then begin
  1176.         Combo[Killer.ID].H:=(Combo[Killer.ID].H+1);
  1177.         Combo[Killer.ID].T:=3;
  1178.         dis:=Distance(Killer.X,Killer.Y,Victim.X,Victim.Y);
  1179.         if (dis>642) then begin //749
  1180.             id:=(10+Round(single(dis-642)/8.0)); //id:=Round((dis-730)/2);
  1181.             if (PlayerInfo[Killer.ID].ClassID=3) then id:=(id+round(0.5*id));
  1182.             if (ID<>0) then AddToPointsEventList(Killer,'+'+inttostr(id)+' Dist!',id);
  1183.         end;
  1184.         if (atc[Victim.ID] > 0) then begin
  1185.             if (Players[atc[Victim.ID]].Team = Killer.Team) and (Players[atc[Victim.ID]].Alive) and (Killer.ID <> atc[Victim.ID]) then begin
  1186.                 atc[Victim.ID]:=0;
  1187.                 AddToPointsEventList(Killer,'+40 Savior!',40);
  1188.             end;
  1189.         end;
  1190.         if (Revenge[Killer.ID] = Victim.Name) then begin
  1191.             AddToPointsEventList(Killer,'+40 Revenge!',40);
  1192.  
  1193.             Revenge[Killer.ID] := '';
  1194.         end;
  1195.         if (Revenge[Victim.ID] = '') then Revenge[Victim.ID] := Killer.Name;
  1196.         if (Revenge[Victim.ID] = Revenge[Victim.ID]) then Revenge[Victim.ID] := Killer.Name;
  1197.         if (Revenge[Victim.ID] = Revenge[Killer.ID]) then Revenge[Victim.ID] := Killer.Name;
  1198.     end;
  1199.     if (Combo[Victim.ID].T>1) then begin
  1200.         case (Combo[Victim.ID].H) of
  1201.             2:  AddToPointsEventList(Victim,'+20 DoubleKill!',20);
  1202.             3:  AddToPointsEventList(Victim,'+30 TripleKill!',30);
  1203.             4:  AddToPointsEventList(Victim,'+50 MultiKill!',50);
  1204.             5:  AddToPointsEventList(Victim,'+100 MultiKill [x2]!',100);
  1205.         end;
  1206.     end;
  1207.     if (Combo[Victim.ID].H>=6) then AddToPointsEventList(Victim,'+150 SerialKill!',150);
  1208.     if (Killer.Alive=false) then AddToPointsEventList(Killer,'+15 Posthumous!',15);
  1209. end;
  1210.  
  1211. function HeadShootKill(Shooter, Victim: TActivePlayer; Damage: Single; Bullet: Byte): Single;
  1212. var dmg, tmp: single; c, len: integer; TmpDble, ShootSpeed: double; //c2,c3: integer; Punch:t
  1213. begin
  1214.     tmp := iif(Damage>200,200,Damage);
  1215.     dmg := Damage;
  1216.     //DrawTextEx(Victim,13,'||||||',round(tmp/2.20),$FF0000,22,-1920,-1080);        //2.80
  1217.     //Players[Victim].BigText(133,'||||||',200,$FF0000,22,-1920,-1080);
  1218.     Victim.BigText(BS,'O',round(tmp/2.10),$FF0000,75,-4100,-4100);  //2.15 BigText(133,'O',30,$FF0000,75,-4100,-4100);  //2.15
  1219.     if (Shooter.ID<>Victim.ID) then begin
  1220.         //Snajper additional dmg
  1221.         if (PlayerInfo[Shooter.ID].ClassID = 3) then begin
  1222.             if (Map.Bullets[Bullet].GetOwnerWeaponId=8) then begin
  1223.                 if ((Shooter.IsProne) or (Shooter.KeyCrouch)) and (Shooter.OnGround) then dmg := (dmg+(2.5*dmg));
  1224.             end;
  1225.             if (Map.Bullets[Bullet].GetOwnerWeaponId=6) then begin
  1226.                 if (Shooter.IsProne) and (Shooter.OnGround) then dmg := (dmg+(0.45*dmg));
  1227.             end;
  1228.         end;
  1229.  
  1230.         //Licz punkty
  1231.         if (Map.Bullets[Bullet].GetOwnerWeaponId=7) or (Map.Bullets[Bullet].GetOwnerWeaponId=13) then begin
  1232.             if (dmg>MaxHealth) then c:=100 else c:=Round(single(100.0*dmg)/single(MaxHealth)); 
  1233.         end else
  1234.         begin
  1235.             if (dmg>Victim.Health) then c:=Round(single(100*Victim.Health)/single(MaxHealth)) else c:=Round(single(100*dmg)/single(MaxHealth));
  1236.         end;
  1237.         if (c>100) then c:=100;
  1238.  
  1239.         //Wyświetl oraz dodaj punkty
  1240.         len:=GetArrayLength(PointsEvents[Shooter.ID]);
  1241.         if (Shooter.Team<>Victim.Team) then begin
  1242.             if (len=0) then Shooter.BigText(HP,'Points: '+inttostr(PlayerInfo[Shooter.ID].Points)+'+'+inttostr(c),200,$F15D70,0.055,12,425);
  1243.             PlayerInfo[Shooter.ID].Points:=(PlayerInfo[Shooter.ID].Points+c);
  1244.         end else
  1245.         begin
  1246.             if (len=0) then Shooter.BigText(HP,'Points: '+inttostr(PlayerInfo[Shooter.ID].Points)+'-'+inttostr(c),200,$F15D70,0.055,12,425);
  1247.             PlayerInfo[Shooter.ID].Points:=(PlayerInfo[Shooter.ID].Points-c);
  1248.         end;
  1249.     end;
  1250.  
  1251.     //Asysty
  1252.     if (Damage > 0) then begin
  1253.         if (Victim.Alive) then begin
  1254.             if ((Victim.Health - damage) <= 0) then begin
  1255.                 if (Victim.Health > 0) then begin
  1256.                     TmpDble := ((Victim.Health*100)/MaxHealth);
  1257.                     PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
  1258.                     PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
  1259.                 end else
  1260.                 begin
  1261.                     if (TotalPercentDamageRecieved(victim.ID) < 100) then begin
  1262.                         TmpDble := 100 - TotalPercentDamageRecieved(Victim.ID);
  1263.                         PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
  1264.                         PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
  1265.                     end;
  1266.                 end;
  1267.             end else
  1268.             begin
  1269.                 TmpDble := ((Damage*100)/MaxHealth);
  1270.                 PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
  1271.                 PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
  1272.             end;
  1273.         end else
  1274.         begin
  1275.             if (MostPercentDamagedoneBy(Victim.ID) > 0) then begin
  1276.                 if (TotalPercentDamageRecieved(Victim.ID) = 0) then begin
  1277.                     PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := 100;
  1278.                     PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
  1279.                 end else if (TotalPercentDamageRecieved(Victim.ID) < 100) then begin
  1280.                     TmpDble := 100 - TotalPercentDamageRecieved(Victim.ID);
  1281.                     PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
  1282.                     PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
  1283.                 end;
  1284.             end else if (TotalPercentDamageRecieved(Victim.ID) < 100) then begin
  1285.                 TmpDble := (100 - TotalPercentDamageRecieved(Victim.ID));
  1286.                 PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
  1287.                 PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
  1288.             end;
  1289.         end;
  1290.     end else if (Damage < 0) then RemoveDamageDoneBy(Victim.ID,(Damage*100)/MaxHealth);
  1291.  
  1292.     //Savior
  1293.     if (Shooter.Team <> Victim.Team) then begin
  1294.         if (Shooter.Active) then begin
  1295.             atc[Shooter.ID] := Victim.ID;
  1296.             Ttimer[Shooter.ID] := TimeCon;
  1297.         end;
  1298.     end;
  1299.  
  1300.     //Headshoot
  1301.     if (Shooter.ID<>Victim.ID) and (Shooter.Team<>Victim.Team) and (Shooter.Team<>5) then begin //and (Victim.Health-Damage<=0)
  1302.         ShootSpeed:=sqrt((Map.Bullets[Bullet].VelX*Map.Bullets[Bullet].VelX)+(Map.Bullets[Bullet].VelY*Map.Bullets[Bullet].VelY));
  1303.         c := Trunc(GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*(ShootSpeed/100)*1.15);
  1304.         {
  1305.         c2 := Trunc(GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*(ShootSpeed/100));
  1306.         c3 := Trunc(GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*(ShootSpeed/100)*0.9);
  1307.         }
  1308.  
  1309.         if (iif(Victim.Vest>0,Trunc(0.25*c),c)=Damage) then AddToPointsEventList(Shooter,'+15 Headshoot!',15);
  1310.  
  1311.         {
  1312.         if (iif(GetPlayerStat(Victim.ID,'Vest')>0,Trunc(0.25*c2),c2)=Damage) then DrawTextEx(Shooter.ID,108,'BODY!',400,$F15D70,0.055,12,385);
  1313.         if (iif(GetPlayerStat(Victim.ID,'Vest')>0,Trunc(0.25*c3),c3)=Damage) then DrawTextEx(Shooter.ID,108,'LEGS!',400,$F15D70,0.055,12,385);
  1314.         }
  1315.     end;
  1316.    
  1317.     //Realdmg
  1318.     PlayerHealth[Victim.ID] := (PlayerHealth[Victim.ID] - dmg);
  1319.     if (PlayerHealth[Victim.ID]<1) then Result := (Victim.Health*3) else Result := (Victim.Health - (single(PlayerHealth[Victim.ID] * MaxHealth)/FullHeal));
  1320.    
  1321.     //if (Shooter.Human) then Players.WriteConsole('Normal dmg --- Orginal: '+inttostr(dmg)+', Precent'+inttostr(round((single(dmg)/150)*100))+'%',$D0D21D);
  1322.     //Result:=dmg;
  1323.     //if (Shooter.Human) then Players.WriteConsole('Realistic dmg --- Orginal: '+inttostr(dmg)+', Calculate: '+inttostr(Result)+', Precent: '+inttostr(trunc((single(result)/65)*100))+'%',$D0D21D);
  1324. end;
  1325.  
  1326. procedure Defiblirate();
  1327. var i,b: byte;
  1328. begin
  1329.     for i:=1 to 32 do if (Players[i].Active) then begin
  1330.         if (PlayerInfo[i].ClassID=2) and (Players[i].Alive) then begin
  1331.             for b:=1 to 32 do if (Players[b].Active) then begin
  1332.                 if (Players[b].Alive=false) and (Players[i].Team = Players[b].Team) then Players[i].WorldText(b+WR,'Res!',75,$99FFFF,0.055,Players[b].X-10,Players[b].Y-12);
  1333.             end;
  1334.             if ((Players[i].KeyCrouch) and (Players[i].KeyChangeWeap)) and (DefiblirateTime[i]<=0) then begin
  1335.                 for b := 1 to 32 do if (Players[b].Active) then begin
  1336.                     if (Players[b].Alive=false) and (Players[i].Team = Players[b].Team) then if (Distance(Players[i].X,Players[i].Y,Players[b].X,Players[b].Y) <= 22) then begin
  1337.                         Players[b].Alive:=True;
  1338.                         PlayerInfo[Players[b].ID].ClassID := PlayerInfo[Players[b].ID].LastClassID;
  1339.                         case (PlayerInfo[Players[b].ID].ClassID) of
  1340.                             1: Players[b].WriteConsole('You come back to game as the assault, rescued by '+Players[i].Name,$D0D21D);
  1341.                             2: Players[b].WriteConsole('You come back to game as the medic, rescued by '+Players[i].Name,$D0D21D);
  1342.                             3: Players[b].WriteConsole('You come back to game as the sniper, rescued by '+Players[i].Name,$D0D21D);
  1343.                             4: Players[b].WriteConsole('You come back to game as the enginer, rescued by '+Players[i].Name,$D0D21D);
  1344.                         end;
  1345.                         Players[b].Move(Players[i].x,Players[i].y);
  1346.                         PlayerInfo[Players[b].ID].LastX:=Players[b].X;
  1347.                         DefiblirateTime[i]:=DefiblirateToNext;
  1348.                         AddToPointsEventList(Players[i],'+50 Defibrillation!',50);
  1349.                     end;
  1350.                 end;
  1351.             end;
  1352.         end;
  1353.     end;
  1354. end;
  1355.  
  1356. procedure nova(X,Y,dir_x,dir_y,r,speed,power: single; n: word; style, id: byte);
  1357. var angle,sine,cosine: single;
  1358. begin
  1359.     angle:=6.28318/n;
  1360.     for n:=n downto 1 do begin
  1361.         sine:=sin(angle*n);
  1362.         cosine:=cos(angle*n);
  1363.         Map.CreateBullet(cosine*r + X, sine*r + Y,cosine*speed + dir_x,sine*speed + dir_y,power, style, Players[ID]);
  1364.     end;
  1365. end;
  1366.  
  1367. function FindPlayerForMissile(ID: byte; MaxDistance: integer; UsingRaycast: boolean): byte;     //FindPlayerForMissile (SC3)
  1368. var i: byte; X, Y, X2, Y2, CursorMaxDist, NearestDistCursor, MaxDist, Dist: single;
  1369. begin
  1370.     X:=Players[ID].X;   Y:=Players[ID].Y;
  1371.     MaxDist:=MaxDistance*MaxDistance;   CursorMaxDist:=CursorMaxSearch*CursorMaxSearch;
  1372.     Result:=0;
  1373.     for i:= 1 to 32 do if (Players[i].Active) then begin
  1374.         if (Players[i].Alive) and (Players[i].Team<>Players[ID].Team) and (i<>ID) then begin
  1375.             X2:=Players[i].X;   Y2:=Players[i].Y;
  1376.             if (UsingRayCast) then if Map.RayCast(X,Y-7,X2,Y2-7,false, false, true, true, 2) then continue;
  1377.            
  1378.             X2:=X2-Players[ID].MouseAimX;   Y2:=Y2-Players[ID].MouseAimY;   NearestDistCursor:=X2*X2+Y2*Y2;
  1379.             X2:=Players[i].X;   Y2:=Players[i].Y;
  1380.             X2:=X2-X;   Y2:=Y2-Y;   Dist:=X2*X2+Y2*Y2;
  1381.            
  1382.             if (NearestDistCursor<CursorMaxDist) and (Dist<MaxDist) then begin
  1383.                 Result:=i;
  1384.                 CursorMaxDist:=NearestDistCursor;
  1385.             end;
  1386.         end;
  1387.     end;
  1388. end;
  1389.  
  1390. procedure ResetMissile(i:byte);
  1391. begin
  1392.     Missile[i].owner_ID:=0;         Missile[i].target_ID:=0;
  1393.     Missile[i].X:=0;                Missile[i].Y:=0;
  1394.     Missile[i].Active:=false;
  1395.     Missile[i].poly_coll:=false;    Missile[i].target_coll:=false;
  1396.     Missile[i].n:=8;                Missile[i].dist:=0;
  1397.     Missile[i].X2:=0;               Missile[i].Y2:=0;
  1398.     Missile[i].next_dist_x:=0;      Missile[i].next_dist_y:=0;
  1399.     Missile[i].prev_dist_x:=0;      Missile[i].prev_dist_y:=0;
  1400. end;
  1401.  
  1402. procedure AddAmmo(AssaultID,CustomerID,Weapon:byte);
  1403. begin
  1404.     if (Weapon=7) or (Weapon=13) then begin
  1405.         if (PlayerInfo[CustomerID].AmmoGiven > AmmoGivenLimit) then begin
  1406.             WepAmmo[Weapon][CustomerID] := (WepAmmo[Weapon][CustomerID]+1);
  1407.             PlayerInfo[CustomerID].AmmoGiven := 0;
  1408.         end else PlayerInfo[CustomerID].AmmoGiven := (PlayerInfo[CustomerID].AmmoGiven+1);
  1409.     end else
  1410.     begin
  1411.         if (Weapon=12) then WepAmmo[Weapon][CustomerID] := (WepAmmo[Weapon][CustomerID]+SawAmmoAdd);
  1412.         if ((PlayerInfo[CustomerID].ClassID<>3) and ((Weapon=5) or (Weapon=6) or (Weapon=8))) then begin
  1413.             if (PlayerInfo[CustomerID].BarrettAmmoGiven > iif((Weapon=5) or (Weapon=6),RugerAmmoGiven,BaretAmmoGivenLimit)) then begin
  1414.                 WepAmmo[Weapon][CustomerID] := (WepAmmo[Weapon][CustomerID]+1);
  1415.                 PlayerInfo[CustomerID].BarrettAmmoGiven := 0;
  1416.             end else PlayerInfo[CustomerID].BarrettAmmoGiven := PlayerInfo[CustomerID].BarrettAmmoGiven+1;
  1417.         end else WepAmmo[Weapon][CustomerID] := (WepAmmo[Weapon][CustomerID]+1);
  1418.     end;
  1419.     if (AssaultID<>CustomerID) then begin
  1420.         if (PlayerInfo[AssaultID].Gives>=14) then begin
  1421.             AddToPointsEventList(Players[AssaultID],'+20 Ammo!',20);
  1422.             PlayerInfo[AssaultID].Gives := 0;
  1423.         end else if (PlayerInfo[AssaultID].Gives<14) then PlayerInfo[AssaultID].Gives := (PlayerInfo[AssaultID].Gives+1);
  1424.     end;
  1425. end;
  1426.  
  1427. procedure DisHud(i:byte);
  1428. var b,c:byte;
  1429. begin
  1430.     case (PlayerInfo[i].ClassID) of
  1431.         1:  begin
  1432.                 if (PlayerInfo[i].Medkit>0) then begin
  1433.                     PlayerInfo[i].Medkit:=(PlayerInfo[i].Medkit-1);
  1434.                     Players[i].BigText(HS1,'Granadekit: '+inttostr(PlayerInfo[i].Medkit),130,$FF0000,0.055,12,415);
  1435.                 end else Players[i].BigText(HS1,'Granadekit: Ready!',130,$FFB300,0.055,12,415);
  1436.                 if (PlayerInfo[i].WsparcieDT>0) then begin
  1437.                     PlayerInfo[i].WsparcieDT:=(PlayerInfo[i].WsparcieDT-1);
  1438.                     if (PlayerInfo[i].WsparcieDT-WC>0) then Players[i].BigText(HS2,'Support: '+inttostr(PlayerInfo[i].WsparcieDT-WC),130,$008000,0.055,12,405) else Players[i].BigText(HS2,'Support: '+inttostr(PlayerInfo[i].WsparcieDT),130,$FF0000,0.055,12,405);
  1439.                 end else Players[i].BigText(HS2,'Support: Ready!',130,$FFB300,0.055,12,405);
  1440.                 if (Players[i].Alive) then for b := 1 to 32 do if (Players[b].Active) then if (Players[b].Alive) and (Players[i].Team=Players[b].Team) then if (Distance(Players[i].X,Players[i].Y,Players[b].X,Players[b].Y)<= 120) then begin
  1441.                     for c := 0 to 13 do if ((Players[b].Primary.WType=c) or (Players[b].Secondary.WType=c)) then begin
  1442.                         if ((WepAmmo[c][b] + 1) > GetMaxAmmo(c)) then WepAmmo[c][b]:=GetMaxAmmo(c) else AddAmmo(i,b,c);
  1443.                     end;
  1444.                 end;
  1445.             end;
  1446.         2:  begin
  1447.                 if (PlayerInfo[i].Medkit>0) then begin
  1448.                     PlayerInfo[i].Medkit:=(PlayerInfo[i].Medkit-1);
  1449.                     Players[i].BigText(HS1,'Medkit: '+inttostr(PlayerInfo[i].Medkit),130,$FF0000,0.055,12,415);
  1450.                 end else Players[i].BigText(HS1,'Medkit: Ready!',130,$FFB300,0.055,12,415);
  1451.                
  1452.                 if (Players[i].Alive) then for b := 1 to 32 do if (Players[b].Active) then if (Players[b].Alive) and (Players[i].Team=Players[b].Team) then if (Distance(Players[i].X,Players[i].Y,Players[b].X,Players[b].Y) <= 120) and (Players[b].Health < MaxHealth) then begin
  1453.                     if ((Players[b].Health + HealMedykHealing) > MaxHealth) then SetPlayerHealth(Players[b],MaxHealth,Players[b].Vest) else begin
  1454.                         SetPlayerHealth(Players[b],(Players[b].Health+HealMedykHealing),Players[b].Vest);
  1455.                         if (i<>b) then begin
  1456.                             if (PlayerInfo[i].Gives>=3) then begin
  1457.                                 AddToPointsEventList(Players[i],'+20 Healing!',20);
  1458.                                 PlayerInfo[i].Gives:=0;
  1459.                             end else if (PlayerInfo[i].Gives<3) then PlayerInfo[i].Gives:=(PlayerInfo[i].Gives+1);
  1460.                         end;
  1461.                     end;
  1462.                 end;
  1463.             end;
  1464.         3:  begin
  1465.                 if (PlayerInfo[i].SniperBandage>0) then begin
  1466.                     PlayerInfo[i].SniperBandage:=(PlayerInfo[i].SniperBandage-1);
  1467.                     if (PlayerInfo[i].SniperBandage>0) then Players[i].BigText(HS2,'Bandage: '+inttostr(PlayerInfo[i].SniperBandage),130,$FF0000,0.055,12,405);
  1468.                 end else Players[i].BigText(HS2,'Bandage: Ready!',130,$FFB300,0.055,12,405);
  1469.                 if (PlayerInfo[i].MozdziezT>0) then begin
  1470.                     PlayerInfo[i].MozdziezT:=(PlayerInfo[i].MozdziezT-1);
  1471.                     Players[i].BigText(HS1,'Mortar: '+inttostr(PlayerInfo[i].MozdziezT),130,$FF0000,0.055,12,415);
  1472.                 end else Players[i].BigText(HS1,'Mortar: Ready!',130,$FFB300,0.055,12,415);
  1473.             end;
  1474.         4:  begin
  1475.                 if (PlayerInfo[i].StatTime>0) then begin
  1476.                     PlayerInfo[i].StatTime:=(PlayerInfo[i].StatTime-1);
  1477.                     if (PlayerInfo[i].StatTime-StatCreate>0) then begin
  1478.                         if (PlayerInfo[i].StatTime-StatCreate>5) then Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$008000,0.055,12,415) else begin
  1479.                             case (PlayerInfo[i].StatTime-StatCreate) of
  1480.                                 5:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$5C8000,0.055,12,415);
  1481.                                 4:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$808000,0.055,12,415);
  1482.                                 3:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$805A00,0.055,12,415);
  1483.                                 2:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$803A00,0.055,12,415);
  1484.                                 1:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$B80000,0.055,12,415);
  1485.                             end;
  1486.                         end;
  1487.                     end else begin Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime),130,$FF0000,0.055,12,415); if (PlayerInfo[i].StatTime-StatCreate=0) then DestoryStat(PlayerInfo[i].StatID,i); end;
  1488.                 end else Players[i].BigText(HS2,'StationaryGun: Ready!',130,$FFB300,0.055,12,415);
  1489.                 if (Players[i].Primary.wtype=13) or (Players[i].Secondary.wtype=13) then Players[i].BigText(HS1,'RocketType: '+iif(PlayerInfo[i].RocketType=1,'Normal',iif(PlayerInfo[i].RocketAmmo>0,'Extra','Extra(NoAmmo)')),130,iif(PlayerInfo[i].RocketType=1,$FFB300,iif(PlayerInfo[i].RocketAmmo>0,$FFB300,$B80000)),0.055,12,405) else Players[i].BigText(HS1,'Rocket: Lack-M72 LAW',130,$FFB300,0.055,12,405);
  1490.                
  1491.                 if (Players[i].Alive) then for b := 1 to 32 do if (Players[b].Active) then if (Players[b].Alive) and (Players[b].Vest<100) and (Players[i].Team=Players[b].Team) then if (Distance(Players[i].X,Players[i].Y,Players[b].X,Players[b].Y)<= 120) then begin
  1492.                     if ((Players[b].Vest+VestEnginerRepair) > 100) then SetPlayerHealth(Players[b],Players[b].Health,100) else begin
  1493.                         SetPlayerHealth(Players[b],Players[b].Health,Players[b].Vest+VestEnginerRepair);
  1494.                         if (i<>b) then begin
  1495.                             if (PlayerInfo[i].Gives>=3) then begin
  1496.                                 AddToPointsEventList(Players[i],'+35 Repair!',35);
  1497.                                 PlayerInfo[i].Gives:=0;
  1498.                             end else if (PlayerInfo[i].Gives<3) then PlayerInfo[i].Gives:=(PlayerInfo[i].Gives+1);
  1499.                         end;
  1500.                     end;
  1501.                 end;
  1502.             end;
  1503.     end;
  1504. end;
  1505.  
  1506. procedure DisPoints(i:byte);
  1507. var len,b:integer;
  1508. begin
  1509.     if (Players[i].Team<>5) then begin
  1510.         len := getarraylength(PointsEvents[i]);
  1511.         if (len=0) then Players[i].BigText(HP,'Points: '+inttostr(PlayerInfo[i].Points),200,$F15D70,0.055,12,425) else begin
  1512.             Players[i].BigText(HP,'Points: '+inttostr(PlayerInfo[i].Points)+PointsEvents[i][0],200,$F15D70,0.055,12,425);
  1513.             if (len=1) then begin
  1514.                 SetArrayLength(PointsEvents[i],0);
  1515.                 exit;
  1516.             end else
  1517.             begin
  1518.                 for b := 1 to (len-1) do PointsEvents[i][b-1] := PointsEvents[i][b];
  1519.                 SetArrayLength(PointsEvents[i],len-1);
  1520.             end;
  1521.         end;
  1522.     end;
  1523. end;
  1524.  
  1525. procedure ComboAppi(i:byte);
  1526. begin
  1527.     if (Combo[i].T > 0) then Combo[i].T:=(Combo[i].T-1);
  1528.     if (Combo[i].T = 0) then begin
  1529.         case (Combo[i].H) of
  1530.             2:  AddToPointsEventList(Players[i],'+20 DoubleKill!',20);
  1531.             3:  AddToPointsEventList(Players[i],'+30 TripleKill!',30);
  1532.             4:  AddToPointsEventList(Players[i],'+50 MultiKill!',50);
  1533.             5:  AddToPointsEventList(Players[i],'+100 MultiKill [x2]!',100);
  1534.         end;
  1535.         if (Combo[i].H>=6) then AddToPointsEventList(Players[i],'+200 SerialKill!',200);
  1536.         Combo[i].H := 0;
  1537.     end;
  1538. end;
  1539.  
  1540. procedure MissileModule(Ticks:integer);
  1541. var i:byte;
  1542. begin
  1543.     for i := 1 to 32 do if (Missile[i].Active = true) then begin
  1544.         Players.WorldText(Missile[i].Target_ID+WT,'[Traced]',75,$FF0000,0.065,Players[Missile[i].Target_ID].X-30,Players[Missile[i].Target_ID].Y-22);
  1545.         if ((Ticks mod 9) = 0) then if (missile[i].n>1) then Missile[i].n := Missile[i].n-1; //szybkosc
  1546.         if ((Ticks mod Missile[i].n) = 0) then begin
  1547.             //Dane obliczenia
  1548.             Missile[i].X2:=Players[Missile[i].Target_ID].X; Missile[i].Y2:=Players[Missile[i].Target_ID].Y;
  1549.             Missile[i].Dist := Distance(Missile[i].X, Missile[i].Y, Missile[i].X2, Missile[i].Y2);
  1550.             Missile[i].Next_Dist_X := (Missile[i].X2-Missile[i].X)/(Missile[i].Dist/10);
  1551.             Missile[i].Next_Dist_Y := (Missile[i].Y2-Missile[i].Y)/(Missile[i].Dist/10);
  1552.             Missile[i].X := Missile[i].X + Missile[i].Next_Dist_X;
  1553.             Missile[i].Y := Missile[i].Y + Missile[i].Next_Dist_Y;
  1554.             Missile[i].prev_dist_x:=Missile[i].Next_Dist_X;
  1555.             Missile[i].prev_dist_y:=Missile[i].Next_Dist_Y;
  1556.            
  1557.             Missile[i].Next_Dist_X:=((((Missile[i].X2-Missile[i].X)/(Missile[i].Dist/100))+(Missile[i].prev_dist_x*40)) / 65);
  1558.             Missile[i].Next_Dist_Y:=((((Missile[i].Y2-Missile[i].Y)/(Missile[i].Dist/100))+(Missile[i].prev_dist_y*40)) / 65); //gestosc plomieni
  1559.             Missile[i].prev_dist_x:=Missile[i].Next_Dist_X;
  1560.             Missile[i].prev_dist_y:=Missile[i].Next_Dist_Y;
  1561.             Missile[i].X:=Missile[i].X + Missile[i].Next_Dist_X;
  1562.             Missile[i].Y:=Missile[i].Y + Missile[i].Next_Dist_Y;
  1563.             Missile[i].X2:=Players[Missile[i].Target_ID].X; Missile[i].Y2:=Players[Missile[i].Target_ID].Y;
  1564.             Missile[i].Dist := Distance(Missile[i].X,Missile[i].Y,Missile[i].X2,Missile[i].Y2);
  1565.             if (Missile[i].Dist > 80) then begin
  1566.                 if  Map.RayCast(Missile[i].X, Missile[i].Y, Missile[i].X+15, Missile[i].Y, false, false, true, true, 2) then Missile[i].X:=(Missile[i].X - 40) else if  Map.RayCast(Missile[i].X, Missile[i].Y, Missile[i].X-15, Missile[i].Y, false, false, true, true, 2) then Missile[i].X:=(Missile[i].X + 40); //gdy koliguje dodaj lub odejmij
  1567.                 if  Map.RayCast(Missile[i].X, Missile[i].Y, Missile[i].X+8, Missile[i].Y, false, false, true, true, 2) then Missile[i].Y:=(Missile[i].Y - 40) else if Map.RayCast(Missile[i].X, Missile[i].Y, Missile[i].X, Missile[i].Y-8, false, false, true, true, 2) then Missile[i].Y:=(Missile[i].Y + 40);  //  40
  1568.             end;
  1569.             if (Missile[i].Dist < 5) then begin //3
  1570.                 Missile[i].target_coll := true;
  1571.             end else if Map.RayCast(Missile[i].X, Missile[i].Y, Missile[i].X, Missile[i].Y, false, false, true, true, 2) then begin
  1572.                 Missile[i].poly_coll := true;
  1573.             end;
  1574.         end;
  1575.         if (Missile[i].Dist > 3) then Map.CreateBullet(Missile[i].X, Missile[i].Y, (Missile[i].Next_Dist_X/20), (Missile[i].Next_Dist_Y/20), 0, 5, Players[Missile[i].owner_ID]);
  1576.         if ((Ticks mod Missile[i].n) = 0) then begin
  1577.             if (Missile[i].target_coll) then begin
  1578.                 Players[Missile[i].Target_ID].Damage(Missile[i].owner_ID, Players[Missile[i].Target_ID].Health-1);
  1579.                 nova(Missile[i].X,Missile[i].Y,(Missile[i].Next_Dist_X/2),(Missile[i].Next_Dist_Y/2),20,5,2,7,14,Missile[i].owner_ID);
  1580.                 nova(Missile[i].X2,Missile[i].Y2,0,0,30,8,2,9,14,Missile[i].owner_ID);
  1581.                 nova(Missile[i].X2,Missile[i].Y2,0,0,12,-3,10,5,4,Missile[i].owner_ID);
  1582.                 Missile[i].Active := false;
  1583.                 if (PlayerInfo[Missile[i].owner_ID].RocketAmmo<=0) then PlayerInfo[Missile[i].owner_ID].RocketType:=1;
  1584.                 ResetMissile(i);
  1585.             end else if (Missile[i].poly_coll) then begin
  1586.                 nova(Missile[i].X,Missile[i].Y,(Missile[i].Next_Dist_X/2),(Missile[i].Next_Dist_Y/2),20,5,2,7,14,Missile[i].owner_ID);
  1587.                 nova(Missile[i].X,Missile[i].Y,0,0,20,-3,10,4,4,Missile[i].owner_ID);
  1588.                 if (PlayerInfo[Missile[i].owner_ID].RocketAmmo<=0) then PlayerInfo[Missile[i].owner_ID].RocketType:=1;
  1589.                 ResetMissile(i);
  1590.             end;
  1591.         end;
  1592.     end;
  1593. end;
  1594.  
  1595. procedure WeaponsModule(i:byte);
  1596. var lastteam, full: byte; LastHP, LastVest, tempx, tempy, lastgetx, lastgety: single; Punch: TNewWeapon;
  1597. begin
  1598.     if (PlayerInfo[i].GetsW>-1) then begin
  1599.         if (Players[i].Team=1) then begin tempx:=FlagX[1]; tempy:=Flagy[1]; end else if (Players[i].Team=2) then begin tempx:=FlagX[2]; tempy:=Flagy[2]; end;
  1600.         Players[i].WorldText(AW,'Dont move '+Inttostr(PlayerInfo[i].GetsW)+'!',135,$CC0000,0.055,tempx-iif(PlayerInfo[i].GetsW<10,41,46),tempy);
  1601.         if (PlayerInfo[i].GetsW=0) then begin
  1602.             PlayerInfo[i].CanReset:=false;
  1603.  
  1604.             LastTeam := Players[i].Team;    LastGetX := Players[i].X;   LastGetY := Players[i].Y;   LastHP   := Players[i].Health;  LastVest := Players[i].Vest;
  1605.             Punch:=TNewWeapon.Create();     Punch.WType:=255;   Players[i].ForceWeapon(Punch,Players[i].Secondary);     Punch.Free();
  1606.             Players[i].Team := 5;   Players[i].Team := Lastteam;
  1607.             SetPlayerHealth(Players[i],LastHP,LastVest);    Players[i].Move(lastgetx,lastgety);
  1608.             PlayerInfo[i].LastX:=Players[i].X;  PlayerInfo[i].Resp:=true;
  1609.  
  1610.             PlayerInfo[i].CanReset:=true;
  1611.             PlayerInfo[i].CanGetWeapon:=false;
  1612.         end;
  1613.         if (PlayerInfo[i].GetsW<>-1) then PlayerInfo[i].GetsW:=(PlayerInfo[i].GetsW-1);
  1614.     end;
  1615.            
  1616.     if (PlayerInfo[i].GetsA>-1) then begin
  1617.         if (Players[i].Team=1) then begin tempx:=FlagX[1]; tempy:=Flagy[1]; end else if (Players[i].Team=2) then begin tempx:=FlagX[2]; tempy:=Flagy[2]; end;
  1618.         Players[i].WorldText(AW,'Dont move '+Inttostr(PlayerInfo[i].GetsA)+'!',135,$CC0000,0.055,tempx-iif(PlayerInfo[i].GetsA<10,41,46),tempy);
  1619.         if (CheckPlayerWeapons(Players[i],1)) then begin
  1620.             full:=0;
  1621.             if (w1<>255) then begin
  1622.                 if (WepAmmo[w1][i]>=GetMaxAmmo(w1)) then full:=full+1;
  1623.             end;
  1624.             if (w2<>255) then begin
  1625.                 if(WepAmmo[w2][i]>=GetMaxAmmo(w2)) then full:=full+1;
  1626.             end;
  1627.             if (full=2) then begin
  1628.                 PlayerInfo[i].GetsA:=-1;
  1629.                 Players[i].WriteConsole('Stopped waiting for ammunition, you have a full magazines.',$D0D21D);
  1630.             end;
  1631.             if (PlayerInfo[i].GetsA=0) then begin
  1632.                 if (w1<>255) then begin
  1633.                     if (WepAmmo[w1][i]<GetMaxAmmo(w1)) then begin
  1634.                         WepAmmo[w1][i]:=GetMaxAmmo(w1);
  1635.                         PlayerInfo[i].CanGetAmmo:=false;
  1636.                         Players[i].WriteConsole('Was obtained ammo to: '+GetWeaponName(w1),$D0D21D);
  1637.                     end;
  1638.                 end;
  1639.                 if (w2<>255) then begin
  1640.                     if (WepAmmo[w2][i]<GetMaxAmmo(w2)) then begin
  1641.                         WepAmmo[w2][i]:=GetMaxAmmo(w2);
  1642.                         PlayerInfo[i].CanGetAmmo:=false;
  1643.                         Players[i].WriteConsole('Was obtained ammo to: '+GetWeaponName(w2),$D0D21D);
  1644.                     end;
  1645.                 end;
  1646.             end;
  1647.         end;
  1648.         if (PlayerInfo[i].GetsA<>-1) then PlayerInfo[i].GetsA:=(PlayerInfo[i].GetsA-1);
  1649.     end;
  1650. end;
  1651.  
  1652. procedure WeaponModuleDis(i:byte);
  1653. var tempx, tempy: single;
  1654. begin
  1655.     if (Players[i].Team=1) then begin tempx:=FlagX[1]; tempy:=Flagy[1]; end else if (Players[i].Team=2) then begin tempx:=FlagX[2]; tempy:=Flagy[2]; end;
  1656.     if (Distance(Players[i].X,Players[i].Y,TempX,TempY)<=43) then begin
  1657.         if (PlayerInfo[i].GetsW=-1) and (PlayerInfo[i].GetsA=-1) then Players[i].BigText(AW,'Write, /getweapon to get weapon.', 70,$339900,0.11,10,350);
  1658.         if (PlayerInfo[i].GetsA=-1) and (PlayerInfo[i].GetsW=-1) then Players[i].BigText(AW+1,'Write, /getammo to get ammo.', 70,$339900,0.11,10,365);
  1659.     end else
  1660.     begin
  1661.         if (PlayerInfo[i].GetsW>-1) then begin
  1662.             PlayerInfo[i].GetsW:=-1;
  1663.             Players[i].WriteConsole('Aborted importation weapons - dont move.',$D0D21D);
  1664.         end;
  1665.         if (PlayerInfo[i].GetsA>-1) then begin
  1666.             PlayerInfo[i].GetsA:=-1;
  1667.             Players[i].WriteConsole('Aborted importation ammunition - dont move.',$D0D21D);
  1668.         end;
  1669.     end;
  1670. end;
  1671.  
  1672. procedure AppOnIdleSC3(Ticks: integer);
  1673. var i,b: byte; ReloadWep: TNewWeapon; fastkd:single;
  1674. begin
  1675.     ShootKeyCheck();
  1676.     AmmoDisplay(Ticks);
  1677.     Defiblirate();
  1678.     for i:= 1 to 32 do if (Players[i].Active) then begin
  1679.         if (DefiblirateTime[i]>0) then DefiblirateTime[i]:=(DefiblirateTime[i]-1);
  1680.         if (Players[i].Team<5) then begin
  1681.             fastkd:=((PlayerHealth[i]/FullHeal)*100.0);
  1682.             if (Players[i].Vest>0) then Players[i].BigText(HV,'Vest: '+FormatFloat('0',Players[i].Vest)+'%',40,$FD3C20,0.055,12,iif(PlayerInfo[i].Classid=2,395,385)) else Players[i].BigText(HV,'Vest: 0%',40,$FD3C20,0.055,12,iif(PlayerInfo[i].Classid=2,395,385));
  1683.             if (PlayerHealth[i]>0) then Players[i].BigText(HH,'Heal: '+FormatFloat('0.00',fastkd)+'%',40,$FD3C20,0.055,12,iif(PlayerInfo[i].Classid=2,405,395)) else Players[i].BigText(HH,'Heal: 0%',40,$FD3C20,0.055,12,iif(PlayerInfo[i].Classid=2,405,395));
  1684.         end;
  1685.         if (PlayerInfo[i].Resp) and (Players[i].Human) then begin
  1686.             if (PlayerInfo[i].TimerOnSpawn<5) then begin
  1687.                 PlayerInfo[i].TimerOnSpawn:=(PlayerInfo[i].TimerOnSpawn+1);
  1688.                 Players[i].Move(PlayerInfo[i].LastX,Players[i].Y);
  1689.             end;
  1690.             if (Players[i].X > PlayerInfo[i].LastX+5) or (Players[i].X < PlayerInfo[i].LastX-5) then begin
  1691.                 PlayerInfo[i].Resp:=false;
  1692.                 WeaponAmmoChangeLimit(i);
  1693.             end;
  1694.         end;
  1695.     end;
  1696.  
  1697.     for i := 1 to 32 do if (Players[i].Active) then if (PlayerInfo[i].ClassID=4) then begin
  1698.         if ((Players[i].KeyCrouch) or (Players[i].IsProne)) and (Players[i].KeyShoot) and (Missile[i].Active=false) then begin
  1699.             if (PlayerInfo[i].RocketType=2) and (Players[i].Primary.Ammo<>0) and (Players[i].OnGround) and (Players[i].Alive) and (Players[i].Primary.WType=13) and (PlayerInfo[i].RocketAmmo>0) then begin
  1700.                 b := FindPlayerForMissile(i,700,true);
  1701.                 if (b>0) then begin
  1702.                     Players.WorldText(b+WT,'[Traced]',75,$FF0000,0.065,Players[b].X-30,Players[b].Y-22);
  1703.                     if (PlayerInfo[i].ShootMis=16) then begin
  1704.                         PlayerInfo[i].RocketAmmo:=(PlayerInfo[i].RocketAmmo-1);
  1705.                         Missile[i].owner_ID:=i; Missile[i].target_ID:=b;
  1706.                         Missile[i].X:=Players[i].X;
  1707.                         Missile[i].Y:=Players[i].Y-8;
  1708.                         Missile[i].Active:=true;
  1709.                         ReloadWep := TNewWeapon.Create();
  1710.                         try
  1711.                             ReloadWep.WType := 13;
  1712.                             ReloadWep.Ammo := 0;
  1713.                             Players[i].ForceWeapon(ReloadWep,Players[i].Secondary)
  1714.                         finally
  1715.                             ReloadWep.Free();
  1716.                         end;
  1717.                         AddToPointsEventList(Players[i],'+20 Rocket!',20);
  1718.                     end else PlayerInfo[i].ShootMis:=(PlayerInfo[i].ShootMis+1);
  1719.                 end;
  1720.             end;
  1721.         end else PlayerInfo[i].ShootMis:=0;
  1722.     end;
  1723.    
  1724.     if (isCompile=false) then begin
  1725.         isCompile := True;
  1726.         FlagX[1] := round(Map.RedFlag.X);   FlagY[1] := round(Map.RedFlag.Y);
  1727.         flagX[2] := round(Map.BlueFlag.X);  FlagY[2] := round(Map.BlueFlag.Y);
  1728.     end;
  1729.    
  1730.     MissileModule(Ticks);
  1731.  
  1732.     if ((Ticks mod 18) = 0) then begin
  1733.         for i := 1 to 32 do if (Mozdziez[i].Active=true) then begin
  1734.             if (Mozdziez[i].Shoots>0) then begin
  1735.                 if (Mozdziez[i].Xplayer=1) then Map.CreateBullet(Mozdziez[i].X+Random(-315,-166),Mozdziez[i].R-800,5,12.25,1000,8,Players[i]) else Map.CreateBullet(Mozdziez[i].X+Random(315,166),Mozdziez[i].R-800,-5,12.25,1000,8,Players[i]);
  1736.                 Players.WorldText(Players[i].ID+WM,'+--===  MORTARS  ===--+',135,$CC0000,0.055,Mozdziez[i].X-65,Mozdziez[i].R);
  1737.                 Mozdziez[i].Shoots:=(Mozdziez[i].Shoots-1);
  1738.             end else Mozdziez[i].Active:=false;
  1739.         end;
  1740.         for i := 1 to 32 do if (Players[i].Active) then WeaponModuleDis(i);
  1741.     end;
  1742.  
  1743.     if ((Ticks mod 63) = 0) then for i := 1 to 32 do if (Players[i].Active) then ComboAppi(i);
  1744.  
  1745.     if ((Ticks mod 50) = 0) then for i := 1 to 32 do if (Players[i].Active) then if (PlayerInfo[i].NumDisp < MaxDispLowAmmo) then begin
  1746.         PlayerInfo[i].NumDisp := PlayerInfo[i].NumDisp+1;
  1747.         Players[i].BigText(LA,'Warning low ammo!', 70,$990000,0.15,243,222);    //How center: MedX := Trunc(((LengthText*5)-(LengthText*4))/2);  X := 640 - (LengthText*5) + MedX;
  1748.     end;
  1749.  
  1750.     if ((Ticks mod 60) = 0) then begin
  1751.         for i := 1 to 32 do if (Players[i].Active) then begin
  1752.             DisHud(i);
  1753.             if (Ttimer[i]>0) then begin
  1754.                 Ttimer[i]:=(Ttimer[i]-1);
  1755.                 if (Ttimer[i]=0) then atc[i]:=0;
  1756.             end;
  1757.             if (CooldownTimer<>0) then for b := 1 to 32 do if (PlayersInfoArr[i].DamageRecievedByCooldown[b]>=1) then PlayersInfoArr[i].DamageRecievedByCooldown[b] := (PlayersInfoArr[i].DamageRecievedByCooldown[b]-1);
  1758.             if (((Players[i].Health*100)/MaxHealth) > ((100-TotalPercentDamageRecieved(i)))) then RemoveDamageDoneBy(i,((Players[i].Health*100)/MaxHealth) - (100-TotalPercentDamageRecieved(i)));
  1759.             WeaponsModule(i);
  1760.         end;
  1761.     end;
  1762.  
  1763.     if ((Ticks mod 120) = 0) then begin
  1764.         for i := 1 to 32 do if (Players[i].Active) then DisPoints(i);
  1765.     end;
  1766.  
  1767. end;
  1768.  
  1769. procedure GrabFlag(Player: TActivePlayer; Flag: TActiveFlag; Team: Byte; GrabbedInBase: Boolean);
  1770. begin
  1771.     if (GrabbedInBase) then begin
  1772.         AddToPointsEventList(Player,'+80 Flag Grab!',80);
  1773.         flaggrabed[Flag.Style]:=true;
  1774.     end;
  1775. end;
  1776.  
  1777. procedure FlagScore(Player: TActivePlayer; Flag: TActiveFlag; Team: Byte);
  1778. begin   AddToPointsEventList(Player,'+250 Flag Score!',250);    flaggrabed[Flag.Style]:=false; end;
  1779.  
  1780. procedure FlagReturn(Player: TActivePlayer; Flag: TActiveFlag; Team: Byte);
  1781. begin if ((flaggrabed[1]) or (flaggrabed[2])) then begin AddToPointsEventList(Player,'+50 Flag Return!',50); flaggrabed[Flag.Style]:=false; end end;
  1782.  
  1783. procedure LeaveGame(Player: TActivePlayer; Kicked: Boolean);
  1784. var i:byte;
  1785. begin
  1786.     ResVar(Player.ID,false);
  1787.     for i := 1 to 32 do begin
  1788.         if (Players[i].Active) then begin
  1789.             if (PlayersInfoArr[i].DamageRecievedByID[Player.ID] <> 0) then begin
  1790.                 PlayersInfoArr[i].DamageRecievedByID[33] := (PlayersInfoArr[i].DamageRecievedByID[33] + PlayersInfoArr[i].DamageRecievedByID[Player.ID]);
  1791.                 PlayersInfoArr[i].DamageRecievedByID[Player.ID] := 0;
  1792.             end;
  1793.         end;
  1794.     end;
  1795.     for i := 1 to 33 do PlayersInfoArr[Player.ID].DamageRecievedByID[i] := 0;
  1796.     PlayersInfoArr[Player.ID].KilledBy := 0;
  1797.     PlayerInfo[Player.ID].Points:=0;
  1798.     PlayerInfo[Player.ID].DeadX:=-0.3333330022255559991;
  1799.     PlayerInfo[Player.ID].DeadY:=-0.3333330022255559991;
  1800. end;
  1801.  
  1802. procedure ChangeBefore(Next: string);
  1803. var i:byte;
  1804. begin
  1805.     change:=true;
  1806.     for i := 1 to 32 do if (Players[i].Active) then begin
  1807.         DisPlayPointsList(Players[i]);
  1808.         PlayerInfo[i].Points:=0;
  1809.     end;
  1810. end;
  1811.  
  1812. procedure ChangeAfter(Next: string);
  1813. var i: byte;
  1814. begin
  1815.     for i := 1 to 32 do if (Players[i].Active) and (Players[i].Team<>5) then begin
  1816.         ResVar(i,false);
  1817.         ClassSet(i, true);
  1818.         PokazKim(Players[i]);
  1819.     end;
  1820.     change:=false;
  1821.     firstBlood := 1;
  1822.     for i := 1 to 254 do begin
  1823.         if (Map.Spawns[i].Style=7) then Map.Spawns[i].Active := false;
  1824.         if (Map.Spawns[i].Style=8) then Map.Spawns[i].Active := false;
  1825.     end;
  1826.     for i := 1 to 90 do begin
  1827.         if (Map.Objects[i].Style=16) then Map.Objects[i].Kill;
  1828.         if (Map.Objects[i].Style=17) then Map.Objects[i].Kill;
  1829.     end;
  1830.     for i := 1 to 2 do flaggrabed[i]:=false;
  1831.     if (isCompile=true) then begin
  1832.         FlagX[1] := round(Map.RedFlag.X);   FlagY[1] := round(Map.RedFlag.Y);  
  1833.         flagX[2] := round(Map.BlueFlag.X);  FlagY[2] := round(Map.BlueFlag.Y);
  1834.     end;
  1835. end;
  1836.  
  1837. procedure KillKit(Player: TActivePlayer; Kit: TActiveMapObject);
  1838. var i:byte;
  1839. begin
  1840.     Player.Damage(Player.id,-1185);
  1841.     for i := 1 to 32 do if (Players[i].Active) then if (PlayerInfo[i].SpawnedID=Kit.id) and (i<>Player.ID) then begin
  1842.         if (Player.Team=Players[i].Team) then begin
  1843.             if (Kit.Style=16) then AddToPointsEventList(players[i],'+50 Friends use medkit!',50);
  1844.             if (Kit.Style=17) then AddToPointsEventList(players[i],'+50 Friends use granadekit!',50);
  1845.         end else
  1846.         begin
  1847.             if (Kit.Style=16) then AddToPointsEventList(players[i],'-25 Enemy use medkit!',-25);
  1848.             if (Kit.Style=17) then AddToPointsEventList(players[i],'-25 Enemy use granadekit!',-25);
  1849.         end;
  1850.     end;
  1851.     Kit.kill;
  1852. end;
  1853.  
  1854. procedure JoinGame(Player: TActivePlayer; Team: TTeam);
  1855. var i: byte;
  1856. begin
  1857.     PlayersInfoArr[Player.ID].KilledBy := 0;
  1858.     for i := 1 to 33 do begin
  1859.         PlayersInfoArr[Player.ID].DamageRecievedByID[i] := 0;
  1860.         PlayersInfoArr[Player.ID].DamageRecievedByCooldown[i] := 0;
  1861.     end;
  1862. end;
  1863.  
  1864. Procedure JoinTeam(Player: TActivePlayer; Team: TTeam);
  1865. begin
  1866.     PlayerInfo[Player.ID].LastX:=Player.X;
  1867.     PlayerInfo[Player.ID].TimerOnSpawn:=0;
  1868.     PlayerInfo[Player.ID].Resp:=True;
  1869.     if (Team.ID=5) and (Player.Human) then begin
  1870.         Player.BigText(HK,'',1,$F15D70,0.03,12,440);    Player.BigText(HH,'',1,$F15D70,0.03,12,440);    Player.BigText(HV,'',1,$F15D70,0.03,12,440);    Player.BigText(BS,'',1,$F15D70,0.03,12,440);
  1871.         Player.BigText(HP,'',1,$F15D70,0.03,12,440);    Player.BigText(HA,'',1,$F15D70,0.03,12,440);    Player.BigText(HS1,'',1,$F15D70,0.03,12,440);   Player.BigText(HS2,'',1,$F15D70,0.03,12,440);
  1872.     end;
  1873.     if (PlayerInfo[Player.ID].CanReset) then begin
  1874.         ResVar(Player.ID,false);
  1875.         if (Team.ID<>5) then begin
  1876.             ClassSet(Player.ID, true);
  1877.             PokazKim(Player);
  1878.         end;
  1879.     end else ClassSet(Player.ID, false);
  1880. end;
  1881.  
  1882. procedure OnAfterRespawn(Player: TActivePlayer);
  1883. var i,c:byte; Dist,NewDist:single;
  1884. begin
  1885.     PlayerHealth[Player.ID]:=FullHeal;
  1886.     PlayerInfo[Player.ID].LastX:=Player.X;
  1887.     PlayerInfo[Player.ID].TimerOnSpawn:=0;
  1888.     PlayerInfo[Player.ID].Resp:=True;
  1889.     Player.GiveBonus(3);
  1890.     if (PlayerInfo[Player.ID].ClassID=1) then Player.GiveBonus(5);
  1891.     Player.BigText(HK,'',1,$D0D21D,0.112,20,360);
  1892.     if (change) then PokazKim(Player); c:=255; Dist:=WsparcieDist;
  1893.     for i := 1 to 32 do if (Players[i].Active) then begin               //Assault Wsparcie
  1894.         if (PlayerInfo[i].ClassID = 1) and (Players[i].Alive) and (PlayerInfo[i].WsparcieDT-WC>0) and (Player.Team=Players[i].Team) then begin
  1895.             if (PlayerInfo[Player.ID].DeadX<>-0.3333330022255559991) and (PlayerInfo[Player.ID].DeadY<>-0.3333330022255559991) then begin
  1896.                 NewDist:=Distance(PlayerInfo[Player.ID].DeadX,PlayerInfo[Player.ID].DeadY,Players[i].X,Players[i].Y);
  1897.                 if (NewDist<=WsparcieDist) and (NewDist<Dist) then begin
  1898.                     Dist := NewDist; c := i;
  1899.                 end;
  1900.             end;
  1901.         end;
  1902.     end;
  1903.     if (c<>255) then begin
  1904.         Player.Move(Players[c].X,Players[c].Y);
  1905.         PlayerInfo[Player.ID].LastX:=Players[c].X;
  1906.         AddToPointsEventList(Players[c],'+25 Team Respawn!',25);
  1907.     end;
  1908. end;
  1909.  
  1910. initialization
  1911. begin
  1912.     Game.TickThreshold := 1;
  1913.     isCompile:=false;
  1914.     for Decl := 1 to 32 do begin
  1915.         Players[Decl].OnCommand := @Commands;
  1916.         Players[Decl].OnAfterRespawn := @OnAfterRespawn;
  1917.         Players[Decl].OnDamage := @HeadShootKill;
  1918.         Players[Decl].OnKitPickup := @KillKit;
  1919.         Players[Decl].OnFlagScore := @FlagScore;
  1920.         Players[Decl].OnKill      := @OnKill;
  1921.         Players[Decl].OnSpeak := @Speak;
  1922.         Players[Decl].OnFlagGrab := @GrabFlag;
  1923.         Players[Decl].OnFlagReturn := @FlagReturn;
  1924.     end;
  1925.     for Decl := 1 to 5 do Game.Teams[Decl].OnJoin := @JoinTeam;
  1926.     Game.OnJoin := @JoinGame;
  1927.     Game.OnLeave := @LeaveGame;
  1928.     Map.OnAfterMapChange := @ChangeAfter;
  1929.     Map.OnBeforeMapChange := @ChangeBefore;
  1930.     Game.OnClockTick := @AppOnIdleSC3;
  1931.     //CODE
  1932.     if (Game.Realistic=True) then MaxHealth := 65 else MaxHealth := 150;
  1933.     for ab := 1 to 90 do if (Map.Objects[ab].Active) then if (Map.Objects[ab].Style=27) then Map.Objects[ab].Kill;
  1934.     for ab := 1 to 32 do begin
  1935.         for ai := 1 to 32 do ResetMissile(ai);
  1936.         ResVar(ab,true);
  1937.         PlayerInfo[ab].DeadX:=-0.3333330022255559991;
  1938.         PlayerInfo[ab].DeadY:=-0.3333330022255559991;
  1939.         if (Players[ab].Active) and (Players[ab].Team<>5) then begin
  1940.             ai:=RandomClass(ab);
  1941.             PlayerInfo[ab].ClassID := ai;
  1942.             PokazKim(Players[ab]);
  1943.         end;
  1944.     end;
  1945.     change:=false;
  1946.     firstBlood := 1;
  1947. end;
  1948.  
  1949. finalization;
  1950. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement