Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: Dr.Thrax on May 22, 2009, 05:57:57 am

Title: DamageIdle
Post by: Dr.Thrax on May 22, 2009, 05:57:57 am
Script Name: DamageIdle
Script Description: Standing on deadly polygons allows you to use the DamageIdle procedure , working the same way as the ApponIdle , except the Ticks is an array[0..32] for specifiing the individual time and calculate with.
So its a faster version of ApponIdle. 
Original Author(s): Dr.Thrax
Core Version: 2.6.5
Code:
Quote
var
dticks : array [0..32] of integer;

procedure OnJoinTeam(ID, Team: byte);
begin
dticks[id] := 0;
end;

procedure DamageIdle(Ticks : array of integer; Victim : byte);
begin
if Ticks[Victim] mod 60 = 0 then Command('/say '+floattostr(Ticks[Victim]/60)+' seconds'); // example

end;

function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  if (GetPlayerStat(Victim,'Health')+50 = Damage)
     then
        begin
         inc(dticks[Victim],1);
         DamageIdle(dticks,Victim)
         end
     else
         begin
         dticks[Victim] := 0;
         result := Damage;
         end;
end;

GetPlayerStat(Victim,'Health')+50 = Damage is the case when a player stands on a deadly poly, because the deadly polygon gives you allways health + 50 damage (because of vest) , so you are still able to selfkill or get hurt on this polygons expect the damage given is exactly the health + 50 but this is quite rar

U could use it for teleporters that move you instantly to a specified position or to do some other tasks that have to be done the moment you want it.

if any bugs tell me!

(EDIT: if you want it to execute all the time , place a bot on a deadly polygon anywhere in the map)

Greetings, Dr.Thrax