Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit BattlefieldMod;
- interface
- //To add to fix: Napraw blad z blednym ustawieniem ammo jesli zmiana mapy lub dolaczenie do gry
- //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,
- // Fix bug for fast get of weapons,
- implementation
- var Decl, ai, ab: byte;
- const
- DeaglleAmmo = 28; // deagles WepAmmos maximum 4 Magazines
- Mp5Ammo = 180; // mp5 WepAmmos maximum 5 Magazines
- AkAmmo = 160; // ak WepAmmos maximum 4 Magazines
- AugAmmo = 150; // aug WepAmmos maximum 6 Magazines
- SpasAmmo = 42; // spas WepAmmos maximum 42 Bullets
- RugerAmmo = 24; // ruger WepAmmos maximum 6 Magazines
- M79Ammo = 6; // m79 WepAmmos maximum 6 Bullets
- BarrettAmmo = 15; // barret WepAmmos maximum 15 Bullets
- MinimiAmmo = 150; // minimi WepAmmos maximum 3 Magazines
- MinigunAmmo = 120; // minigun WepAmmos maximum 3 Magazines
- LawAmmo = 4; // law WepAmmos maximum 4 Bullets
- PistolAmmo = 48; // socom WepAmmos maximum 4 Magazines
- SawPaliwo = 800; // saw WepAmmos maximum Working time about 18 seconds
- KNIFE = 1; // Dont Edit
- FlameFuel = 200; // Flamer fuel
- ARambo = 50; // Rambo shoots
- AFlameRambo = 20; // Rambo flame shoots
- MinDeaglleAmmo = 7;
- MinMp5Ammo = 30;
- MinAkAmmo = 35;
- MinAugAmmo = 30;
- MinSpasAmmo = 7;
- MinRugerAmmo = 4;
- MinM79Ammo = 1;
- MinBarrettAmmo = 10;
- MinMinimiAmmo = 50;
- MinMinigunAmmo = 40;
- MinLawAmmo = 1;
- MinPistolAmmo = 12;
- MinSawPaliwo = 800;
- MinKNIFE = 1;
- MinFlameFuel = 200;
- MinARambo = 50;
- MinAFlameRambo = 20;
- RanDropAmmo = 0.65;
- AssistMinimumDamagePercent = 65; // Damage minimum to get assist
- CooldownTimer = 0; // Time from injury after which you can not already get assist
- TimeCon = 6; // Time from injury after which you can not get savior
- MaxPlayersInGame = 16; //Max players in server non work now
- RandomMethodClass = 2; //1 Specyfic, 2 specyfic -1, Random 1..4.
- FullHeal = 150.0;
- AmmoGivenLimit = 4; //M79, LAW, ammo give must get 4 and he get ammo
- BaretAmmoGivenLimit = 3;
- RugerAmmoGiven = 2;
- SawAmmoAdd = 20;
- AutomaticRifleInfo = 8;
- BarrettInfo = 4;
- SocomInfo = 6;
- NoAutoInfo = 4;
- ExplodeInfo = 2;
- SawInfo = 110;
- MaxDispLowAmmo = 3;
- TimeToGetAmmoNormal = 5;
- TimeToGetAmmoBig = 18;
- TimeToGetWeapon = 8;
- TimeToGetWeaponBig = 25;
- VestEnginerRepair = 8;
- DeffaultRockeTtype = 2; //1 normal 2 extra
- MaxExtraRocket = 1; //Max extra rocket
- HealMedykHealing = 12;
- MedkitTimeAdd = 25;
- DefiblirateToNext = 90;
- GranadekitTimeAdd = 20;
- WTT = 15;
- WC = 60;
- WsparcieDist = 640;
- StatCreate = 40;
- StatActiveTime = 12;
- CursorMaxSearch = 125;
- MozdzierzTime = 40;
- SniperBandageTime = 50;
- //Layers
- HK = 1; //To kill default layers text - DONT EDIT!
- HH = 150; //Hud heal
- HV = 151; //Hud vest
- BS = 133; //Blood screen
- HP = 107; //Hud points
- HA = 103; //Hud ammo
- HS1 = 100; //Hud skill 1
- HS2 = 101; //Hud skill 2
- LA = 102; //Low ammo info
- RA = 89; //Result Red Team
- RB = 90; //Result Blue Team
- AW = 91; //Ammo and weapon | Number + 1, Example is number 91 this is between 91-92.
- WR = 100; //WorldText Layer Resuscitation Text | Number + MaxPlayers(32), Example is number 100 this is between 100-132.
- WT = 67; //WorldText Layer Rocket Tracked | Number + MaxPlayers(32), Example is number 67 this is between 67-99.
- WM = 34; //WorldText Layer Sniper Mortar | Number + MaxPlayers(32), Example is number 34 this is between 34-66.
- type tMissile = record
- owner_ID, target_ID: Byte;
- Active, poly_coll, target_coll: Boolean;
- n: Word;
- X, Y, X2, Y2, dist, next_dist_x, next_dist_y, prev_dist_x, prev_dist_y, rd: Single;
- end;
- type tMozdziez = record
- Active: Boolean;
- shoots: integer;
- X, R: Single;
- Xplayer: byte;
- end;
- type tPlayerInfo = record
- ClassID, LastClassID: byte;
- Points: int64;
- Gives, NumDisp: integer;
- AmmoGiven, BarrettAmmoGiven: integer;
- Resp, CanGetAmmo, CanGetWeapon, CanReset: boolean;
- GetsW, GetsA:integer;
- Wep1,Wep2: byte;
- LastX:single;
- TimerOnSpawn:integer;
- Medkit, SpawnedID:integer;
- WsparcieDT:integer;
- DeadX,DeadY:single;
- StatTime: integer;
- StatID:integer;
- RocketType:integer;
- RocketAmmo:integer;
- ShootMis:integer;
- MozdziezT:integer;
- SniperBandage:integer;
- end;
- type tCombo = record
- H,T: integer;
- end;
- type PlayerAssist = record
- DamageRecievedByID: array[1..33] of double;
- DamageRecievedByCooldown: array[1..33] of integer;
- KilledBy: integer;
- end;
- var
- PlayerHealth: array [1..32] of single;
- PlayerInfo: array[1..32] of tPlayerInfo;
- PlayersInfoArr: array[1..32] of PlayerAssist;
- Missile: array[1..32] of TMissile;
- Mozdziez: array[1..32] of tMozdziez;
- Combo: array [1..32] of tCombo;
- Revenge: array [1..32] of string;
- WepAmmo: array[0..17] of array[1..32] of Integer;
- DefiblirateTime, Ttimer: array [1..32] of integer;
- Ammo, Weap, atc: array[1..32] of byte;
- AlphaPlayerrrs: array of integer;
- flaggrabed: array[1..2] of boolean;
- PointsEvents: array[1..32] of array of string;
- FlagX, FlagY: array[1..2] of single;
- firstBlood, w1,w2: byte;
- MaxHealth: integer;
- change, isCompile: boolean;
- function GetMaxAmmo(ID:integer):integer;
- begin
- Case (ID) of
- 0: Result:= PistolAmmo;
- 1: Result:= DeaglleAmmo;
- 2: Result:= Mp5Ammo;
- 3: Result:= AkAmmo;
- 4: Result:= AugAmmo;
- 5: Result:= SpasAmmo;
- 6: Result:= RugerAmmo;
- 7: Result:= M79Ammo;
- 8: Result:= BarrettAmmo;
- 9: Result:= MinimiAmmo;
- 10: Result:= MinigunAmmo;
- 11: Result:= KNIFE;
- 12: Result:= SawPaliwo;
- 13: Result:= LawAmmo;
- 14: Result:= FlameFuel;
- 15: Result:= ARambo;
- 16: Result:= AFlameRambo;
- 17: Result:=MinKNIFE;
- end; //14 flame //15 rambo //16 flame rambo
- end;
- function GetMinAmmo(ID:byte):integer;
- begin
- Case (ID) of
- 0: Result:= MinPistolAmmo;
- 1: Result:= MinDeaglleAmmo;
- 2: Result:= MinMp5Ammo;
- 3: Result:= MinAkAmmo;
- 4: Result:= MinAugAmmo;
- 5: Result:= MinSpasAmmo;
- 6: Result:= MinRugerAmmo;
- 7: Result:= MinM79Ammo;
- 8: Result:= MinBarrettAmmo;
- 9: Result:= MinMinimiAmmo;
- 10: Result:= MinMinigunAmmo;
- 11: Result:= MinKNIFE;
- 12: Result:= MinSawPaliwo;
- 13: Result:= MinLawAmmo;
- 14: Result:= MinFlameFuel;
- 15: Result:= MinARambo;
- 16: Result:= MinAFlameRambo;
- 255: Result:= MinKNIFE;
- end; //14 flame //15 rambo //16 flame rambo
- end;
- function GetDmg(ID:byte):integer;
- begin
- case (ID) of
- 0: Result:=252;
- 1: Result:=486;
- 2: Result:=127;
- 3: Result:=110;
- 4: Result:=68;
- 5: Result:=250;
- 6: Result:=440;
- 7: Result:=960000;
- 8: Result:=543;
- 9: Result:=81;
- 10: Result:=47;
- 11: Result:=22500000;
- 12: Result:=4200;
- 13: Result:=150000;
- 14: Result:=1200;
- 15: Result:=1200;
- 16: Result:=800;
- end;
- end;
- function GetWeaponName(Weapon: Byte): String;
- begin
- case (Weapon) of
- 0: Result := 'USSOCOM';
- 1: Result := 'Desert Eagles';
- 2: Result := 'HK MP5';
- 3: Result := 'Ak-74';
- 4: Result := 'Steyr AUG';
- 5: Result := 'Spas-12';
- 6: Result := 'Ruger 77';
- 7: Result := 'M79';
- 8: Result := 'Barret M82A1';
- 9: Result := 'FN Minimi';
- 10: Result := 'XM214 Minigun';
- 11: Result:= 'Combat Knife';
- 12: Result:= 'Chainsaw';
- 13: Result:= 'M72 LAW';
- 14: Result:= 'Flamer';
- 15: Result:= 'Rambo Bow';
- 16: Result:= 'Flamed Arrows';
- else Result := '';
- end;
- end;
- procedure SetPlayerHealth(Player: TActivePlayer; Health, Vest: Single);
- var chealth, cvest, delta: Single;
- begin
- chealth := Player.Health; cvest := Player.Vest;
- if ((chealth=health) and (cvest=vest)) then exit;
- if (chealth = 0) then Player.Damage(Player.ID,1000);
- if (vest = 0) then begin
- while (cvest > 0) do begin
- Player.Damage(Player.ID,2);
- cvest := (cvest - 1);
- end;
- Player.Damage(Player.ID,(chealth-health));
- exit;
- end else
- begin
- if (cvest = 0) then begin
- Player.GiveBonus(3); Player.BigText(HK,'',1,$D0D21D,0.112,20,360);
- cvest := 100;
- end;
- while (chealth <> health) do begin
- if (chealth < health) then delta := -1 else delta := 1;
- Player.Damage(Player.ID,3*delta);
- chealth := (chealth - delta);
- cvest := (cvest - delta);
- if (cvest < 0) then cvest := 0;
- if (cvest > 100) then cvest := 100;
- if (cvest = 0) then begin
- Player.GiveBonus(3); Player.BigText(HK,'',1,$D0D21D,0.112,20,360);
- cvest := 100;
- end;
- if (cvest <> vest) then begin
- if (cvest < vest) then delta := -1 else delta := 1;
- Player.Damage(Player.ID,2*delta);
- cvest := (cvest - delta);
- end;
- end;
- while (cvest <> vest) do begin
- if (cvest < vest) then delta := -1 else delta := 1;
- Player.Damage(Player.ID,2*delta);
- cvest := (cvest - delta);
- end;
- exit;
- end;
- Player.GiveBonus(3); Player.BigText(HK,'',1,$D0D21D,0.112,20,360);
- cvest := 100;
- while (cvest > vest) do begin
- Player.Damage(Player.ID,2);
- cvest := (cvest-1);
- end;
- end;
- procedure PokazKim(Player: TActivePlayer);
- begin
- case (PlayerInfo[Player.ID].ClassID) of
- 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;
- 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;
- 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;
- 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;
- end;
- end;
- function Sort(input: array of integer): array of integer;
- var i,ii,first,last,len,cur: integer; used: array of boolean;
- begin
- len := getarraylength(input);
- setarraylength(result,len);
- setarraylength(used,len);
- for i := 0 to len-1 do begin
- for ii := 0 to len-1 do if not (used[ii]) then begin
- cur := input[ii];
- first := ii;
- break;
- end;
- last := first;
- for ii := first to len-1 do if not (used[ii]) then if (input[ii] > cur) then begin
- cur := input[ii];
- last := ii;
- end;
- result[i] := cur;
- used[last] := true;
- end;
- end;
- function RandomClass(ID:byte): byte;
- var i,c,x: byte; CanRandom: array of byte; List, List2: array of integer;
- begin
- x:=0;
- if (RandomMethodClass=1) or (RandomMethodClass=2) then begin
- setarraylength(List,4); setarraylength(List2,4);
- for i := 1 to 32 do if (Players[i].Active) then begin
- if ((Players[ID].Team=Players[i].Team) and (PlayerInfo[i].ClassID>0)) then begin
- case (PlayerInfo[i].ClassID) of
- 1: List[0] := List[0]+1;
- 2: List[1] := List[1]+1;
- 3: List[2] := List[2]+1;
- 4: List[3] := List[3]+1;
- end;
- end;
- end;
- List2:=Sort(List);
- if (RandomMethodClass=2) then c:=1 else c:=0;
- for i := 0 to 3 do if (List[i]<=List2[3]+c) then begin
- setarraylength(CanRandom,x+1);
- CanRandom[x]:=(i+1);
- x:=x+1;
- end;
- x:=CanRandom[Random(0,GetArrayLength(CanRandom))];
- end else if (RandomMethodClass=3) then x:= Random(1,5);
- Result := x;
- end;
- procedure ClassSet(ID:byte; ChangeClass:boolean);
- var i:byte;
- begin
- if (ChangeClass) then begin
- i:=RandomClass(ID);
- PlayerInfo[ID].ClassID := i;
- end else i:=PlayerInfo[ID].ClassID;
- case (i) of
- 1: begin
- Players[id].WeaponActive[1] := true;
- Players[id].WeaponActive[2] := false;
- Players[id].WeaponActive[3] := true;
- Players[id].WeaponActive[4] := true;
- Players[id].WeaponActive[5] := false;
- Players[id].WeaponActive[6] := false;
- Players[id].WeaponActive[7] := false;
- Players[id].WeaponActive[8] := false;
- Players[id].WeaponActive[9] := false;
- Players[id].WeaponActive[10] := false;
- Players[id].WeaponActive[11] := true;
- Players[id].WeaponActive[12] := true;
- Players[id].WeaponActive[13] := false;
- Players[id].WeaponActive[14] := false;
- end;
- 2: begin
- Players[id].WeaponActive[1] := false;
- Players[id].WeaponActive[2] := true;
- Players[id].WeaponActive[3] := false;
- Players[id].WeaponActive[4] := false;
- Players[id].WeaponActive[5] := false;
- Players[id].WeaponActive[6] := false;
- Players[id].WeaponActive[7] := false;
- Players[id].WeaponActive[8] := false;
- Players[id].WeaponActive[9] := true;
- Players[id].WeaponActive[10] := true;
- Players[id].WeaponActive[11] := true;
- Players[id].WeaponActive[12] := true;
- Players[id].WeaponActive[13] := false;
- Players[id].WeaponActive[14] := false;
- end;
- 3: begin
- Players[id].WeaponActive[1] := false;
- Players[id].WeaponActive[2] := false;
- Players[id].WeaponActive[3] := false;
- Players[id].WeaponActive[4] := false;
- Players[id].WeaponActive[5] := true;
- Players[id].WeaponActive[6] := true;
- Players[id].WeaponActive[7] := false;
- Players[id].WeaponActive[8] := true;
- Players[id].WeaponActive[9] := false;
- Players[id].WeaponActive[10] := false;
- Players[id].WeaponActive[11] := true;
- Players[id].WeaponActive[12] := true;
- Players[id].WeaponActive[13] := false;
- Players[id].WeaponActive[14] := false;
- end;
- 4: begin
- Players[id].WeaponActive[1] := false;
- Players[id].WeaponActive[2] := true;
- Players[id].WeaponActive[3] := false;
- Players[id].WeaponActive[4] := true;
- Players[id].WeaponActive[5] := false;
- Players[id].WeaponActive[6] := false;
- Players[id].WeaponActive[7] := true;
- Players[id].WeaponActive[8] := false;
- Players[id].WeaponActive[9] := false;
- Players[id].WeaponActive[10] := false;
- Players[id].WeaponActive[11] := false;
- Players[id].WeaponActive[12] := false;
- Players[id].WeaponActive[13] := true;
- Players[id].WeaponActive[14] := true;
- end;
- end;
- end;
- function CheckPlayerWeapons(Player: TActivePlayer; Method: byte): boolean;
- var ob:byte;
- begin
- Result:=false; w1:=255; w2:=255; ob:=0;
- if (Method=1) then begin
- case (PlayerInfo[Player.ID].ClassID) of
- 1: begin
- 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
- w1:=Player.Primary.Wtype;
- ob:=1;
- end;
- 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
- w2:=Player.Secondary.Wtype;
- ob:=1;
- end;
- end;
- 2: begin
- 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
- w1:=Player.Primary.Wtype;
- ob:=1;
- end;
- 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
- w2:=Player.Secondary.Wtype;
- ob:=1;
- end;
- end;
- 3: begin
- 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
- w1:=Player.Primary.Wtype;
- ob:=1;
- end;
- 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
- w2:=Player.Secondary.Wtype;
- ob:=1;
- end;
- end;
- 4: begin
- 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
- w1:=Player.Primary.Wtype;
- ob:=1;
- end;
- 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
- w2:=Player.Secondary.Wtype;
- ob:=1;
- end;
- end;
- end;
- if (ob=1) then Result:=true;
- end;
- if (Method=2) then begin
- case (PlayerInfo[Player.ID].ClassID) of
- 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;
- 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;
- 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;
- 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;
- end;
- end;
- end;
- procedure WeaponAmmoChangeLimit(ID:byte);
- var NW,NS:TNewWeapon; WeapChangeRan:byte;
- begin
- case (PlayerInfo[id].ClassID) of
- 1: begin
- if (PlayerInfo[ID].Resp=False) then begin
- if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
- if (Players[id].Secondary.Wtype>16) then PlayerInfo[ID].Wep2 := 17 else PlayerInfo[ID].Wep2 := Players[id].Secondary.Wtype;
- if (PlayerInfo[ID].Wep1<18) and (PlayerInfo[ID].Wep2<18) then begin
- WepAmmo[PlayerInfo[ID].Wep1][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep1);
- WepAmmo[PlayerInfo[ID].Wep2][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep2);
- end;
- if (PlayerInfo[ID].Wep2=12) or (PlayerInfo[ID].Wep2=13) then begin
- WeapChangeRan:=iif(Random(1,3)=1,11,0);
- NS:=TNewWeapon.Create(); NS.WType:=PlayerInfo[ID].Wep1; NS.Ammo:=GetMinAmmo(PlayerInfo[ID].Wep1);
- NW:=TNewWeapon.Create(); NW.WType:=WeapChangeRan; NW.Ammo:=GetMinAmmo(WeapChangeRan);
- WepAmmo[PlayerInfo[ID].Wep2][ID]:=(GetMinAmmo(PlayerInfo[ID].Wep2)-Random(0,1+Trunc(RanDropAmmo*GetMinAmmo(PlayerInfo[ID].Wep2))));
- WepAmmo[WeapChangeRan][ID]:=GetMaxAmmo(WeapChangeRan);
- Players[ID].ForceWeapon(NS,NW);
- NS.Free(); NW.Free();
- end;
- end else
- begin
- WepAmmo[1][ID]:=GetMaxAmmo(1);
- WepAmmo[3][ID]:=GetMaxAmmo(3);
- WepAmmo[4][ID]:=GetMaxAmmo(4);
- WepAmmo[0][ID]:=GetMaxAmmo(0);
- WepAmmo[11][ID]:=GetMaxAmmo(11);
- end;
- end;
- 2: begin
- if (PlayerInfo[ID].Resp=False) then begin
- if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
- if (Players[id].Secondary.Wtype>16) then PlayerInfo[ID].Wep2 := 17 else PlayerInfo[ID].Wep2 := Players[id].Secondary.Wtype;
- if (PlayerInfo[ID].Wep1<18) and (PlayerInfo[ID].Wep2<18) then begin
- WepAmmo[PlayerInfo[ID].Wep1][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep1);
- WepAmmo[PlayerInfo[ID].Wep2][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep2);
- end;
- if (PlayerInfo[ID].Wep2=12) or (PlayerInfo[ID].Wep2=13) then begin
- WeapChangeRan:=iif(Random(1,3)=1,11,0);
- NS:=TNewWeapon.Create(); NS.WType:=PlayerInfo[ID].Wep1; NS.Ammo:=GetMinAmmo(PlayerInfo[ID].Wep1);
- NW:=TNewWeapon.Create(); NW.WType:=WeapChangeRan; NW.Ammo:=GetMinAmmo(WeapChangeRan);
- WepAmmo[PlayerInfo[ID].Wep2][ID]:=(GetMinAmmo(PlayerInfo[ID].Wep2)-Random(0,1+Trunc(RanDropAmmo*GetMinAmmo(PlayerInfo[ID].Wep2))));
- WepAmmo[WeapChangeRan][ID]:=GetMaxAmmo(WeapChangeRan);
- Players[ID].ForceWeapon(NS,NW);
- NS.Free(); NW.Free();
- end;
- end else
- begin
- WepAmmo[2][ID]:=GetMaxAmmo(2);
- WepAmmo[9][ID]:=GetMaxAmmo(9);
- WepAmmo[10][ID]:=GetMaxAmmo(10);
- WepAmmo[0][ID]:=GetMaxAmmo(0);
- WepAmmo[11][ID]:=GetMaxAmmo(11);
- end;
- end;
- 3: begin
- if (PlayerInfo[ID].Resp=False) then begin
- if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
- if (Players[id].Secondary.Wtype>16) then PlayerInfo[ID].Wep2 := 17 else PlayerInfo[ID].Wep2 := Players[id].Secondary.Wtype;
- if (PlayerInfo[ID].Wep1<18) and (PlayerInfo[ID].Wep2<18) then begin
- WepAmmo[PlayerInfo[ID].Wep1][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep1);
- WepAmmo[PlayerInfo[ID].Wep2][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep2);
- end;
- if (PlayerInfo[ID].Wep2=12) or (PlayerInfo[ID].Wep2=13) then begin
- WeapChangeRan:=iif(Random(1,3)=1,11,0);
- NS:=TNewWeapon.Create(); NS.WType:=PlayerInfo[ID].Wep1; NS.Ammo:=GetMinAmmo(PlayerInfo[ID].Wep1);
- NW:=TNewWeapon.Create(); NW.WType:=WeapChangeRan; NW.Ammo:=GetMinAmmo(WeapChangeRan);
- WepAmmo[PlayerInfo[ID].Wep2][ID]:=(GetMinAmmo(PlayerInfo[ID].Wep2)-Random(0,1+Trunc(RanDropAmmo*GetMinAmmo(PlayerInfo[ID].Wep2))));
- WepAmmo[WeapChangeRan][ID]:=GetMaxAmmo(WeapChangeRan);
- Players[ID].ForceWeapon(NS,NW);
- NS.Free(); NW.Free();
- end;
- end else
- begin
- WepAmmo[5][ID]:=GetMaxAmmo(5);
- WepAmmo[6][ID]:=GetMaxAmmo(6);
- WepAmmo[8][ID]:=GetMaxAmmo(8);
- WepAmmo[0][ID]:=GetMaxAmmo(0);
- WepAmmo[11][ID]:=GetMaxAmmo(11);
- end;
- end;
- 4: begin
- if (PlayerInfo[ID].Resp=False) then begin
- if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
- if (Players[id].Secondary.Wtype>16) then PlayerInfo[ID].Wep2 := 17 else PlayerInfo[ID].Wep2 := Players[id].Secondary.Wtype;
- if (PlayerInfo[ID].Wep1<18) and (PlayerInfo[ID].Wep2<18) then begin
- WepAmmo[PlayerInfo[ID].Wep1][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep1);
- WepAmmo[PlayerInfo[ID].Wep2][ID]:=GetMaxAmmo(PlayerInfo[ID].Wep2);
- end;
- if (PlayerInfo[ID].Wep2=17) or (PlayerInfo[ID].Wep2=0) or (PlayerInfo[ID].Wep2=11) then begin
- NS:=TNewWeapon.Create(); NS.WType:=PlayerInfo[ID].Wep1; NS.Ammo:=GetMinAmmo(PlayerInfo[ID].Wep1);
- NW:=TNewWeapon.Create(); NW.WType:=13; NW.Ammo:=GetMinAmmo(13);
- if (PlayerInfo[ID].Wep2<>17) then WepAmmo[PlayerInfo[ID].Wep2][ID]:=(GetMinAmmo(PlayerInfo[ID].Wep2)-Random(0,1+Trunc(RanDropAmmo*GetMinAmmo(PlayerInfo[ID].Wep2))));
- WepAmmo[13][ID]:=GetMaxAmmo(13);
- Players[ID].ForceWeapon(NS,NW);
- NS.Free(); NW.Free();
- end;
- end else
- begin
- WepAmmo[2][ID]:=GetMaxAmmo(2);
- WepAmmo[4][ID]:=GetMaxAmmo(4);
- WepAmmo[7][ID]:=GetMaxAmmo(7);
- WepAmmo[12][ID]:=GetMaxAmmo(12);
- WepAmmo[13][ID]:=GetMaxAmmo(13);
- end;
- end;
- end;
- end;
- procedure LowAmmoInfo(ID, Weapon: byte);
- begin //Saw is in AmmoDisplay() section;
- if (Weapon>0) and (Weapon<>1) and (Weapon<5) then begin //HK mp5, ak, aug
- if(WepAmmo[Weapon][ID]<=AutomaticRifleInfo) then begin
- PlayerInfo[id].NumDisp := 0;
- if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
- PlayerInfo[id].CanGetAmmo:=true;
- Players[ID].WriteConsole(' ',$D0D21D);
- Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
- end;
- end;
- end;
- if (Weapon>8) and (Weapon<11) then begin //Minimi, minigun
- if (WepAmmo[Weapon][ID]<=AutomaticRifleInfo) then begin
- PlayerInfo[id].NumDisp := 0;
- if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
- PlayerInfo[id].CanGetAmmo:=true;
- Players[ID].WriteConsole(' ',$D0D21D);
- Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
- end;
- end;
- end;
- if (Weapon=0) then begin //Socom
- if (WepAmmo[Weapon][ID]<=SocomInfo) then begin
- PlayerInfo[id].NumDisp := 0;
- if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
- PlayerInfo[id].CanGetAmmo:=true;
- Players[ID].WriteConsole(' ',$D0D21D);
- Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
- end;
- end;
- end;
- if (Weapon=8) then begin //Barrett
- if (WepAmmo[Weapon][ID]<=BarrettInfo) then begin
- PlayerInfo[id].NumDisp := 0;
- if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
- PlayerInfo[id].CanGetAmmo:=true;
- Players[ID].WriteConsole(' ',$D0D21D);
- Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
- end;
- end;
- end;
- if (Weapon=1) or (Weapon=5) or (Weapon=6) then begin //Deagle, ruger, spas
- if (WepAmmo[Weapon][ID]<=NoAutoInfo) then begin
- PlayerInfo[id].NumDisp := 0;
- if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
- PlayerInfo[id].CanGetAmmo:=true;
- Players[ID].WriteConsole(' ',$D0D21D);
- Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
- end;
- end;
- end;
- if (Weapon=7) or (Weapon=13) then begin //M79, law
- if (WepAmmo[Weapon][ID]<=ExplodeInfo) then begin
- PlayerInfo[id].NumDisp := 0;
- if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetAmmo=false) then begin
- PlayerInfo[id].CanGetAmmo:=true;
- Players[ID].WriteConsole(' ',$D0D21D);
- Players[ID].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
- end;
- end;
- end;
- end;
- procedure OnPlayerShoot(ID, Weapon: byte);
- begin
- if (PlayerInfo[ID].Resp) then begin
- PlayerInfo[ID].Resp:=false;
- WeaponAmmoChangeLimit(ID);
- end;
- if (PlayerInfo[ID].Resp=false) then begin
- if (Weapon<>255) and (Weapon<>11) then begin
- WepAmmo[Weapon][ID]:=(WepAmmo[Weapon][ID]-1);
- if (WepAmmo[Weapon][ID]<>0) then LowAmmoInfo(ID,Weapon) else begin
- if (CheckPlayerWeapons(Players[ID],2)) and (PlayerInfo[id].CanGetWeapon=false) then begin
- PlayerInfo[id].NumDisp := MaxDispLowAmmo;
- 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);
- Players[ID].WriteConsole(' ',$D0D21D);
- Players[ID].WriteConsole('You can go back to base to take a new weapon.',$D0D21D);
- PlayerInfo[id].CanGetAmmo:=false;
- PlayerInfo[id].CanGetWeapon:=true;
- end;
- end;
- end;
- end;
- end;
- procedure ShootKeyCheck();
- var i: byte;
- begin
- for i := 1 to 32 do if (Players[i].Active) and (Players[i].Primary.ammo<>Ammo[i]) then begin
- 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);
- Weap[i] := Players[i].Primary.wtype;
- Ammo[i] := Players[i].Primary.ammo;
- end;
- end;
- Procedure AmmoDisplay(Ticks:integer);
- var i,b: byte; Punch: TNewWeapon;
- begin
- for i := 1 to 32 do if (Players[i].Active) then begin
- if (Players[i].Alive) then begin
- if (PlayerInfo[i].Resp=false) then begin
- for b := 0 to 16 do begin
- if (Players[i].Primary.wtype=255) then begin
- Players[i].BigText(HA,'Punch!', 100,$FFB300,0.055,12,435);
- break;
- end;
- if (Players[i].Primary.wtype=b) then begin
- if (b<>11) then begin
- if (b=12) then begin
- if ((Ticks mod 2) = 0) then WepAmmo[b][i]:=(WepAmmo[b][i]-1);
- Players[i].BigText(HA,'Fuel: '+inttostr(WepAmmo[b][i]),100,$FFB300,0.055,12,435);
- if (WepAmmo[b][i]<=SawInfo) then begin
- if (WepAmmo[b][i]<=0) then begin
- PlayerInfo[i].NumDisp := MaxDispLowAmmo;
- 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);
- Players[i].WriteConsole(' ',$D0D21D);
- Players[i].WriteConsole('You can go back to base to take a new weapon.',$D0D21D);
- PlayerInfo[i].CanGetAmmo:=false;
- PlayerInfo[i].CanGetWeapon:=true;
- end else
- begin
- PlayerInfo[i].NumDisp := 0;
- if (PlayerInfo[i].CanGetAmmo=false) then begin
- PlayerInfo[i].CanGetAmmo:=true;
- Players[i].WriteConsole(' ',$D0D21D);
- Players[i].WriteConsole('You can go back to base to take ammunition.',$D0D21D);
- end;
- end;
- end;
- end else Players[i].BigText(HA,'Ammo: '+inttostr(WepAmmo[b][i]),100,$FFB300,0.055,12,435);
- end else Players[i].BigText(HA,'Knife!',100,$FFB300,0.055,12,435);
- if (WepAmmo[b][i]=0) then begin
- Punch:=TNewWeapon.Create();
- Punch.WType:=255;
- Players[i].ForceWeapon(Punch,Players[i].Secondary);
- Punch.Free();
- end;
- end;
- end;
- end else Players[i].BigText(HA,'Ammo: Choosing!',100,$FFB300,0.055,12,435);
- end else Players[i].BigText(HA,'',100,$FFB300,0.055,12,435);
- end;
- end;
- procedure AddToPointsEventList(Player: TActivePlayer; Text: String; Add: integer);
- var len: integer;
- begin
- len := GetArrayLength(PointsEvents[Player.ID]);
- SetArrayLength(PointsEvents[Player.ID],len+1);
- PointsEvents[Player.ID][len] := Text;
- PlayerInfo[Player.ID].Points:=(PlayerInfo[Player.ID].Points+Add);
- end;
- procedure OnPlayerDeathGiveAssists(Victim: TActivePlayer);
- var i: byte;
- begin
- for i := 1 to 32 do if (Players[i].Active) then if (Victim.ID <> i) and (PlayersInfoArr[Victim.ID].KilledBy <> i) then begin
- if (PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[i] > 0) or (CooldownTimer = 0) then begin
- if (PlayersInfoArr[Victim.ID].DamageRecievedByID[i] > AssistMinimumDamagePercent) then begin
- AddToPointsEventList(Victim,'+60 Assist!',60);
- end;
- end;
- end;
- end;
- Procedure RemoveAllDamageToOnDeath(ID:byte);
- var i: byte;
- Begin
- for i := 1 to 32 do begin
- PlayersInfoArr[i].DamageRecievedByCooldown[ID] := 0;
- PlayersInfoArr[i].DamageRecievedByID[33] := PlayersInfoArr[i].DamageRecievedByID[33] + PlayersInfoArr[i].DamageRecievedByID[ID];
- PlayersInfoArr[i].DamageRecievedByID[ID] := 0;
- end;
- end;
- Function TotalPercentDamageRecieved(ID:byte): double;
- var i: byte; TotalDamagePercent: double;
- Begin
- TotalDamagePercent := 0;
- for i := 1 to 33 do if (PlayersInfoArr[ID].DamageRecievedByID[i] <> 0) then TotalDamagePercent := TotalDamagePercent + PlayersInfoArr[ID].DamageRecievedByID[i];
- result := TotalDamagePercent;
- end;
- Function MostPercentDamagedoneBy(ID:byte): integer;
- var i: byte; MostPercentDamagedone: double;
- Begin
- MostPercentDamagedone := 0;
- for i := 1 to 33 do if (PlayersInfoArr[ID].DamageRecievedByID[i] > MostPercentDamagedone) then begin
- MostPercentDamagedone := PlayersInfoArr[ID].DamageRecievedByID[i];
- result := i;
- end;
- end;
- Procedure RemoveDamageDoneBy(ID: byte; DamagePercent: Double);
- var i: byte; CountAttackers: integer; DividedDamagePercent: double; DamagePercentLeft: double;
- Begin
- CountAttackers := 0;
- for i := 1 to 32 do if (Players[i].Active) then if (PlayersInfoArr[ID].DamageRecievedByID[i] <> 0) then CountAttackers:=(CountAttackers+1);
- if (CountAttackers > 0) then begin
- DividedDamagePercent := (DamagePercent/CountAttackers);
- for i := 1 to 33 do if (PlayersInfoArr[ID].DamageRecievedByID[i] <> 0) then begin
- if ((PlayersInfoArr[ID].DamageRecievedByID[i] - DividedDamagePercent) < 0) then begin
- PlayersInfoArr[ID].DamageRecievedByID[i] := 0;
- DamagePercentLeft := (DividedDamagePercent - PlayersInfoArr[ID].DamageRecievedByID[i]);
- end else PlayersInfoArr[ID].DamageRecievedByID[i] := (PlayersInfoArr[ID].DamageRecievedByID[i] - DividedDamagePercent);
- end;
- end;
- if (DamagePercentLeft <> 0) then RemoveDamageDoneBy(ID,DamagePercentLeft);
- end;
- procedure DestoryStat(Stat, i: byte);
- begin
- Map.CreateBullet(Map.Objects[Stat].X,Map.Objects[Stat].Y+6,0,0,1000,5,Players[i]);
- Map.CreateBullet(Map.Objects[Stat].X-8,Map.Objects[Stat].Y+6,0,0,1000,5,Players[i]);
- Map.CreateBullet(Map.Objects[Stat].X+8,Map.Objects[Stat].Y+6,0,0,1000,5,Players[i]);
- Map.CreateBullet(Map.Objects[Stat].X,Map.Objects[Stat].Y,0,0,1000,5,Players[i]);
- //PlaySound(0,'cluster-explosion.wav',Map.Objects[Stat].X,Map.Objects[Stat].Y);
- PlayerInfo[i].StatID:=-1;
- Map.Objects[Stat].Kill;
- end;
- procedure DestoryObjectMG(id:byte);
- begin
- if (PlayerInfo[id].SpawnedID<>0) then begin
- 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;
- PlayerInfo[id].SpawnedID:=0;
- end;
- end;
- procedure ResVar(ID:byte; recompile:boolean);
- var i:byte;
- begin
- //~~~ Type ~~~
- PlayerInfo[ID].ClassID:=0;
- PlayerInfo[ID].Gives:=0;
- PlayerInfo[ID].Wep1:=17;
- PlayerInfo[ID].Wep2:=17;
- PlayerInfo[ID].AmmoGiven:=0;
- PlayerInfo[ID].BarrettAmmoGiven:=0;
- PlayerInfo[id].NumDisp := MaxDispLowAmmo;
- PlayerInfo[id].CanGetAmmo:=false;
- PlayerInfo[id].CanGetWeapon:=false;
- PlayerInfo[id].GetsW:=-1;
- PlayerInfo[id].GetsA:=-1;
- PlayerInfo[id].CanReset:=true;
- Revenge[id] := '';
- Ttimer[id] := 0;
- Combo[ID].H:=0;
- Combo[ID].T:=0;
- //~~~ AMMO ~~~
- 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
- case (i) of
- 7: WepAmmo[i][ID]:=Random(1,3);
- 8: WepAmmo[i][ID]:=Random(1,5);
- 13: WepAmmo[i][ID]:=Random(1,2);
- end;
- end;
- DefiblirateTime[ID]:=0;
- PlayerInfo[ID].Medkit:=0;
- DestoryObjectMG(id);
- PlayerInfo[id].WsparcieDT:=0;
- if (PlayerInfo[id].StatID<>-1) then begin
- if (recompile) then PlayerInfo[id].StatID:=-1 else DestoryStat(PlayerInfo[id].StatID,id);
- PlayerInfo[id].StatTime:=0;
- PlayerInfo[id].StatID:=-1;
- end;
- PlayerInfo[id].RocketType:=deffaultrockettype;
- PlayerInfo[id].RocketAmmo:=MaxExtraRocket;
- PlayerInfo[id].StatTime:=0;
- PlayerInfo[id].MozdziezT:=0;
- PlayerInfo[id].SniperBandage:=0;
- end;
- function Commands(Player: TActivePlayer; Text: string): Boolean;
- var b, OB: byte; MediTemp: TNewMapObject; ObjData:TActiveMapObject; tempx, tempy:single;
- begin
- if (Player.IsAdmin) then begin
- if (Text='/1') then begin PlayerInfo[Player.id].ClassID := 1; ClassSet(Player.ID,false); end;
- if (Text='/2') then begin PlayerInfo[Player.id].ClassID := 2; ClassSet(Player.ID,false); end;
- if (Text='/3') then begin PlayerInfo[Player.id].ClassID := 3; ClassSet(Player.ID,false); end;
- if (Text='/4') then begin PlayerInfo[Player.id].ClassID := 4; ClassSet(Player.ID,false); end;
- end;
- if (Text='/getweapon') then begin
- if (PlayerInfo[player.id].GetsA=-1) then begin
- if (PlayerInfo[player.id].GetsW=-1) then begin
- 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;
- if (Distance(Player.X,Player.Y,tempx,tempy)<=43) then begin
- if (PlayerInfo[player.id].CanGetWeapon) then PlayerInfo[player.id].GetsW := TimeToGetWeapon else PlayerInfo[player.id].GetsW := TimeToGetWeaponBig;
- end else Player.WriteConsole('Move closer to your flag.',$D0D21D);
- end else Player.WriteConsole('Already waiting for a supply of weapons.',$D0D21D);
- end else Player.WriteConsole('Currently waiting for a supply of ammunition.',$D0D21D);
- end;
- if (Text='/getammo') then begin
- if (PlayerInfo[player.id].GetsW=-1) then begin
- if (PlayerInfo[player.id].GetsA=-1) then begin
- 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;
- if (Distance(Player.X,Player.Y,tempx,tempy)<=43) then begin
- if (CheckPlayerWeapons(Player,1)) then begin
- 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;
- if (ob>0) then begin
- if (PlayerInfo[player.id].CanGetAmmo) then PlayerInfo[player.id].GetsA := TimeToGetAmmoNormal else PlayerInfo[player.id].GetsA := TimeToGetAmmoBig;
- end else Player.WriteConsole('You have a maximum amount of ammunition in all weapons.',$D0D21D);
- end else Player.WriteConsole('Do not have the appropriate weapons, type /getweapon to get new.',$D0D21D);
- end else Player.WriteConsole('Move closer to your flag.',$D0D21D);
- end else Player.WriteConsole('Already waiting for a supply of ammunition.',$D0D21D);
- end else Player.WriteConsole('Currently waiting for a supply of weapons.',$D0D21D);
- end;
- if (Text='/cc1') then begin
- if (PlayerInfo[Player.id].ClassID=1) and (PlayerInfo[Player.id].WsparcieDT<=0) and (Player.Alive) then PlayerInfo[Player.id].WsparcieDT:=(WTT+WC); //Wsparcie
- if (PlayerInfo[Player.id].ClassID=2) and (DefiblirateTime[Player.id]<=0) and (Player.Alive) then begin //Defiblirate
- for b := 1 to 32 do if (Players[b].Active) then begin
- 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
- Players[b].Alive:=True;
- PlayerInfo[Players[b].ID].ClassID := PlayerInfo[Players[b].ID].LastClassID;
- case (PlayerInfo[Players[b].ID].ClassID) of
- 1: Players[b].WriteConsole('You come back to game as the assault, rescued by '+Player.Name,$D0D21D);
- 2: Players[b].WriteConsole('You come back to game as theo medic, rescued by '+Player.Name,$D0D21D);
- 3: Players[b].WriteConsole('You come back to game as the sniper, rescued by '+Player.Name,$D0D21D);
- 4: Players[b].WriteConsole('You come back to game as the enginer, rescued by '+Player.Name,$D0D21D);
- end;
- Players[b].Move(Player.x,Player.y);
- DefiblirateTime[Player.id]:=DefiblirateToNext;
- AddToPointsEventList(Player,'+50 Defibrillation!',50);
- end;
- end;
- end;
- if (PlayerInfo[Player.id].ClassID=3) then begin
- if (PlayerInfo[Player.id].SniperBandage<=0) and (Player.Health<MaxHealth) and (Player.Alive) then begin
- PlayerInfo[Player.id].SniperBandage:=SniperBandageTime;
- 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);
- end;
- end;
- if (PlayerInfo[Player.id].ClassID=4) then begin
- if (Player.Primary.wtype=13) or (Player.Secondary.wtype=13) then begin
- if (PlayerInfo[Player.id].RocketType=1) then begin
- 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;
- end else PlayerInfo[Player.id].RocketType:=1;
- end else Player.BigText(HS1,'Rocket: Lack-M72 LAW',130,$B80000,0.055,12,405);
- end;
- end;
- if (Text='/cc2') then begin
- if (PlayerInfo[Player.id].ClassID=1) and (PlayerInfo[Player.id].Medkit<=0) and (Player.Alive) then begin //Create Granadekit
- DestoryObjectMG(Player.ID);
- MediTemp := TNewMapObject.Create;
- MediTemp.X := Player.X+iif((Player.Direction=1),-19,25);
- MediTemp.Y := Player.Y-12;
- MediTemp.Style := 17;
- ObjData:=Map.AddObject(MediTemp); PlayerInfo[Player.id].SpawnedID := ObjData.id;
- MediTemp.Free;
- PlayerInfo[Player.id].Medkit:=GranadekitTimeAdd;
- AddToPointsEventList(Player,'+10 Granadekit!',10);
- end;
- if (PlayerInfo[Player.id].ClassID=2) and (PlayerInfo[Player.id].Medkit<=0) and (Player.Alive) then begin //Create Medkit
- DestoryObjectMG(Player.ID);
- MediTemp := TNewMapObject.Create;
- MediTemp.X := Player.X+iif((Player.Direction=1),-19,25);
- MediTemp.Y := Player.Y-12;
- MediTemp.Style := 16;
- ObjData:=Map.AddObject(MediTemp); PlayerInfo[Player.id].SpawnedID := ObjData.id;
- MediTemp.Free;
- PlayerInfo[Player.id].Medkit:=MedkitTimeAdd;
- AddToPointsEventList(Player,'+10 Medkit!',10);
- end;
- if (PlayerInfo[Player.id].ClassID=3) then begin
- if (PlayerInfo[Player.id].MozdziezT<=0) and (Player.Alive) then begin
- Mozdziez[Player.id].X:=Player.MouseAimX;
- if (Player.X<Player.MouseAimX) then Mozdziez[Player.id].Xplayer:=1 else Mozdziez[Player.id].Xplayer:=0;
- Mozdziez[Player.id].Shoots:=9;
- Mozdziez[Player.id].R:=Player.MouseAimY-1000;
- PlayerInfo[Player.id].MozdziezT:=MozdzierzTime;
- repeat
- Mozdziez[Player.id].R:=Mozdziez[Player.id].R+20;
- until Map.RayCast(Mozdziez[Player.id].X, Mozdziez[Player.id].R, Mozdziez[Player.id].X, Mozdziez[Player.id].R, false, false, true, true, 2);
- Mozdziez[Player.id].Active:=true;
- end;
- end;
- if (PlayerInfo[Player.id].ClassID=4) and (PlayerInfo[Player.id].StatTime<=0) and (Player.Alive) then begin //Create Stat
- if (Player.OnGround) then begin
- PlayerInfo[Player.id].StatTime := (StatCreate+StatActiveTime);
- MediTemp := TNewMapObject.Create;
- MediTemp.X := Player.X+iif((Player.Direction=1),8,-8);
- MediTemp.Y := Player.Y;
- MediTemp.Style := 27;
- ObjData:=Map.AddObject(MediTemp); PlayerInfo[Player.id].StatID := ObjData.id;
- MediTemp.Free;
- AddToPointsEventList(Player,'+25 Create!',25);
- end else Player.WriteConsole('You stand on the ground to create a stationary gun.',$FF0000);
- end;
- end;
- Result := false;
- end;
- procedure DisPlayPointsList(Player:TActivePlayer);
- var i,b:byte; AlphaStr:string; c,x:integer; useid: array[1..32] of boolean;
- begin
- AlphaStr:=''; x := 0;
- for i:= 1 to 32 do if (Players[i].Active) then begin
- if (Players[i].Team = 1) then begin
- SetArrayLength(AlphaPlayerrrs, x + 1);
- AlphaPlayerrrs[x] := PlayerInfo[i].Points;
- x:=(x+1);
- end;
- end;
- AlphaPlayerrrs:=Sort(AlphaPlayerrrs);
- for c:= 0 to GetArrayLength(AlphaPlayerrrs)-1 do begin
- for b:= 1 to 32 do if (Players[b].Active) and (Players[b].Team=1) then begin
- if (AlphaPlayerrrs[c]=PlayerInfo[b].Points) and (useid[b]=false) then begin
- AlphaStr:=AlphaStr+inttostr(c+1)+': '+Players[b].Name+' - '+inttostr(PlayerInfo[b].Points)+chr(13)+chr(10);
- useid[b]:=true;
- break;
- end;
- end;
- end;
- for b:= 1 to 32 do if (Players[b].Active) then useid[b]:=false;
- if (AlphaStr='') then AlphaStr:='None';
- Player.BigText(RA,'Alpha Team:'+chr(13)+chr(10)+AlphaStr,630,$F15D70,0.06,5,63);
- AlphaStr:=''; x := 0;
- for i:= 1 to 32 do if (Players[i].Active) then begin
- if (Players[i].Team = 2) then begin
- SetArrayLength(AlphaPlayerrrs, x + 1);
- AlphaPlayerrrs[x] := PlayerInfo[i].Points;
- x:=(x+1);
- end;
- end;
- AlphaPlayerrrs:=Sort(AlphaPlayerrrs);
- for c:= 0 to GetArrayLength(AlphaPlayerrrs)-1 do begin
- for b:= 1 to 32 do if (Players[B].Active) and (Players[b].Team = 2) then begin
- if (AlphaPlayerrrs[c]=PlayerInfo[b].Points) and (useid[b]=false) then begin
- AlphaStr:=AlphaStr+inttostr(c+1)+': '+Players[b].Name+' - '+inttostr(PlayerInfo[b].Points)+chr(13)+chr(10);
- useid[b]:=true;
- break;
- end;
- end;
- end;
- for b:= 1 to 32 do if (Players[b].Active) then useid[b]:=false;
- if (AlphaStr='') then AlphaStr:='None';
- Player.BigText(RB,'Bravo Team:'+chr(13)+chr(10)+AlphaStr,630,$0066CC,0.06,325,63);
- end;
- procedure Speak(Player: TActivePlayer; Text: string);
- var c,c2: boolean; d: integer;
- begin
- if ExecRegExpr('^!(classlist|listclass)$',LowerCase(Text)) then begin
- Player.WriteConsole('__Class:___ID:__ ',$D0D21D);
- Player.WriteConsole('- Assault 1 | ',$D0D21D);
- Player.WriteConsole('- Medyk 2 | ',$D0D21D);
- Player.WriteConsole('- Sniper 3 | ',$D0D21D);
- Player.WriteConsole('- Enginer 4 |__________________________________________________ ',$D0D21D);
- Player.WriteConsole('Write !class <ID> to learn more about the class. | ',$D0D21D);
- Player.WriteConsole('_________________________________________________________________| ',$D0D21D);
- end;
- if (Text='!class') or (Copy(Text,1,7) = '!class ') then begin
- c2 := true;
- if (Length(Text) > 7) then begin
- try
- d := StrToInt(Copy(Text,7,length(Text)));
- if (d > 0) and (d<5) then c := true else begin
- Player.WriteConsole('You have entered invalid class ID. ',$D0D21D);
- c2 := false;
- end;
- except
- c2 := false;
- Player.WriteConsole('You have entered invalid class ID. ',$D0D21D);
- end;
- end else c := false;
- if (c2=true) then case (iif(c=true,d,PlayerInfo[Player.ID].ClassID)) of
- 1: begin
- if ((c) and (PlayerInfo[Player.ID].ClassID<>d)) then Player.WriteConsole('[Class] Class assault!',$D0D21D) else Player.WriteConsole('[Class] Your class is assault!',$D0D21D);
- Player.WriteConsole('[Ammo] Give ammo yourself and friends from team. Give ammunition to get more points. ',$D0D21D);
- Player.WriteConsole('[Granade] Once on '+inttostr(GranadekitTimeAdd)+' seconds, you can place granadekit. Place granadekit and get more points. ',$D0D21D);
- Player.WriteConsole('[Granade] Additionally respawning you get extra pack of grenades. ',$D0D21D);
- Player.WriteConsole('[Support] Call support and everyone friends who dies near you, respawning on you. ',$D0D21D);
- Player.WriteConsole('[Support] For each player respawning on you, you get more points. ',$D0D21D);
- Player.WriteConsole('[HowUse] Ammo: Automatically, Support /cc1, Granade /cc2. ',$D0D21D);
- Player.WriteConsole('[Weapons] Desert Eagles, AK-74, Steyr AUG, USSOCOM, Combat Knife ',$D0D21D);
- end;
- 2: begin
- if ((c) and (PlayerInfo[Player.ID].ClassID<>d)) then Player.WriteConsole('[Class] Class medic!',$D0D21D) else Player.WriteConsole('[Class] Your class is medic!',$D0D21D);
- Player.WriteConsole('[Heal] You healing yourself and friends of the team. Healing friends to get more points. ',$D0D21D);
- Player.WriteConsole('[Defibrillation] If someone from team dies u see over his body "Res!". It means that you can defibrillation him. ',$D0D21D);
- Player.WriteConsole('[Defibrillation] Go to this text and crouch+change weapon key or write /cc1. ',$D0D21D);
- Player.WriteConsole('[Defibrillation] Interval between the defibrillation are 1.5 seconds. ',$D0D21D);
- Player.WriteConsole('[Medkit] Once on '+inttostr(MedkitTimeAdd)+' seconds, you can place medkit. Place medkit and get more points. ',$D0D21D);
- Player.WriteConsole('[HowUse] Heal: Automatically, Defibrillation: Crouch+ChangeWeapon key or /cc1, Medkit: /cc2. ',$D0D21D);
- Player.WriteConsole('[Weapons] HK MP5, Steyr AUG, FN Minimi, USSOCOM, Combat Knife ',$D0D21D);
- end;
- 3: begin
- if ((c) and (PlayerInfo[Player.ID].ClassID<>d)) then Player.WriteConsole('[Class] Class sniper!',$D0D21D) else Player.WriteConsole('[Class] Your class is sniper!',$D0D21D);
- Player.WriteConsole('[Barrett] When you prone or crouch on ground, your barrett m81a1 inflicts damage increased by 250%. ',$D0D21D);
- Player.WriteConsole('[Ruger 77] When you prone, your ruger 77 inflicts damage increased by 45%. ',$D0D21D);
- Player.WriteConsole('[DistKill] Killing from a large distance get about +50% more points, than other class. ',$D0D21D);
- Player.WriteConsole('[Bandage] Activate to restore yourself 42% maximum value of health. Use /cc1, cooldown '+inttostr(SniperBandageTime)+' seconds. ',$D0D21D);
- Player.WriteConsole('[Mortar] Once on '+inttostr(MozdzierzTime)+' seconds you can call in mortar shelling. Use /cc2, appears in place crosshair. ',$D0D21D);
- Player.WriteConsole('[HowUse] Bandage: /cc1, Mortar: /cc2, Barrett: Must prone or crouch + shooting, Ruger 77: Must prone + shooting. ',$D0D21D);
- Player.WriteConsole('[Weapons] Spas-12, Ruger 77, Barrett M82A1, USSOCOM, Combat Knife ',$D0D21D);
- end;
- 4: begin
- if ((c) and (PlayerInfo[Player.ID].ClassID<>d)) then Player.WriteConsole('[Class] Class enginer!',$D0D21D) else Player.WriteConsole('[Class] Your class is enginer!',$D0D21D);
- Player.WriteConsole('[Repair] You repair yourself and friends vest. Repairing friends vest to get more points. ',$D0D21D);
- Player.WriteConsole('[ExtraRocket] When you have M72 LAW in hands, you can shoot homing missile. Can change rocket type /cc1. ',$D0D21D);
- Player.WriteConsole('[ExtraRocket] Rocket types: Normal, Extra. How shoot u must crouch or prone and change rocket type to extra. ',$D0D21D);
- Player.WriteConsole('[ExtraRocket] Targeting player is marked [Traced]. Targeting is player nearest the crosshair. ExtraRocket ammo: '+inttostr(MaxExtraRocket)+' ',$D0D21D);
- Player.WriteConsole('[StationartGun] Once on '+inttostr(StatCreate)+' seconds you can place stationary gun. Gun is active '+inttostr(StatActiveTime)+' seconds and explode. Use /cc2. ',$D0D21D);
- Player.WriteConsole('[HowUse] Repair: Automatically; ExtraRocket: Change /cc1, Shooting Prone or Crouch + Shoot key; StationartGun: /cc2. ',$D0D21D);
- Player.WriteConsole('[Weapons] HK MP5, Steyr AUG, M79, Chainsaw, M72 LAW ',$D0D21D);
- end;
- end;
- end;
- if ExecRegExpr('^!(pointslist)$',LowerCase(Text)) then DisPlayPointsList(Player);
- if ExecRegExpr('^!(help)$',LowerCase(Text)) then begin
- Player.WriteConsole('Battlefield Mode! Commands:',$D0D21D);
- Player.WriteConsole('!classlist - List of all classes. ',$D0D21D);
- Player.WriteConsole('!class <ID_Class> - Description of the class indicated. ',$D0D21D);
- Player.WriteConsole('!class - A description of your class. ',$D0D21D);
- Player.WriteConsole('!pointslist - List of points of all players. ',$D0D21D);
- end;
- end;
- procedure OnKill(Killer, Victim: TActivePlayer; BulletId: Byte);
- var ID: integer; dis:single;
- begin
- PlayerInfo[Victim.ID].DeadX:=Victim.X; PlayerInfo[Victim.ID].DeadY:=Victim.Y;
- if (firstBlood > 0) and (Killer.ID <> Victim.ID) and (Killer.Team<>Victim.Team)then begin
- firstBlood := 0;
- AddToPointsEventList(Killer,'+200 First!',200);
- end;
- if (Killer.ID=Victim.ID) then AddToPointsEventList(Killer,'-50 SelfKill!',-50);
- PlayerInfo[Victim.ID].LastClassID := PlayerInfo[Victim.ID].ClassID;
- ResVar(Victim.ID,false); //Restart Zmiennych
- if (Victim.Team<>5) then begin
- ClassSet(Victim.ID, true);
- PokazKim(Victim);
- end;
- RemoveAllDamageToOnDeath(Victim.ID);
- PlayersInfoArr[Victim.ID].KilledBy := Killer.ID;
- OnPlayerDeathGiveAssists(Victim);
- if (Killer.ID <> Victim.ID) then begin
- Combo[Killer.ID].H:=(Combo[Killer.ID].H+1);
- Combo[Killer.ID].T:=3;
- dis:=Distance(Killer.X,Killer.Y,Victim.X,Victim.Y);
- if (dis>642) then begin //749
- id:=(10+Round(single(dis-642)/8.0)); //id:=Round((dis-730)/2);
- if (PlayerInfo[Killer.ID].ClassID=3) then id:=(id+round(0.5*id));
- if (ID<>0) then AddToPointsEventList(Killer,'+'+inttostr(id)+' Dist!',id);
- end;
- if (atc[Victim.ID] > 0) then begin
- if (Players[atc[Victim.ID]].Team = Killer.Team) and (Players[atc[Victim.ID]].Alive) and (Killer.ID <> atc[Victim.ID]) then begin
- atc[Victim.ID]:=0;
- AddToPointsEventList(Killer,'+40 Savior!',40);
- end;
- end;
- if (Revenge[Killer.ID] = Victim.Name) then begin
- AddToPointsEventList(Killer,'+40 Revenge!',40);
- Revenge[Killer.ID] := '';
- end;
- if (Revenge[Victim.ID] = '') then Revenge[Victim.ID] := Killer.Name;
- if (Revenge[Victim.ID] = Revenge[Victim.ID]) then Revenge[Victim.ID] := Killer.Name;
- if (Revenge[Victim.ID] = Revenge[Killer.ID]) then Revenge[Victim.ID] := Killer.Name;
- end;
- if (Combo[Victim.ID].T>1) then begin
- case (Combo[Victim.ID].H) of
- 2: AddToPointsEventList(Victim,'+20 DoubleKill!',20);
- 3: AddToPointsEventList(Victim,'+30 TripleKill!',30);
- 4: AddToPointsEventList(Victim,'+50 MultiKill!',50);
- 5: AddToPointsEventList(Victim,'+100 MultiKill [x2]!',100);
- end;
- end;
- if (Combo[Victim.ID].H>=6) then AddToPointsEventList(Victim,'+150 SerialKill!',150);
- if (Killer.Alive=false) then AddToPointsEventList(Killer,'+15 Posthumous!',15);
- end;
- function HeadShootKill(Shooter, Victim: TActivePlayer; Damage: Single; Bullet: Byte): Single;
- var dmg, tmp: single; c, len: integer; TmpDble, ShootSpeed: double; //c2,c3: integer; Punch:t
- begin
- tmp := iif(Damage>200,200,Damage);
- dmg := Damage;
- //DrawTextEx(Victim,13,'||||||',round(tmp/2.20),$FF0000,22,-1920,-1080); //2.80
- //Players[Victim].BigText(133,'||||||',200,$FF0000,22,-1920,-1080);
- Victim.BigText(BS,'O',round(tmp/2.10),$FF0000,75,-4100,-4100); //2.15 BigText(133,'O',30,$FF0000,75,-4100,-4100); //2.15
- if (Shooter.ID<>Victim.ID) then begin
- //Snajper additional dmg
- if (PlayerInfo[Shooter.ID].ClassID = 3) then begin
- if (Map.Bullets[Bullet].GetOwnerWeaponId=8) then begin
- if ((Shooter.IsProne) or (Shooter.KeyCrouch)) and (Shooter.OnGround) then dmg := (dmg+(2.5*dmg));
- end;
- if (Map.Bullets[Bullet].GetOwnerWeaponId=6) then begin
- if (Shooter.IsProne) and (Shooter.OnGround) then dmg := (dmg+(0.45*dmg));
- end;
- end;
- //Licz punkty
- if (Map.Bullets[Bullet].GetOwnerWeaponId=7) or (Map.Bullets[Bullet].GetOwnerWeaponId=13) then begin
- if (dmg>MaxHealth) then c:=100 else c:=Round(single(100.0*dmg)/single(MaxHealth));
- end else
- begin
- if (dmg>Victim.Health) then c:=Round(single(100*Victim.Health)/single(MaxHealth)) else c:=Round(single(100*dmg)/single(MaxHealth));
- end;
- if (c>100) then c:=100;
- //Wyświetl oraz dodaj punkty
- len:=GetArrayLength(PointsEvents[Shooter.ID]);
- if (Shooter.Team<>Victim.Team) then begin
- if (len=0) then Shooter.BigText(HP,'Points: '+inttostr(PlayerInfo[Shooter.ID].Points)+'+'+inttostr(c),200,$F15D70,0.055,12,425);
- PlayerInfo[Shooter.ID].Points:=(PlayerInfo[Shooter.ID].Points+c);
- end else
- begin
- if (len=0) then Shooter.BigText(HP,'Points: '+inttostr(PlayerInfo[Shooter.ID].Points)+'-'+inttostr(c),200,$F15D70,0.055,12,425);
- PlayerInfo[Shooter.ID].Points:=(PlayerInfo[Shooter.ID].Points-c);
- end;
- end;
- //Asysty
- if (Damage > 0) then begin
- if (Victim.Alive) then begin
- if ((Victim.Health - damage) <= 0) then begin
- if (Victim.Health > 0) then begin
- TmpDble := ((Victim.Health*100)/MaxHealth);
- PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
- PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
- end else
- begin
- if (TotalPercentDamageRecieved(victim.ID) < 100) then begin
- TmpDble := 100 - TotalPercentDamageRecieved(Victim.ID);
- PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
- PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
- end;
- end;
- end else
- begin
- TmpDble := ((Damage*100)/MaxHealth);
- PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
- PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
- end;
- end else
- begin
- if (MostPercentDamagedoneBy(Victim.ID) > 0) then begin
- if (TotalPercentDamageRecieved(Victim.ID) = 0) then begin
- PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := 100;
- PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
- end else if (TotalPercentDamageRecieved(Victim.ID) < 100) then begin
- TmpDble := 100 - TotalPercentDamageRecieved(Victim.ID);
- PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
- PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
- end;
- end else if (TotalPercentDamageRecieved(Victim.ID) < 100) then begin
- TmpDble := (100 - TotalPercentDamageRecieved(Victim.ID));
- PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] := (PlayersInfoArr[Victim.ID].DamageRecievedByID[Shooter.ID] + TmpDble);
- PlayersInfoArr[Victim.ID].DamageRecievedByCooldown[Shooter.ID] := CooldownTimer;
- end;
- end;
- end else if (Damage < 0) then RemoveDamageDoneBy(Victim.ID,(Damage*100)/MaxHealth);
- //Savior
- if (Shooter.Team <> Victim.Team) then begin
- if (Shooter.Active) then begin
- atc[Shooter.ID] := Victim.ID;
- Ttimer[Shooter.ID] := TimeCon;
- end;
- end;
- //Headshoot
- if (Shooter.ID<>Victim.ID) and (Shooter.Team<>Victim.Team) and (Shooter.Team<>5) then begin //and (Victim.Health-Damage<=0)
- ShootSpeed:=sqrt((Map.Bullets[Bullet].VelX*Map.Bullets[Bullet].VelX)+(Map.Bullets[Bullet].VelY*Map.Bullets[Bullet].VelY));
- c := Trunc(GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*(ShootSpeed/100)*1.15);
- {
- c2 := Trunc(GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*(ShootSpeed/100));
- c3 := Trunc(GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*(ShootSpeed/100)*0.9);
- }
- if (iif(Victim.Vest>0,Trunc(0.25*c),c)=Damage) then AddToPointsEventList(Shooter,'+15 Headshoot!',15);
- {
- 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);
- 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);
- }
- end;
- //Realdmg
- PlayerHealth[Victim.ID] := (PlayerHealth[Victim.ID] - dmg);
- if (PlayerHealth[Victim.ID]<1) then Result := (Victim.Health*3) else Result := (Victim.Health - (single(PlayerHealth[Victim.ID] * MaxHealth)/FullHeal));
- //if (Shooter.Human) then Players.WriteConsole('Normal dmg --- Orginal: '+inttostr(dmg)+', Precent'+inttostr(round((single(dmg)/150)*100))+'%',$D0D21D);
- //Result:=dmg;
- //if (Shooter.Human) then Players.WriteConsole('Realistic dmg --- Orginal: '+inttostr(dmg)+', Calculate: '+inttostr(Result)+', Precent: '+inttostr(trunc((single(result)/65)*100))+'%',$D0D21D);
- end;
- procedure Defiblirate();
- var i,b: byte;
- begin
- for i:=1 to 32 do if (Players[i].Active) then begin
- if (PlayerInfo[i].ClassID=2) and (Players[i].Alive) then begin
- for b:=1 to 32 do if (Players[b].Active) then begin
- 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);
- end;
- if ((Players[i].KeyCrouch) and (Players[i].KeyChangeWeap)) and (DefiblirateTime[i]<=0) then begin
- for b := 1 to 32 do if (Players[b].Active) then begin
- 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
- Players[b].Alive:=True;
- PlayerInfo[Players[b].ID].ClassID := PlayerInfo[Players[b].ID].LastClassID;
- case (PlayerInfo[Players[b].ID].ClassID) of
- 1: Players[b].WriteConsole('You come back to game as the assault, rescued by '+Players[i].Name,$D0D21D);
- 2: Players[b].WriteConsole('You come back to game as the medic, rescued by '+Players[i].Name,$D0D21D);
- 3: Players[b].WriteConsole('You come back to game as the sniper, rescued by '+Players[i].Name,$D0D21D);
- 4: Players[b].WriteConsole('You come back to game as the enginer, rescued by '+Players[i].Name,$D0D21D);
- end;
- Players[b].Move(Players[i].x,Players[i].y);
- PlayerInfo[Players[b].ID].LastX:=Players[b].X;
- DefiblirateTime[i]:=DefiblirateToNext;
- AddToPointsEventList(Players[i],'+50 Defibrillation!',50);
- end;
- end;
- end;
- end;
- end;
- end;
- procedure nova(X,Y,dir_x,dir_y,r,speed,power: single; n: word; style, id: byte);
- var angle,sine,cosine: single;
- begin
- angle:=6.28318/n;
- for n:=n downto 1 do begin
- sine:=sin(angle*n);
- cosine:=cos(angle*n);
- Map.CreateBullet(cosine*r + X, sine*r + Y,cosine*speed + dir_x,sine*speed + dir_y,power, style, Players[ID]);
- end;
- end;
- function FindPlayerForMissile(ID: byte; MaxDistance: integer; UsingRaycast: boolean): byte; //FindPlayerForMissile (SC3)
- var i: byte; X, Y, X2, Y2, CursorMaxDist, NearestDistCursor, MaxDist, Dist: single;
- begin
- X:=Players[ID].X; Y:=Players[ID].Y;
- MaxDist:=MaxDistance*MaxDistance; CursorMaxDist:=CursorMaxSearch*CursorMaxSearch;
- Result:=0;
- for i:= 1 to 32 do if (Players[i].Active) then begin
- if (Players[i].Alive) and (Players[i].Team<>Players[ID].Team) and (i<>ID) then begin
- X2:=Players[i].X; Y2:=Players[i].Y;
- if (UsingRayCast) then if Map.RayCast(X,Y-7,X2,Y2-7,false, false, true, true, 2) then continue;
- X2:=X2-Players[ID].MouseAimX; Y2:=Y2-Players[ID].MouseAimY; NearestDistCursor:=X2*X2+Y2*Y2;
- X2:=Players[i].X; Y2:=Players[i].Y;
- X2:=X2-X; Y2:=Y2-Y; Dist:=X2*X2+Y2*Y2;
- if (NearestDistCursor<CursorMaxDist) and (Dist<MaxDist) then begin
- Result:=i;
- CursorMaxDist:=NearestDistCursor;
- end;
- end;
- end;
- end;
- procedure ResetMissile(i:byte);
- begin
- Missile[i].owner_ID:=0; Missile[i].target_ID:=0;
- Missile[i].X:=0; Missile[i].Y:=0;
- Missile[i].Active:=false;
- Missile[i].poly_coll:=false; Missile[i].target_coll:=false;
- Missile[i].n:=8; Missile[i].dist:=0;
- Missile[i].X2:=0; Missile[i].Y2:=0;
- Missile[i].next_dist_x:=0; Missile[i].next_dist_y:=0;
- Missile[i].prev_dist_x:=0; Missile[i].prev_dist_y:=0;
- end;
- procedure AddAmmo(AssaultID,CustomerID,Weapon:byte);
- begin
- if (Weapon=7) or (Weapon=13) then begin
- if (PlayerInfo[CustomerID].AmmoGiven > AmmoGivenLimit) then begin
- WepAmmo[Weapon][CustomerID] := (WepAmmo[Weapon][CustomerID]+1);
- PlayerInfo[CustomerID].AmmoGiven := 0;
- end else PlayerInfo[CustomerID].AmmoGiven := (PlayerInfo[CustomerID].AmmoGiven+1);
- end else
- begin
- if (Weapon=12) then WepAmmo[Weapon][CustomerID] := (WepAmmo[Weapon][CustomerID]+SawAmmoAdd);
- if ((PlayerInfo[CustomerID].ClassID<>3) and ((Weapon=5) or (Weapon=6) or (Weapon=8))) then begin
- if (PlayerInfo[CustomerID].BarrettAmmoGiven > iif((Weapon=5) or (Weapon=6),RugerAmmoGiven,BaretAmmoGivenLimit)) then begin
- WepAmmo[Weapon][CustomerID] := (WepAmmo[Weapon][CustomerID]+1);
- PlayerInfo[CustomerID].BarrettAmmoGiven := 0;
- end else PlayerInfo[CustomerID].BarrettAmmoGiven := PlayerInfo[CustomerID].BarrettAmmoGiven+1;
- end else WepAmmo[Weapon][CustomerID] := (WepAmmo[Weapon][CustomerID]+1);
- end;
- if (AssaultID<>CustomerID) then begin
- if (PlayerInfo[AssaultID].Gives>=14) then begin
- AddToPointsEventList(Players[AssaultID],'+20 Ammo!',20);
- PlayerInfo[AssaultID].Gives := 0;
- end else if (PlayerInfo[AssaultID].Gives<14) then PlayerInfo[AssaultID].Gives := (PlayerInfo[AssaultID].Gives+1);
- end;
- end;
- procedure DisHud(i:byte);
- var b,c:byte;
- begin
- case (PlayerInfo[i].ClassID) of
- 1: begin
- if (PlayerInfo[i].Medkit>0) then begin
- PlayerInfo[i].Medkit:=(PlayerInfo[i].Medkit-1);
- Players[i].BigText(HS1,'Granadekit: '+inttostr(PlayerInfo[i].Medkit),130,$FF0000,0.055,12,415);
- end else Players[i].BigText(HS1,'Granadekit: Ready!',130,$FFB300,0.055,12,415);
- if (PlayerInfo[i].WsparcieDT>0) then begin
- PlayerInfo[i].WsparcieDT:=(PlayerInfo[i].WsparcieDT-1);
- 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);
- end else Players[i].BigText(HS2,'Support: Ready!',130,$FFB300,0.055,12,405);
- 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
- for c := 0 to 13 do if ((Players[b].Primary.WType=c) or (Players[b].Secondary.WType=c)) then begin
- if ((WepAmmo[c][b] + 1) > GetMaxAmmo(c)) then WepAmmo[c][b]:=GetMaxAmmo(c) else AddAmmo(i,b,c);
- end;
- end;
- end;
- 2: begin
- if (PlayerInfo[i].Medkit>0) then begin
- PlayerInfo[i].Medkit:=(PlayerInfo[i].Medkit-1);
- Players[i].BigText(HS1,'Medkit: '+inttostr(PlayerInfo[i].Medkit),130,$FF0000,0.055,12,415);
- end else Players[i].BigText(HS1,'Medkit: Ready!',130,$FFB300,0.055,12,415);
- 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
- if ((Players[b].Health + HealMedykHealing) > MaxHealth) then SetPlayerHealth(Players[b],MaxHealth,Players[b].Vest) else begin
- SetPlayerHealth(Players[b],(Players[b].Health+HealMedykHealing),Players[b].Vest);
- if (i<>b) then begin
- if (PlayerInfo[i].Gives>=3) then begin
- AddToPointsEventList(Players[i],'+20 Healing!',20);
- PlayerInfo[i].Gives:=0;
- end else if (PlayerInfo[i].Gives<3) then PlayerInfo[i].Gives:=(PlayerInfo[i].Gives+1);
- end;
- end;
- end;
- end;
- 3: begin
- if (PlayerInfo[i].SniperBandage>0) then begin
- PlayerInfo[i].SniperBandage:=(PlayerInfo[i].SniperBandage-1);
- if (PlayerInfo[i].SniperBandage>0) then Players[i].BigText(HS2,'Bandage: '+inttostr(PlayerInfo[i].SniperBandage),130,$FF0000,0.055,12,405);
- end else Players[i].BigText(HS2,'Bandage: Ready!',130,$FFB300,0.055,12,405);
- if (PlayerInfo[i].MozdziezT>0) then begin
- PlayerInfo[i].MozdziezT:=(PlayerInfo[i].MozdziezT-1);
- Players[i].BigText(HS1,'Mortar: '+inttostr(PlayerInfo[i].MozdziezT),130,$FF0000,0.055,12,415);
- end else Players[i].BigText(HS1,'Mortar: Ready!',130,$FFB300,0.055,12,415);
- end;
- 4: begin
- if (PlayerInfo[i].StatTime>0) then begin
- PlayerInfo[i].StatTime:=(PlayerInfo[i].StatTime-1);
- if (PlayerInfo[i].StatTime-StatCreate>0) then begin
- 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
- case (PlayerInfo[i].StatTime-StatCreate) of
- 5:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$5C8000,0.055,12,415);
- 4:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$808000,0.055,12,415);
- 3:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$805A00,0.055,12,415);
- 2:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$803A00,0.055,12,415);
- 1:Players[i].BigText(HS2,'StationaryGun: '+inttostr(PlayerInfo[i].StatTime-StatCreate),130,$B80000,0.055,12,415);
- end;
- end;
- 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;
- end else Players[i].BigText(HS2,'StationaryGun: Ready!',130,$FFB300,0.055,12,415);
- 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);
- 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
- if ((Players[b].Vest+VestEnginerRepair) > 100) then SetPlayerHealth(Players[b],Players[b].Health,100) else begin
- SetPlayerHealth(Players[b],Players[b].Health,Players[b].Vest+VestEnginerRepair);
- if (i<>b) then begin
- if (PlayerInfo[i].Gives>=3) then begin
- AddToPointsEventList(Players[i],'+35 Repair!',35);
- PlayerInfo[i].Gives:=0;
- end else if (PlayerInfo[i].Gives<3) then PlayerInfo[i].Gives:=(PlayerInfo[i].Gives+1);
- end;
- end;
- end;
- end;
- end;
- end;
- procedure DisPoints(i:byte);
- var len,b:integer;
- begin
- if (Players[i].Team<>5) then begin
- len := getarraylength(PointsEvents[i]);
- if (len=0) then Players[i].BigText(HP,'Points: '+inttostr(PlayerInfo[i].Points),200,$F15D70,0.055,12,425) else begin
- Players[i].BigText(HP,'Points: '+inttostr(PlayerInfo[i].Points)+PointsEvents[i][0],200,$F15D70,0.055,12,425);
- if (len=1) then begin
- SetArrayLength(PointsEvents[i],0);
- exit;
- end else
- begin
- for b := 1 to (len-1) do PointsEvents[i][b-1] := PointsEvents[i][b];
- SetArrayLength(PointsEvents[i],len-1);
- end;
- end;
- end;
- end;
- procedure ComboAppi(i:byte);
- begin
- if (Combo[i].T > 0) then Combo[i].T:=(Combo[i].T-1);
- if (Combo[i].T = 0) then begin
- case (Combo[i].H) of
- 2: AddToPointsEventList(Players[i],'+20 DoubleKill!',20);
- 3: AddToPointsEventList(Players[i],'+30 TripleKill!',30);
- 4: AddToPointsEventList(Players[i],'+50 MultiKill!',50);
- 5: AddToPointsEventList(Players[i],'+100 MultiKill [x2]!',100);
- end;
- if (Combo[i].H>=6) then AddToPointsEventList(Players[i],'+200 SerialKill!',200);
- Combo[i].H := 0;
- end;
- end;
- procedure MissileModule(Ticks:integer);
- var i:byte;
- begin
- for i := 1 to 32 do if (Missile[i].Active = true) then begin
- 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);
- if ((Ticks mod 9) = 0) then if (missile[i].n>1) then Missile[i].n := Missile[i].n-1; //szybkosc
- if ((Ticks mod Missile[i].n) = 0) then begin
- //Dane obliczenia
- Missile[i].X2:=Players[Missile[i].Target_ID].X; Missile[i].Y2:=Players[Missile[i].Target_ID].Y;
- Missile[i].Dist := Distance(Missile[i].X, Missile[i].Y, Missile[i].X2, Missile[i].Y2);
- Missile[i].Next_Dist_X := (Missile[i].X2-Missile[i].X)/(Missile[i].Dist/10);
- Missile[i].Next_Dist_Y := (Missile[i].Y2-Missile[i].Y)/(Missile[i].Dist/10);
- Missile[i].X := Missile[i].X + Missile[i].Next_Dist_X;
- Missile[i].Y := Missile[i].Y + Missile[i].Next_Dist_Y;
- Missile[i].prev_dist_x:=Missile[i].Next_Dist_X;
- Missile[i].prev_dist_y:=Missile[i].Next_Dist_Y;
- Missile[i].Next_Dist_X:=((((Missile[i].X2-Missile[i].X)/(Missile[i].Dist/100))+(Missile[i].prev_dist_x*40)) / 65);
- Missile[i].Next_Dist_Y:=((((Missile[i].Y2-Missile[i].Y)/(Missile[i].Dist/100))+(Missile[i].prev_dist_y*40)) / 65); //gestosc plomieni
- Missile[i].prev_dist_x:=Missile[i].Next_Dist_X;
- Missile[i].prev_dist_y:=Missile[i].Next_Dist_Y;
- Missile[i].X:=Missile[i].X + Missile[i].Next_Dist_X;
- Missile[i].Y:=Missile[i].Y + Missile[i].Next_Dist_Y;
- Missile[i].X2:=Players[Missile[i].Target_ID].X; Missile[i].Y2:=Players[Missile[i].Target_ID].Y;
- Missile[i].Dist := Distance(Missile[i].X,Missile[i].Y,Missile[i].X2,Missile[i].Y2);
- if (Missile[i].Dist > 80) then begin
- 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
- 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
- end;
- if (Missile[i].Dist < 5) then begin //3
- Missile[i].target_coll := true;
- end else if Map.RayCast(Missile[i].X, Missile[i].Y, Missile[i].X, Missile[i].Y, false, false, true, true, 2) then begin
- Missile[i].poly_coll := true;
- end;
- end;
- 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]);
- if ((Ticks mod Missile[i].n) = 0) then begin
- if (Missile[i].target_coll) then begin
- Players[Missile[i].Target_ID].Damage(Missile[i].owner_ID, Players[Missile[i].Target_ID].Health-1);
- 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);
- nova(Missile[i].X2,Missile[i].Y2,0,0,30,8,2,9,14,Missile[i].owner_ID);
- nova(Missile[i].X2,Missile[i].Y2,0,0,12,-3,10,5,4,Missile[i].owner_ID);
- Missile[i].Active := false;
- if (PlayerInfo[Missile[i].owner_ID].RocketAmmo<=0) then PlayerInfo[Missile[i].owner_ID].RocketType:=1;
- ResetMissile(i);
- end else if (Missile[i].poly_coll) then begin
- 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);
- nova(Missile[i].X,Missile[i].Y,0,0,20,-3,10,4,4,Missile[i].owner_ID);
- if (PlayerInfo[Missile[i].owner_ID].RocketAmmo<=0) then PlayerInfo[Missile[i].owner_ID].RocketType:=1;
- ResetMissile(i);
- end;
- end;
- end;
- end;
- procedure WeaponsModule(i:byte);
- var lastteam, full: byte; LastHP, LastVest, tempx, tempy, lastgetx, lastgety: single; Punch: TNewWeapon;
- begin
- if (PlayerInfo[i].GetsW>-1) then begin
- 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;
- Players[i].WorldText(AW,'Dont move '+Inttostr(PlayerInfo[i].GetsW)+'!',135,$CC0000,0.055,tempx-iif(PlayerInfo[i].GetsW<10,41,46),tempy);
- if (PlayerInfo[i].GetsW=0) then begin
- PlayerInfo[i].CanReset:=false;
- LastTeam := Players[i].Team; LastGetX := Players[i].X; LastGetY := Players[i].Y; LastHP := Players[i].Health; LastVest := Players[i].Vest;
- Punch:=TNewWeapon.Create(); Punch.WType:=255; Players[i].ForceWeapon(Punch,Players[i].Secondary); Punch.Free();
- Players[i].Team := 5; Players[i].Team := Lastteam;
- SetPlayerHealth(Players[i],LastHP,LastVest); Players[i].Move(lastgetx,lastgety);
- PlayerInfo[i].LastX:=Players[i].X; PlayerInfo[i].Resp:=true;
- PlayerInfo[i].CanReset:=true;
- PlayerInfo[i].CanGetWeapon:=false;
- end;
- if (PlayerInfo[i].GetsW<>-1) then PlayerInfo[i].GetsW:=(PlayerInfo[i].GetsW-1);
- end;
- if (PlayerInfo[i].GetsA>-1) then begin
- 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;
- Players[i].WorldText(AW,'Dont move '+Inttostr(PlayerInfo[i].GetsA)+'!',135,$CC0000,0.055,tempx-iif(PlayerInfo[i].GetsA<10,41,46),tempy);
- if (CheckPlayerWeapons(Players[i],1)) then begin
- full:=0;
- if (w1<>255) then begin
- if (WepAmmo[w1][i]>=GetMaxAmmo(w1)) then full:=full+1;
- end;
- if (w2<>255) then begin
- if(WepAmmo[w2][i]>=GetMaxAmmo(w2)) then full:=full+1;
- end;
- if (full=2) then begin
- PlayerInfo[i].GetsA:=-1;
- Players[i].WriteConsole('Stopped waiting for ammunition, you have a full magazines.',$D0D21D);
- end;
- if (PlayerInfo[i].GetsA=0) then begin
- if (w1<>255) then begin
- if (WepAmmo[w1][i]<GetMaxAmmo(w1)) then begin
- WepAmmo[w1][i]:=GetMaxAmmo(w1);
- PlayerInfo[i].CanGetAmmo:=false;
- Players[i].WriteConsole('Was obtained ammo to: '+GetWeaponName(w1),$D0D21D);
- end;
- end;
- if (w2<>255) then begin
- if (WepAmmo[w2][i]<GetMaxAmmo(w2)) then begin
- WepAmmo[w2][i]:=GetMaxAmmo(w2);
- PlayerInfo[i].CanGetAmmo:=false;
- Players[i].WriteConsole('Was obtained ammo to: '+GetWeaponName(w2),$D0D21D);
- end;
- end;
- end;
- end;
- if (PlayerInfo[i].GetsA<>-1) then PlayerInfo[i].GetsA:=(PlayerInfo[i].GetsA-1);
- end;
- end;
- procedure WeaponModuleDis(i:byte);
- var tempx, tempy: single;
- begin
- 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;
- if (Distance(Players[i].X,Players[i].Y,TempX,TempY)<=43) then begin
- 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);
- 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);
- end else
- begin
- if (PlayerInfo[i].GetsW>-1) then begin
- PlayerInfo[i].GetsW:=-1;
- Players[i].WriteConsole('Aborted importation weapons - dont move.',$D0D21D);
- end;
- if (PlayerInfo[i].GetsA>-1) then begin
- PlayerInfo[i].GetsA:=-1;
- Players[i].WriteConsole('Aborted importation ammunition - dont move.',$D0D21D);
- end;
- end;
- end;
- procedure AppOnIdleSC3(Ticks: integer);
- var i,b: byte; ReloadWep: TNewWeapon; fastkd:single;
- begin
- ShootKeyCheck();
- AmmoDisplay(Ticks);
- Defiblirate();
- for i:= 1 to 32 do if (Players[i].Active) then begin
- if (DefiblirateTime[i]>0) then DefiblirateTime[i]:=(DefiblirateTime[i]-1);
- if (Players[i].Team<5) then begin
- fastkd:=((PlayerHealth[i]/FullHeal)*100.0);
- 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));
- 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));
- end;
- if (PlayerInfo[i].Resp) and (Players[i].Human) then begin
- if (PlayerInfo[i].TimerOnSpawn<5) then begin
- PlayerInfo[i].TimerOnSpawn:=(PlayerInfo[i].TimerOnSpawn+1);
- Players[i].Move(PlayerInfo[i].LastX,Players[i].Y);
- end;
- if (Players[i].X > PlayerInfo[i].LastX+5) or (Players[i].X < PlayerInfo[i].LastX-5) then begin
- PlayerInfo[i].Resp:=false;
- WeaponAmmoChangeLimit(i);
- end;
- end;
- end;
- for i := 1 to 32 do if (Players[i].Active) then if (PlayerInfo[i].ClassID=4) then begin
- if ((Players[i].KeyCrouch) or (Players[i].IsProne)) and (Players[i].KeyShoot) and (Missile[i].Active=false) then begin
- 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
- b := FindPlayerForMissile(i,700,true);
- if (b>0) then begin
- Players.WorldText(b+WT,'[Traced]',75,$FF0000,0.065,Players[b].X-30,Players[b].Y-22);
- if (PlayerInfo[i].ShootMis=16) then begin
- PlayerInfo[i].RocketAmmo:=(PlayerInfo[i].RocketAmmo-1);
- Missile[i].owner_ID:=i; Missile[i].target_ID:=b;
- Missile[i].X:=Players[i].X;
- Missile[i].Y:=Players[i].Y-8;
- Missile[i].Active:=true;
- ReloadWep := TNewWeapon.Create();
- try
- ReloadWep.WType := 13;
- ReloadWep.Ammo := 0;
- Players[i].ForceWeapon(ReloadWep,Players[i].Secondary)
- finally
- ReloadWep.Free();
- end;
- AddToPointsEventList(Players[i],'+20 Rocket!',20);
- end else PlayerInfo[i].ShootMis:=(PlayerInfo[i].ShootMis+1);
- end;
- end;
- end else PlayerInfo[i].ShootMis:=0;
- end;
- if (isCompile=false) then begin
- isCompile := True;
- FlagX[1] := round(Map.RedFlag.X); FlagY[1] := round(Map.RedFlag.Y);
- flagX[2] := round(Map.BlueFlag.X); FlagY[2] := round(Map.BlueFlag.Y);
- end;
- MissileModule(Ticks);
- if ((Ticks mod 18) = 0) then begin
- for i := 1 to 32 do if (Mozdziez[i].Active=true) then begin
- if (Mozdziez[i].Shoots>0) then begin
- 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]);
- Players.WorldText(Players[i].ID+WM,'+--=== MORTARS ===--+',135,$CC0000,0.055,Mozdziez[i].X-65,Mozdziez[i].R);
- Mozdziez[i].Shoots:=(Mozdziez[i].Shoots-1);
- end else Mozdziez[i].Active:=false;
- end;
- for i := 1 to 32 do if (Players[i].Active) then WeaponModuleDis(i);
- end;
- if ((Ticks mod 63) = 0) then for i := 1 to 32 do if (Players[i].Active) then ComboAppi(i);
- if ((Ticks mod 50) = 0) then for i := 1 to 32 do if (Players[i].Active) then if (PlayerInfo[i].NumDisp < MaxDispLowAmmo) then begin
- PlayerInfo[i].NumDisp := PlayerInfo[i].NumDisp+1;
- 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;
- end;
- if ((Ticks mod 60) = 0) then begin
- for i := 1 to 32 do if (Players[i].Active) then begin
- DisHud(i);
- if (Ttimer[i]>0) then begin
- Ttimer[i]:=(Ttimer[i]-1);
- if (Ttimer[i]=0) then atc[i]:=0;
- end;
- 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);
- if (((Players[i].Health*100)/MaxHealth) > ((100-TotalPercentDamageRecieved(i)))) then RemoveDamageDoneBy(i,((Players[i].Health*100)/MaxHealth) - (100-TotalPercentDamageRecieved(i)));
- WeaponsModule(i);
- end;
- end;
- if ((Ticks mod 120) = 0) then begin
- for i := 1 to 32 do if (Players[i].Active) then DisPoints(i);
- end;
- end;
- procedure GrabFlag(Player: TActivePlayer; Flag: TActiveFlag; Team: Byte; GrabbedInBase: Boolean);
- begin
- if (GrabbedInBase) then begin
- AddToPointsEventList(Player,'+80 Flag Grab!',80);
- flaggrabed[Flag.Style]:=true;
- end;
- end;
- procedure FlagScore(Player: TActivePlayer; Flag: TActiveFlag; Team: Byte);
- begin AddToPointsEventList(Player,'+250 Flag Score!',250); flaggrabed[Flag.Style]:=false; end;
- procedure FlagReturn(Player: TActivePlayer; Flag: TActiveFlag; Team: Byte);
- begin if ((flaggrabed[1]) or (flaggrabed[2])) then begin AddToPointsEventList(Player,'+50 Flag Return!',50); flaggrabed[Flag.Style]:=false; end end;
- procedure LeaveGame(Player: TActivePlayer; Kicked: Boolean);
- var i:byte;
- begin
- ResVar(Player.ID,false);
- for i := 1 to 32 do begin
- if (Players[i].Active) then begin
- if (PlayersInfoArr[i].DamageRecievedByID[Player.ID] <> 0) then begin
- PlayersInfoArr[i].DamageRecievedByID[33] := (PlayersInfoArr[i].DamageRecievedByID[33] + PlayersInfoArr[i].DamageRecievedByID[Player.ID]);
- PlayersInfoArr[i].DamageRecievedByID[Player.ID] := 0;
- end;
- end;
- end;
- for i := 1 to 33 do PlayersInfoArr[Player.ID].DamageRecievedByID[i] := 0;
- PlayersInfoArr[Player.ID].KilledBy := 0;
- PlayerInfo[Player.ID].Points:=0;
- PlayerInfo[Player.ID].DeadX:=-0.3333330022255559991;
- PlayerInfo[Player.ID].DeadY:=-0.3333330022255559991;
- end;
- procedure ChangeBefore(Next: string);
- var i:byte;
- begin
- change:=true;
- for i := 1 to 32 do if (Players[i].Active) then begin
- DisPlayPointsList(Players[i]);
- PlayerInfo[i].Points:=0;
- end;
- end;
- procedure ChangeAfter(Next: string);
- var i: byte;
- begin
- for i := 1 to 32 do if (Players[i].Active) and (Players[i].Team<>5) then begin
- ResVar(i,false);
- ClassSet(i, true);
- PokazKim(Players[i]);
- end;
- change:=false;
- firstBlood := 1;
- for i := 1 to 254 do begin
- if (Map.Spawns[i].Style=7) then Map.Spawns[i].Active := false;
- if (Map.Spawns[i].Style=8) then Map.Spawns[i].Active := false;
- end;
- for i := 1 to 90 do begin
- if (Map.Objects[i].Style=16) then Map.Objects[i].Kill;
- if (Map.Objects[i].Style=17) then Map.Objects[i].Kill;
- end;
- for i := 1 to 2 do flaggrabed[i]:=false;
- if (isCompile=true) then begin
- FlagX[1] := round(Map.RedFlag.X); FlagY[1] := round(Map.RedFlag.Y);
- flagX[2] := round(Map.BlueFlag.X); FlagY[2] := round(Map.BlueFlag.Y);
- end;
- end;
- procedure KillKit(Player: TActivePlayer; Kit: TActiveMapObject);
- var i:byte;
- begin
- Player.Damage(Player.id,-1185);
- for i := 1 to 32 do if (Players[i].Active) then if (PlayerInfo[i].SpawnedID=Kit.id) and (i<>Player.ID) then begin
- if (Player.Team=Players[i].Team) then begin
- if (Kit.Style=16) then AddToPointsEventList(players[i],'+50 Friends use medkit!',50);
- if (Kit.Style=17) then AddToPointsEventList(players[i],'+50 Friends use granadekit!',50);
- end else
- begin
- if (Kit.Style=16) then AddToPointsEventList(players[i],'-25 Enemy use medkit!',-25);
- if (Kit.Style=17) then AddToPointsEventList(players[i],'-25 Enemy use granadekit!',-25);
- end;
- end;
- Kit.kill;
- end;
- procedure JoinGame(Player: TActivePlayer; Team: TTeam);
- var i: byte;
- begin
- PlayersInfoArr[Player.ID].KilledBy := 0;
- for i := 1 to 33 do begin
- PlayersInfoArr[Player.ID].DamageRecievedByID[i] := 0;
- PlayersInfoArr[Player.ID].DamageRecievedByCooldown[i] := 0;
- end;
- end;
- Procedure JoinTeam(Player: TActivePlayer; Team: TTeam);
- begin
- PlayerInfo[Player.ID].LastX:=Player.X;
- PlayerInfo[Player.ID].TimerOnSpawn:=0;
- PlayerInfo[Player.ID].Resp:=True;
- if (Team.ID=5) and (Player.Human) then begin
- 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);
- 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);
- end;
- if (PlayerInfo[Player.ID].CanReset) then begin
- ResVar(Player.ID,false);
- if (Team.ID<>5) then begin
- ClassSet(Player.ID, true);
- PokazKim(Player);
- end;
- end else ClassSet(Player.ID, false);
- end;
- procedure OnAfterRespawn(Player: TActivePlayer);
- var i,c:byte; Dist,NewDist:single;
- begin
- PlayerHealth[Player.ID]:=FullHeal;
- PlayerInfo[Player.ID].LastX:=Player.X;
- PlayerInfo[Player.ID].TimerOnSpawn:=0;
- PlayerInfo[Player.ID].Resp:=True;
- Player.GiveBonus(3);
- if (PlayerInfo[Player.ID].ClassID=1) then Player.GiveBonus(5);
- Player.BigText(HK,'',1,$D0D21D,0.112,20,360);
- if (change) then PokazKim(Player); c:=255; Dist:=WsparcieDist;
- for i := 1 to 32 do if (Players[i].Active) then begin //Assault Wsparcie
- if (PlayerInfo[i].ClassID = 1) and (Players[i].Alive) and (PlayerInfo[i].WsparcieDT-WC>0) and (Player.Team=Players[i].Team) then begin
- if (PlayerInfo[Player.ID].DeadX<>-0.3333330022255559991) and (PlayerInfo[Player.ID].DeadY<>-0.3333330022255559991) then begin
- NewDist:=Distance(PlayerInfo[Player.ID].DeadX,PlayerInfo[Player.ID].DeadY,Players[i].X,Players[i].Y);
- if (NewDist<=WsparcieDist) and (NewDist<Dist) then begin
- Dist := NewDist; c := i;
- end;
- end;
- end;
- end;
- if (c<>255) then begin
- Player.Move(Players[c].X,Players[c].Y);
- PlayerInfo[Player.ID].LastX:=Players[c].X;
- AddToPointsEventList(Players[c],'+25 Team Respawn!',25);
- end;
- end;
- initialization
- begin
- Game.TickThreshold := 1;
- isCompile:=false;
- for Decl := 1 to 32 do begin
- Players[Decl].OnCommand := @Commands;
- Players[Decl].OnAfterRespawn := @OnAfterRespawn;
- Players[Decl].OnDamage := @HeadShootKill;
- Players[Decl].OnKitPickup := @KillKit;
- Players[Decl].OnFlagScore := @FlagScore;
- Players[Decl].OnKill := @OnKill;
- Players[Decl].OnSpeak := @Speak;
- Players[Decl].OnFlagGrab := @GrabFlag;
- Players[Decl].OnFlagReturn := @FlagReturn;
- end;
- for Decl := 1 to 5 do Game.Teams[Decl].OnJoin := @JoinTeam;
- Game.OnJoin := @JoinGame;
- Game.OnLeave := @LeaveGame;
- Map.OnAfterMapChange := @ChangeAfter;
- Map.OnBeforeMapChange := @ChangeBefore;
- Game.OnClockTick := @AppOnIdleSC3;
- //CODE
- if (Game.Realistic=True) then MaxHealth := 65 else MaxHealth := 150;
- for ab := 1 to 90 do if (Map.Objects[ab].Active) then if (Map.Objects[ab].Style=27) then Map.Objects[ab].Kill;
- for ab := 1 to 32 do begin
- for ai := 1 to 32 do ResetMissile(ai);
- ResVar(ab,true);
- PlayerInfo[ab].DeadX:=-0.3333330022255559991;
- PlayerInfo[ab].DeadY:=-0.3333330022255559991;
- if (Players[ab].Active) and (Players[ab].Team<>5) then begin
- ai:=RandomClass(ab);
- PlayerInfo[ab].ClassID := ai;
- PokazKim(Players[ab]);
- end;
- end;
- change:=false;
- firstBlood := 1;
- end;
- finalization;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement