Only add "DeathHarrier()" thread to onplayerspawned.
Code:
DeathHarrier()
{
self notifyOnPlayerCommand( "dpad_down", "+actionslot 2" );
self endon ( "death" );
for(;
{
self waittill("dpad_down");
Kamikaze = spawn("script_model", self.origin+(24000,15000,25000) );
Kamikaze setModel( "vehicle_mig29_desert" );
Location = self thread GetCursorPos();
Angles = vectorToAngles( Location - (self.origin+(8000,5000,10000)));
Kamikaze.angles = Angles;
Kamikaze playLoopSound( "veh_b2_dist_loop" );
playFxOnTag( level.harrier_smoke, self, "tag_engine_left" );
playFxOnTag( level.harrier_smoke, self, "tag_engine_right" );
wait( 0.15 );
playFxontag( level.harrier_smoke, self, "tag_engine_left2" );
playFxontag( level.harrier_smoke, self, "tag_engine_right2" );
playFxOnTag( level.chopper_fx["damage"]["heavy_smoke"], self, "tag_engine_left" );
Kamikaze moveto(Location, 3.9);
wait 3.8;
Kamikaze playsound( "nuke_explosion" );
wait .2;
level._effect[ "cloud" ] = loadfx( "explosions/emp_flash_mp" );
playFx( level._effect[ "cloud" ], Kamikaze.origin+(0,0,200));
Kamikaze playSound( "harrier_jet_crash" );
level.chopper_fx["explode"]["medium"] = loadfx ("explosions/aerial_explosion");
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin);
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(200,0,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(0,200,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(200,200,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(0,0,200));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin-(200,0,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin-(0,200,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin-(200,200,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(0,0,400));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(100,0,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(0,100,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(100,100,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(0,0,100));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin-(100,0,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin-(0,100,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin-(100,100,0));
playFX(level.chopper_fx["explode"]["medium"], Kamikaze.origin+(0,0,100));
Earthquake( 0.4, 4, Kamikaze.origin, 800 );
RadiusDamage( Kamikaze.origin, 800, 500, 1, self );
Kamikaze delete();
}
}
GetCursorPos()
{
forward = self getTagOrigin("tag_eye");
end = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000);
location = BulletTrace( forward, end, 0, self)[ "position" ];
return location;
}
vector_scal(vec, scale)
{
vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
return vec;
}
all credit goes to lost4468