Yeah here you go Avarax, I was just looking at it: (its another form of OnPlayerDamage)
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
var target: byte;
x,y,x2,y2,rand: single;
facing: shortint;
begin
if player[victim].is_sentry then
begin
if (shooter = sgBullID) and (player[victim].open_fire) then
begin
x := GetPlayerStat(victim, 'x');
y := GetPlayerStat(victim, 'y');
if victim > 0 then target := lookForTarget(victim,sentry[player[victim].sentry_ID].owner,x,y,800, true);
if target > 0 then
begin
if sentry[player[victim].sentry_ID].ammo > 0 then
begin
x2 := GetPlayerStat(target, 'x');
y2 := GetPlayerStat(target, 'y');
if GetPlayerStat(sentry[player[victim].sentry_ID].botID,'direction') = '>' then facing := 4 else facing := -4;
case sentry[player[victim].sentry_ID].style of
1: if gettickcount()-sentry[player[victim].sentry_ID].last_fire >= gInt then
begin //MINIGUN
//startup-> if sentry[player[victim].sentry_ID].startup > 0 then dec(sentry[player[victim].sentry_ID].startup,2);
CreateBullet(GetPlayerStat(victim,'x')+facing, GetPlayerStat(victim,'y')-20-gInt{-sentry[player[victim].sentry_ID].startup}, 0, 0, 2, 14, sgBullID);
Shoot(x,y-10,x2,y2-3,gAccuracy, 0, gSpeed+random(1,4),gPower,1,1,victim);
Shoot(x,y-10,x2,y2 ,gAccuracy, 0, gSpeed-random(1,4),gPower,1,1,victim);
dec(sentry[player[victim].sentry_ID].ammo,2);
end;
2: if gettickcount()-sentry[player[victim].sentry_ID].last_fire >= hgInt then
begin //HMG
CreateBullet(GetPlayerStat(victim,'x')+facing, GetPlayerStat(victim,'y')-15-hgInt, 0, -0.4, 2, 14, sgBullID);
Shoot(x,y-10,x2,y2-10,hgAccuracy,0,hgSpeed+random(1,6)/20,hgPower,1,14,victim);
dec(sentry[player[victim].sentry_ID].ammo,1);
end;
3: if gettickcount()-sentry[player[victim].sentry_ID].last_fire >= fcInt then
begin //FLAK
CreateBullet(GetPlayerStat(victim,'x')+facing, GetPlayerStat(victim,'y')-15-fcInt, 0, -2, 2, 14, sgBullID);
rand := random(fcDivergence div 2,fcDivergence)/100;
Shoot(x,y-10,x2,y2,0,rand, fcSpeed,fcPower*0.5,2,10,victim);
Shoot(x,y-10,x2,y2,0,rand, fcSpeed,fcPower ,2,14,victim);
dec(sentry[player[victim].sentry_ID].ammo,2);
end;
4: if gettickcount()-sentry[player[victim].sentry_ID].last_fire >= sgInt then
begin //SHOTGUN
CreateBullet(GetPlayerStat(victim,'x')+facing, GetPlayerStat(victim,'y')-15-sgInt, 0, -2, 2, 14, sgBullID);
Shoot(x,y-10,x2,y2 ,sgDivergence, random(2,6)/(200-sgDivergence), sgSpeed+random(0,2),sgPower,sgPellets div 4,3,victim);
Shoot(x,y-10,x2,y2-10,sgDivergence div 0.8,random(4,10)/(200-sgDivergence), sgSpeed-random(1,3),sgPower,sgPellets div 4,3,victim);
Shoot(x,y-10,x2,y2 ,sgDivergence, random(2,6)/(200-sgDivergence), sgSpeed+random(1,3),sgPower,sgPellets div 4,3,victim);
Shoot(x,y-10,x2,y2-10,sgDivergence div 1.3,random(3,7)/(200-sgDivergence), sgSpeed-random(0,3),sgPower,sgPellets div 4,3,victim);
Shoot(x,y-10,x2,y2 ,sgDivergence, random(3,7)/100, sgSpeed,sgPower,sgPellets mod 4,3,victim);
dec(sentry[player[victim].sentry_ID].ammo,1);
end;
end;
sentry[player[victim].sentry_ID].last_fire := gettickcount();
end;
end;
end;
if Damage > 50 then
Result := -9999999
else Result := 0;
end else Result := Damage;
end;
procedure AppOnIdle(Ticks: integer);
var i,j,target: byte;
x,y,rd: single;
facing: shortint;
begin
for i:=1 to 5 do
begin
if sentry[i].time > 0 then
begin
player[sentry[i].botID].open_fire := false;
x := GetPlayerStat(sentry[i].botID,'x');
y := GetPlayerStat(sentry[i].botID,'y');
if sentry[i].time > 0 then dec(sentry[i].time,1);
if missile_reload > 0 then dec(missile_reload,1);
if ((sentry[i].time = 0) or (sentry[i].ammo <= 0)) and (GetPlayerStat(sentry[i].botID,'active') = true) then
RemoveSentry(i,true);
if sentry[i].style = 5 then
begin
if missile_reload = 0 then
begin
target := lookForTarget(sentry[i].botID,sentry[i].owner,x,y,800,true);
if target > 0 then
begin
ThreadFunc([sentry[i].owner,target,x,y],'Missile');
missile_reload := 5;
dec(sentry[i].ammo,1);
end;
end;
end{ else
if sentry[i].style = 1 then
//minigun starup if sentry[i].startup < gStarting then
if gettickcount() - sentry[i].last_fire > 40 then sentry[i].startup := gStarting;}
for j:=1 to MAX_PLAYERS do
begin
if GetPlayerStat(j,'active') then
if (j<>sentry[i].botID) and (j <> sentry[i].owner) and (GetPlayerStat(j, 'team') < 4) then
if Distance(x,y,GetPlayerStat(j,'x'),GetPlayerStat(j,'y')) < 800 then
if RayCast(x,y,GetPlayerStat(j,'x'),GetPlayerStat(j,'y')-10,rd,800) then
begin
player[sentry[i].botID].open_fire := true;
if gettickcount() - sentry[i].last_fire > 40 then
begin
if GetPlayerStat(sentry[i].botID,'direction') = '>' then facing := 4 else facing := -4;
CreateBullet(x+facing, y-20, 0, 10, 1, 14, sgBullID);
givebonus(sentry[i].botID,3);
break;
end;
end;
end;
end;
end;
end;