i use special bot this is the code :
when i start the server and i add the bot all bot is normal the code is correcly ?
const
CLASSES = 7; //how many bot classes you want
type
SBot = Record
BName : string;
BHealth : integer;
BHPReg : integer;
BRegLim : boolean;
BShowHP : boolean;
BHColor : longint;
BWeapon : byte;
BBonus : byte;
BBonT : integer;
BDamage : integer;
BWaveVal: byte;
BWaveStl: byte;
BWaveSpd: integer;
end;
var
TheBot: array[0..CLASSES] of SBot;
IGB: array[1..32] of SBot;
BotHpLeft: array[1..32] of integer;
//********************************************************************
procedure ActivateServer();
begin
begin //COPY THIS PIECE TO CREATE NEW BOT
TheBot[1].BName := 'Kamikaze'; //bot name
TheBot[1].BHealth := 100; //bot health (150- normal, 65- realistic)
TheBot[1].BHPReg := 0; //health regeneration per second(0 to disable)
TheBot[1].BRegLim := false; //regeneration limited to max health(true/false)(it will stop anyway at 65000 to avoid crash)
TheBot[1].BShowHP := false; //show bot hp (true/false)
TheBot[1].BHColor := $FFFF00; //color of hp
TheBot[1].BWeapon := 20; //bot weapon (255 to random)
TheBot[1].BBonus := 255; //bonus given to bot (255 to turn off)
TheBot[1].BBonT := 0; //time to give bonus (60 - 1 sec)(0 to give bonus only at respawn)
TheBot[1].BDamage := 1; //damage multiplier(1 to normal damage)
//
TheBot[1].BWaveVal:= 15; //how many bullets in on death wave(0 to turn off)
TheBot[1].BWaveStl:= 4; //style of bullets in wave
TheBot[1].BWaveSpd:= 25; //max speed of bullets in wave(speed is random value from -maxspeed to maxspeed)
end;
begin
TheBot[9].BName := 'Slicer zombie';
TheBot[9].BHealth := 200;
TheBot[9].BHPReg := 10;
TheBot[9].BRegLim := false;
TheBot[9].BShowHP := false;
TheBot[9].BHColor := $00ff00;
TheBot[9].BWeapon := 14;
TheBot[9].BBonus := 255;
TheBot[9].BBonT := 0;
TheBot[9].BDamage := 5;
TheBot[9].BWaveVal:= 3;
TheBot[9].BWaveStl:= 13;
TheBot[9].BWaveSpd:= 30;
end;
begin
TheBot[3].BName := 'Ghost';
TheBot[3].BHealth := 300;
TheBot[3].BHPReg := 2;
TheBot[3].BRegLim := true;
TheBot[3].BShowHP := true;
TheBot[3].BHColor := $FF0000;
TheBot[3].BWeapon := 15;
TheBot[3].BBonus := 1;
TheBot[3].BBonT := 300;
TheBot[3].BDamage := 2;
TheBot[3].BWaveVal:= 0;
TheBot[3].BWaveStl:= 0;
TheBot[3].BWaveSpd:= 0;
end;
begin
TheBot[4].BName := 'Taliban';
TheBot[4].BHealth := 250;
TheBot[4].BHPReg := 0;
TheBot[4].BRegLim := false;
TheBot[4].BShowHP := true;
TheBot[4].BHColor := $FF0000;
TheBot[4].BWeapon := 15;
TheBot[4].BBonus := 0;
TheBot[4].BBonT := 0;
TheBot[4].BDamage := 1;
TheBot[4].BWaveVal:= 0;
TheBot[4].BWaveStl:= 0;
TheBot[4].BWaveSpd:= 0;
end;
begin
TheBot[5].BName := 'Serker Zombie';
TheBot[5].BHealth := 1000;
TheBot[5].BHPReg := 0;
TheBot[5].BRegLim := false;
TheBot[5].BShowHP := true;
TheBot[5].BHColor := $FF0000;
TheBot[5].BWeapon := 15;
TheBot[5].BBonus := 2;
TheBot[5].BBonT := 300;
TheBot[5].BDamage := 15;
TheBot[5].BWaveVal:= 20;
TheBot[5].BWaveStl:= 7;
TheBot[5].BWaveSpd:= 7;
end;
begin
TheBot[6].BName := 'Zombie';
TheBot[6].BHealth := 200;
TheBot[6].BHPReg := 0;
TheBot[6].BRegLim := false;
TheBot[6].BShowHP := true;
TheBot[6].BHColor := $FF0000;
TheBot[6].BWeapon := 15;
TheBot[6].BBonus := 255;
TheBot[6].BBonT := 0;
TheBot[6].BDamage := 1;
TheBot[6].BWaveVal:= 0;
TheBot[6].BWaveStl:= 0;
TheBot[6].BWaveSpd:= 0;
end;
begin
TheBot[2].BName := 'Burning Zombie';
TheBot[2].BHealth := 400;
TheBot[2].BHPReg := 0;
TheBot[2].BRegLim := false;
TheBot[2].BShowHP := true;
TheBot[2].BHColor := $FF0000;
TheBot[2].BWeapon := 15;
TheBot[2].BBonus := 255;
TheBot[2].BBonT := 0;
TheBot[2].BDamage := 2;
TheBot[2].BWaveVal:= 30;
TheBot[2].BWaveStl:= 5;
TheBot[2].BWaveSpd:= 8;
end;
//THIS SET WILL BE GIVEN TO ANY OTHER BOT & TO ALL PLAYERS
begin
TheBot[0].BName := '';
TheBot[0].BHealth := 0;
TheBot[0].BHPReg := 0;
TheBot[0].BRegLim := false;
TheBot[0].BShowHP := false;
TheBot[0].BHColor := $000000;
TheBot[0].BWeapon := 255;
TheBot[0].BBonus := 255;
TheBot[0].BBonT := 0;
TheBot[0].BDamage := 1;
TheBot[0].BWaveVal:= 0;
TheBot[0].BWaveStl:= 0;
TheBot[0].BWaveSpd:= 0;
end;
end;
//********************************************************************
procedure Explode(Target: byte);
var i: byte;
begin
for i:= 1 to IGB[Target].BWaveVal do CreateBullet(GetPlayerStat(Target,'X'),GetPlayerStat(Target,'Y'),Random(IGB[Target].BWaveSpd, -(IGB[Target].BWaveSpd)),Random(IGB[Target].BWaveSpd, -(IGB[Target].BWaveSpd)), 100, IGB[Target].BWaveStl, Target);
end;
procedure ShowHP(Target,Shooter: byte);
begin
DrawText(Shooter, IntToStr(BotHpLeft[Target]), 180, IGB[Target].BHColor, 0.1, 260, 350);
end;
function Assignable(ID: byte): boolean;
var i: byte;
begin
result:= false;
for i:= 1 to CLASSES do if IDToName(ID) = TheBot.BName then result:= true;
if GetPlayerStat(ID,'Human') = true then result:= false;
end;
procedure Assign(ID: Byte);
var i: byte;
begin
for i:= 1 to CLASSES do if IDToName(ID) = TheBot.BName then begin
IGB[ID] := TheBot;
end;
if not Assignable(ID) then IGB[ID]:= TheBot[0];
end;
procedure Regenerate(ID: byte);
begin
if IGB[ID].BRegLim then begin
if (IGB[ID].BHealth - BotHpLeft[ID]) < IGB[ID].BHPReg then BotHpLeft[ID]:= BotHpLeft[ID] + (IGB[ID].BHealth - BotHpLeft[ID]);
if (IGB[ID].BHealth - BotHpLeft[ID]) >= IGB[ID].BHPReg then BotHpLeft[ID]:= BotHpLeft[ID] + IGB[ID].BHPReg;
end else if BotHpLeft[ID] < 65000 then BotHpLeft[ID]:= BotHpLeft[ID] + IGB[ID].BHealth;
end;
//********************************************************************
procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
begin
if Assignable(Victim) then if IGB[Victim].BWaveVal > 0 then Explode(Victim);
end;
procedure AppOnIdle(Ticks: integer);
var i: byte;
begin
// AllHealth;
for i:= 1 to 32 do if Assignable(i) then begin
if (IGB.BBonT >= 60) and (IGB.BBonus <> 255) then if Ticks mod IGB.BBonT = 0 then GiveBonus(i, IGB.BBonus);
if IGB.BWeapon <> 255 then if (GetPlayerStat(i, 'Primary') <> IGB.BWeapon) or (GetPlayerStat(i, 'Secondary') <> 255) then ForceWeapon(i, IGB.BWeapon, 255, 0);
if (IGB.BHPReg <> 0) and (GetPlayerStat(i,'Alive')= true) then Regenerate(i);
end;
end;
procedure OnPlayerRespawn(ID: Byte);
begin
if Assignable(ID) then if IDToName(ID) <> IGB[ID].BName then Assign(ID);
if Assignable(ID) then begin
if IGB[ID].BBonus <> 255 then GiveBonus(ID, IGB[ID].BBonus);
if IGB[ID].BWeapon <> 255 then ForceWeapon(ID, IGB[ID].BWeapon, 255, 0);
BotHpLeft[ID]:= IGB[ID].BHealth;
end;
end;
function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer) : integer;
begin
Result:= Damage;
if Assignable(Victim) then if IGB[Victim].BShowHP then ShowHP(Victim, Shooter);
if Assignable(Shooter) then if IGB[Shooter].BDamage <> 1 then Result:= Damage*IGB[Shooter].BDamage;
if Assignable(Victim) then if BotHpLeft[Victim] > 0 then begin
Result:= -99999;
if Damage < 5000 then dec(BotHpLeft[Victim],Damage) else dec(BotHpLeft[Victim],Round(Damage/75));
if BotHpLeft[Victim] < 1 then DoDamageBy(Victim,Shooter,200);
end;
end;
//********************************************************************