0 Members and 1 Guest are viewing this topic.
const classes = 1; // Set this to the numbers of bots you want to usetype Bots = record health, healthleft, output, input, bonus, bonustimer, bonuscool, reg, regtimer, regcool: integer; name: string; showhealth: boolean; weapon: byte; healthcolor: longint; end;var Bot: Array [1..32] of Bots; createbot: array [0..classes] of Bots;procedure ActivateServer();begin // This will be given to any players! createbot[0].name := ''; createbot[0].health := 0; createbot[0].weapon := 255; createbot[0].output := 10000; createbot[0].input := 10000; createbot[0].bonus := 0; createbot[0].bonustimer := 0; createbot[0].reg := 0; createbot[0].regtimer := 0; createbot[0].showhealth := False; createbot[0].healthcolor := $FFFFFF; createbot[1].name := 'you cant see me'; // The Name of the Bot createbot[1].health := 800; // The Health of the Bot ( 150 in normal, 65 in realistic game mode) createbot[1].weapon := 255; // The Weapon the Bot will carry createbot[1].output := 10000; // Damage Increase in 100.00% createbot[1].input := 10000; // Damage Decrease in 100.00% createbot[1].bonus := 1; // Bonus the Bot will gain ( 1 Predator; 2 Berserker; 3 Vest; 4 Nades; 5 Cluster Nades; createbot[1].bonustimer := 20; // The interval (seconds) in which the bot will gain the bonus; granted automaticly on respawn. createbot[1].reg := 8; // Health the Bot will regenerate (0 to disable regeneration!) createbot[1].regtimer := 1; // The regeneration rate in seconds (0 to disable regeneration!) createbot[1].showhealth := True; // True to display the health to the shooter, false to disable it createbot[1].healthcolor := $F3F8F6; // The color the health will shown when showhealth is trueend;function str(value: variant): string;begin case VarType(value) of 3: Result := IntToStr(value); 5, 17: Result := FloatToStr(value); 256: Result := value; end;end;function Assignable(ID: byte): boolean;var i: byte;begin Result := False; for i := 1 to classes do begin if GetPlayerStat(ID,'Human') = False then begin if IDToName(ID) = createbot[i].name then begin Result := True; end; end; end;end;procedure Assign(ID: Byte);var i: byte;begin if Assignable(ID) then begin for i := 1 to classes do begin if IDToName(ID) = createbot[i].name then begin Bot[ID] := createbot[i]; end; end; end else Bot[ID] := createbot[0];end;procedure DisplayHealth(Victim, Shooter: byte);begin if Bot[Victim].showhealth then begin DrawText(Shooter, str(Bot[Victim].healthleft) + ' Health', 200, Bot[Victim].healthcolor, 0.08, 260, 350); end;end;procedure Regenerate(ID: byte);begin if Bot[ID].healthleft > 0 then begin Bot[ID].healthleft := Bot[ID].healthleft + Bot[ID].reg; if Bot[ID].healthleft > Bot[ID].health then begin Bot[ID].healthleft := Bot[ID].health; end; end;end;procedure DamageBot(Victim, Shooter: byte; Damage: integer);begin if Bot[Victim].healthleft > 0 then begin if Damage < 5000 then begin Bot[Victim].healthleft := Bot[Victim].healthleft - Damage; end else begin Bot[Victim].healthleft := Bot[Victim].healthleft - Round(Damage / 75); end; if Bot[Victim].healthleft < 1 then begin DoDamageBy(Victim, Shooter, 200); end; end;end;procedure AppOnIdle(Ticks: integer);var i: byte;begin for i := 1 to 32 do begin if Assignable(i) then begin // Bonus Stuff if ((Bot[i].bonus <> 0) and (Bot[i].bonus <> 255) and (Bot[i].bonustimer <> 0)) then begin if Bot[i].bonuscool > 0 then begin Bot[i].bonuscool := Bot[i].bonuscool - 1; end else begin Bot[i].bonuscool := Bot[i].bonustimer - 1; GiveBonus(i,Bot[i].bonus); end; end; // Weapon Stuff if Bot[i].Weapon <> 255 then begin if GetPlayerStat(i,'Primary') <> Bot[i].Weapon then begin ForceWeapon(i,Bot[i].Weapon,0,0); end; end; // Regeneration Stuff if ((Bot[i].reg > 0) and (Bot[i].regtimer > 0) and (Bot[i].healthleft > 0) and (Bot[i].healthleft < Bot[i].health)) then begin if Bot[i].regcool > 0 then begin Bot[i].regcool := Bot[i].regcool - 1; end else begin Bot[i].regcool := Bot[i].regtimer - 1; Regenerate(i); end; end; end; end;end;procedure OnPlayerRespawn(ID: Byte);begin if Assignable(ID) then begin // Check if the bot is already assigned if IDToName(ID) <> Bot[ID].name then begin Assign(ID); end; // Check if the bot has bonus enabled and give him 1 second after respawn if ((Bot[ID].Bonus <> 255) and (Bot[ID].Bonus <> 0)) then begin Bot[ID].bonustimer := 1; Bot[ID].regcool := Bot[ID].regtimer; end; // Check if the bot carries the right weapon if Bot[ID].Weapon <> 255 then begin if GetPlayerStat(ID,'Primary') <> Bot[ID].weapon then begin ForceWeapon(ID, Bot[ID].weapon, 255, 0); end; end; end;end;function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;var dmg: integer;begin Result := Damage; if ((Assignable(Shooter)) and (Assignable(Victim))) then begin dmg := Round(Damage * Bot[Victim].input * Bot[Shooter].output / 100000000); DamageBot(Victim,Shooter,dmg); Result := -Damage; exit; end else begin if ((not Assignable(Shooter)) and (Assignable(Victim))) then begin dmg := Round(Damage * Bot[Victim].input / 10000); DamageBot(Victim,Shooter,dmg); DisplayHealth(Shooter, Victim); Result := -Damage; exit; end else begin if ((Assignable(Shooter)) and (not Assignable(Victim))) then begin dmg := Round(Damage * Bot[Shooter].output / 10000); Result := dmg; exit; end else begin if ((not Assignable(Shooter)) and (not Assignable(Victim))) then begin Result := Damage; exit; end; end; end; end;end;
function IntToFloat(Num: integer): single;beginresult := strtofloat(inttostr(num));end;result := round(inttofloat(damage)*(150/inttofloat(+sbot[victim].maxhealth)));
function CharMultiply(char: string; times: variant): string;var u: integer;beginresult := '';for u := 1 to round(times) do begin result := (result + char); end;end;// needs the aforementioned function inttofloat()function GPH(ID: byte): integer;beginresult := round(inttofloat(getplayerstat(ID,'health'))*(inttofloat(sbot[ID].maxhealth)/150));end;// VERY stripped down, prone to errors/typosprocedure DrawHp(ID,HPTarget: byte);var hp,hp2,hpam: string; times,timesvest,maxtimes: integer;beginif getplayerstat(hptarget,'health') > 0 then begin maxtimes := 15; times := round(maxtimes/(150/inttofloat(getplayerstat(hptarget,'health')))); if getplayerstat(hptarget,'vest') > 0 then timesvest := round((maxtimes div 2)/(100/inttofloat(getplayerstat(hptarget,'vest')))); hp := ' '+(getplayerstat(hptarget,'name')+' : ('+charmultiply('/',times)+charmultiply('-',maxtimes-times)+')'+iif(timesvest>0,' - ('+charmultiply('/',timesvest)+charmultiply('-',(maxtimes div 2)-timesvest)+')','')); hpam := inttostr(gph(hptarget))+'/'+inttostr(sbot[hptarget].maxhealth) hp2 := ' '+charmultiply(' ',(inttofloat(length(hp)) div 2)-(inttofloat(length(hpam)) div 2))+hpam; end else begin hp := ''; hp2 := ''; end;drawtext(ID,hp+chr(13)+chr(10)+hp2,300,$ffffffff,0.06,15,350);end;
Code: [Select]function IntToFloat(Num: integer): single;beginresult := strtofloat(inttostr(num));end;result := round(inttofloat(damage)*(150/inttofloat(+sbot[victim].maxhealth)));(you need the inttofloat function)