For all wanted real airstrike. Full customizable airstreak standalone script.
_airstrike.gsc
PHP Code:
/////////////////////////
// scripted by: BlancO //
/////////////////////////
Setup()
{
// Text variables
level.airstrikeUseText = "Press F in Binoculars to use airstrike!";
level.airstrikeIncommingText = "Airstrike incomming!";
// Models
level.airstrikePlane = "xmodel/vehicle_p51_mustang";
precacheModel(level.airstrikePlane);
level.airstrikeBomb = "xmodel/prop_stuka_bomb";
precacheModel(level.airstrikeBomb);
// Efx of bomb explosion
level.airstrikBombEFX = loadFx("fx/explosions/mortarExp_dirt.efx");
// Count of bombs plane will drop
level.airstrikeBombsCount = 10;
// Distance of damage
level.airstrikeBombRange = 200;
// Damage of single bomb
level.airstrikeBombsDamage = 300;
// Set to 1 on zombie maps with ceils
level.airstrikeIgnoreCeils = 0;
// Team will get damage "allies", "axis", "enemy", "all"
level.airstrikeDamageTo = "axis";
}
DoAirstrike()
{
self endon("disconnect");
if(isDefined(level.airstrikeUse) && level.airstrikeUse != "")
self iPrintlnBold(level.airstrikeUse);
self waittill("binocular_fire");
targetPos = GetTargetedPos();
if(isDefined(level.airstrikeIncommingText) && level.airstrikeIncommingText != "")
iPrintln(level.airstrikeIncommingText);
if(isDefined(targetPos))
{
randomize = (0, randomInt(360), 0);
droppos = (targetPos[0], targetPos[1], targetPos[2] + 400);
forward = anglesToForward(randomize);
forward = maps\mp\_utility::vectorScale(forward, 10000);
endOrigin = droppos + forward;
startOrigin = droppos - forward;
plane = spawn("script_model", startOrigin);
plane setmodel(level.airstrikePlane);
plane.angles = plane.angles + randomize;
plane moveto(endOrigin, 10);
bombs = level.airstrikeBombs;
if(bombs > 30) bombs = 30;
delay = (5 - bombs * 0.05);
wait delay;
for(i = 1; i <= bombs; i += 1)
{
plane thread DropBomb(self);
wait 0.1;
}
wait delay;
plane delete();
}
}
DropBomb(eAttacker)
{
tergetPos = self.origin + (0, 0, -400)
if(!level.airstrikeIgnoreCeils)
{
trace = bulletTrace(self.origin, self.origin + (0, 0, -1000), false, self);
targetPos = trace["position"];
}
bomb = spawn("script_model", self.origin);
bomb setModel(level.airstrikeBomb);
bomb.angles = (90, 0, 0);
time = int(distance(self.origin, targetPos) / 400);
if(time < 0.1)
time = 0.1;
bomb moveTo(targetPos, time);
wait time;
playfx(level.airstrikBombEFX, targetPos);
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
if(distance(targetPos, players[i].origin) < level.airstrikeBombRange && players[i].pers["team"] != "spectator" && isAlive(players[i]) && (level.airstrikeDamageTo == "all" || (level.airstrikeDamageTo == "enemy" && eAttacker.pers["team"] != players[i].pers["team"]) || (eAttacker.pers["team"] == level.airstrikeDamageTo)))
players[i] thread [[level.callbackPlayerDamage]](eAttacker, eAttacker, level.airstrikeBombsDamage, 1, "MOD_PISTOL_BULLET", "airstrike_mp", targetPos, targetPos, "none", 0);
bomb delete();
}
GetTargetedPos()
{
startOrigin = self getEye();
forward = anglesToForward(self getPlayerAngles());
forward = maps\mp\_utility::vectorScale(forward, 100000);
endOrigin = startOrigin + forward;
trace = bulletTrace(startOrigin, endOrigin, false, self);
if(trace["fraction"] == 1.0 || trace["surfacetype"] == "default")
endOrigin = trace["position"];
else if(trace["fraction"] < 1)
endOrigin = trace["position"];
return endOrigin;
}
call on start
thread scripts\_airstrike::Setup();
call on player
thread scripts\_airstrike::DoAirstrike();
Have fun!
BlancO ;)