Untitled diff

Created Diff never expires
#define PLUGIN_VERSION "1.2"
#define PLUGIN_VERSION "1.2.1"


/*=======================================================================================
/*=======================================================================================
Plugin Info:
Plugin Info:


* Name : [L4D2] F-18 Airstrike
* Name : [L4D2] F-18 Airstrike
* Author : SilverShot
* Author : SilverShot
* Descrp : Creates F-18 fly bys which shoot missiles to where they were triggered from.
* Descrp : Creates F-18 fly bys which shoot missiles to where they were triggered from.
* Link : http://forums.alliedmods.net/showthread.php?t=187567
* Link : http://forums.alliedmods.net/showthread.php?t=187567


========================================================================================
========================================================================================
Change Log:
Change Log:


1.2.1 (23-Jan-2018)
- Update by "Lux":
- Removed signiture/sdkcall dependency for stagger.
- Now uses native vscript API for stagger function.

1.2 (31-Jul-2013)
1.2 (31-Jul-2013)
- Added new forwards "F18_OnAirstrike" and "F18_OnMissileHit" for developers to make custom plugins when the missile fires/hits.
- Added new forwards "F18_OnAirstrike" and "F18_OnMissileHit" for developers to make custom plugins when the missile fires/hits.
- Added new plugin "l4d2_airstrike.dead_air" to destroy the barricade on c11m3 (Garages) when the missile hits near by.
- Added new plugin "l4d2_airstrike.dead_air" to destroy the barricade on c11m3 (Garages) when the missile hits near by.
- Added new plugin "l4d2_airstrike.no_mercy" to destroy the gas station on c8m3 (Sewers) when the missile hits near by.
- Added new plugin "l4d2_airstrike.no_mercy" to destroy the gas station on c8m3 (Sewers) when the missile hits near by.
- Fixed the jet/missile spawning on most maps with high or low skyboxes, should work fine now.
- Fixed the jet/missile spawning on most maps with high or low skyboxes, should work fine now.
- Thanks to "worminater" for helping and lots of testing.
- Thanks to "worminater" for helping and lots of testing.


1.1 (20-Jun-2012)
1.1 (20-Jun-2012)
- Added a hard limit of 8 AirStrikes at one time, in an attempt to prevent some players from crashing.
- Added a hard limit of 8 AirStrikes at one time, in an attempt to prevent some players from crashing.
- Added cvar "l4d2_airstrike_shake" to set the range at which the explosion can shake players screens.
- Added cvar "l4d2_airstrike_shake" to set the range at which the explosion can shake players screens.
- Added cvar "l4d2_airstrike_vocalize" to set the chance to vocalize the player nearest the explosion.
- Added cvar "l4d2_airstrike_vocalize" to set the chance to vocalize the player nearest the explosion.
- Changed some default cvar values.
- Changed some default cvar values.
- Small fixes.
- Small fixes.


1.0 (15-Jun-2012)
1.0 (15-Jun-2012)
- Initial release.
- Initial release.


========================================================================================
========================================================================================


This plugin was made using source code from the following plugins.
This plugin was made using source code from the following plugins.
If I have used your code and not credited you, please let me know.
If I have used your code and not credited you, please let me know.


* Thanks to "Downtown1", "ProdigySim" and "psychonic" for "[EXTENSION] Left 4 Downtown 2 L4D2 Only" - Used gamedata to stumble players.
* Thanks to "Downtown1", "ProdigySim" and "psychonic" for "[EXTENSION] Left 4 Downtown 2 L4D2 Only" - Used gamedata to stumble players.
http://forums.alliedmods.net/showthread.php?t=134032
http://forums.alliedmods.net/showthread.php?t=134032


======================================================================================*/
======================================================================================*/


#pragma semicolon 1
#pragma semicolon 1


#include <l4d2_airstrike>
#include <l4d2_airstrike>
#include <sdktools>
#include <sdktools>
#include <sdkhooks>
#include <sdkhooks>


#define CVAR_FLAGS FCVAR_NOTIFY
#define CVAR_FLAGS FCVAR_NOTIFY
#define CHAT_TAG "\x03[Airstrike] \x05"
#define CHAT_TAG "\x03[Airstrike] \x05"
#define MAX_ENTITIES 8
#define MAX_ENTITIES 8


#define MODEL_AGM65 "models/missiles/f18_agm65maverick.mdl"
#define MODEL_AGM65 "models/missiles/f18_agm65maverick.mdl"
#define MODEL_F18 "models/f18/f18_sb.mdl"
#define MODEL_F18 "models/f18/f18_sb.mdl"
#define MODEL_BOX "models/props/cs_militia/silo_01.mdl"
#define MODEL_BOX "models/props/cs_militia/silo_01.mdl"
#define SOUND_OVER1 "ambient/overhead/plane1.wav"
#define SOUND_OVER1 "ambient/overhead/plane1.wav"
#define SOUND_OVER2 "ambient/overhead/plane2.wav"
#define SOUND_OVER2 "ambient/overhead/plane2.wav"
#define SOUND_OVER3 "ambient/overhead/plane3.wav"
#define SOUND_OVER3 "ambient/overhead/plane3.wav"
#define SOUND_PASS1 "animation/jets/jet_by_01_mono.wav"
#define SOUND_PASS1 "animation/jets/jet_by_01_mono.wav"
#define SOUND_PASS2 "animation/jets/jet_by_02_mono.wav"
#define SOUND_PASS2 "animation/jets/jet_by_02_mono.wav"
#define SOUND_PASS3 "animation/jets/jet_by_01_lr.wav"
#define SOUND_PASS3 "animation/jets/jet_by_01_lr.wav"
#define SOUND_PASS4 "animation/jets/jet_by_02_lr.wav"
#define SOUND_PASS4 "animation/jets/jet_by_02_lr.wav"
#define SOUND_PASS5 "animation/jets/jet_by_03_lr.wav"
#define SOUND_PASS5 "animation/jets/jet_by_03_lr.wav"
#define SOUND_PASS6 "animation/jets/jet_by_04_lr.wav"
#define SOUND_PASS6 "animation/jets/jet_by_04_lr.wav"
#define SOUND_PASS7 "animation/jets/jet_by_05_lr.wav"
#define SOUND_PASS7 "animation/jets/jet_by_05_lr.wav"
#define SOUND_PASS8 "animation/jets/jet_by_05_rl.wav"
#define SOUND_PASS8 "animation/jets/jet_by_05_rl.wav"


#define SOUND_EXPLODE3 "weapons/hegrenade/explode3.wav"
#define SOUND_EXPLODE3 "weapons/hegrenade/explode3.wav"
#define SOUND_EXPLODE4 "weapons/hegrenade/explode4.wav"
#define SOUND_EXPLODE4 "weapons/hegrenade/explode4.wav"
#define SOUND_EXPLODE5 "weapons/hegrenade/explode5.wav"
#define SOUND_EXPLODE5 "weapons/hegrenade/explode5.wav"


#define PARTICLE_BOMB1 "FluidExplosion_fps"
#define PARTICLE_BOMB1 "FluidExplosion_fps"
#define PARTICLE_BOMB2 "missile_hit1"
#define PARTICLE_BOMB2 "missile_hit1"
#define PARTICLE_BOMB3 "gas_explosion_main"
#define PARTICLE_BOMB3 "gas_explosion_main"
#define PARTICLE_BOMB4 "explosion_huge"
#define PARTICLE_BOMB4 "explosion_huge"
#define PARTICLE_BLUE "flame_blue"
#define PARTICLE_BLUE "flame_blue"
#define PARTICLE_FIRE "fire_medium_01"
#define PARTICLE_FIRE "fire_medium_01"
#define PARTICLE_SPARKS "fireworks_sparkshower_01e"
#define PARTICLE_SPARKS "fireworks_sparkshower_01e"
#define PARTICLE_SMOKE "rpg_smoke"
#define PARTICLE_SMOKE "rpg_smoke"


static Handle:g_hCvarAllow, Handle:g_hCvarModes, Handle:g_hCvarModesOff, Handle:g_hCvarModesTog, Handle:g_hCvarDamage, Handle:g_hCvarDistance,
static Handle:g_hCvarAllow, Handle:g_hCvarModes, Handle:g_hCvarModesOff, Handle:g_hCvarModesTog, Handle:g_hCvarDamage, Handle:g_hCvarDistance,
Handle:g_hCvarHorde, Handle:g_hCvarShake, Handle:g_hCvarSpread, Handle:g_hCvarStumble, Handle:g_hCvarStyle, Handle:g_hCvarVocalize,
Handle:g_hCvarHorde, Handle:g_hCvarShake, Handle:g_hCvarSpread, Handle:g_hCvarStumble, Handle:g_hCvarStyle, Handle:g_hCvarVocalize,
bool:g_bCvarAllow, g_iCvarDamage, g_iCvarDistance, g_iCvarHorde, g_iCvarShake, g_iCvarSpread, g_iCvarStumble, g_iCvarStyle, g_iCvarVocalize;
bool:g_bCvarAllow, g_iCvarDamage, g_iCvarDistance, g_iCvarHorde, g_iCvarShake, g_iCvarSpread, g_iCvarStumble, g_iCvarStyle, g_iCvarVocalize;


static Handle:g_hConfStagger, Handle:g_hForwardOnAirstrike, Handle:g_hForwardOnMissileHit, Handle:g_hForwardPluginState, Handle:g_hForwardRoundState, bool:g_bPluginTrigger,
static Handle:g_hForwardOnAirstrike, Handle:g_hForwardOnMissileHit, Handle:g_hForwardPluginState, Handle:g_hForwardRoundState, bool:g_bPluginTrigger,
Handle:g_hMPGameMode, g_iPlayerSpawn, g_iRoundStart, bool:g_bLateLoad,
Handle:g_hMPGameMode, g_iPlayerSpawn, g_iRoundStart, bool:g_bLateLoad,
g_iEntities[MAX_ENTITIES];
g_iEntities[MAX_ENTITIES];






// ====================================================================================================
// ====================================================================================================
// NATIVES
// NATIVES
// ====================================================================================================
// ====================================================================================================
public Native_ShowAirstrike(Handle:hPlugin, iNumParams)
public Native_ShowAirstrike(Handle:hPlugin, iNumParams)
{
{
decl Float:vPos[3];
decl Float:vPos[3];
vPos[0] = Float:GetNativeCell(1);
vPos[0] = Float:GetNativeCell(1);
vPos[1] = Float:GetNativeCell(2);
vPos[1] = Float:GetNativeCell(2);
vPos[2] = Float:GetNativeCell(3);
vPos[2] = Float:GetNativeCell(3);
ShowAirstrike(vPos, Float:GetNativeCell(4));
ShowAirstrike(vPos, Float:GetNativeCell(4));
}
}






// ====================================================================================================
// ====================================================================================================
// PLUGIN INFO / START / END
// PLUGIN INFO / START / END
// ====================================================================================================
// ====================================================================================================
public Plugin:myinfo =
public Plugin:myinfo =
{
{
name = "[L4D2] F-18 Airstrike",
name = "[L4D2] F-18 Airstrike",
author = "SilverShot",
author = "SilverShot",
description = "Creates F-18 fly bys which shoot missiles to where they were triggered from.",
description = "Creates F-18 fly bys which shoot missiles to where they were triggered from.",
version = PLUGIN_VERSION,
version = PLUGIN_VERSION,
url = "http://forums.alliedmods.net/showthread.php?t=187567"
url = "http://forums.alliedmods.net/showthread.php?t=187567"
}
}


public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
{
decl String:sGameName[12];
decl String:sGameName[12];
GetGameFolderName(sGameName, sizeof(sGameName));
GetGameFolderName(sGameName, sizeof(sGameName));
if( strcmp(sGameName, "left4dead2", false) )
if( strcmp(sGameName, "left4dead2", false) )
{
{
strcopy(error, err_max, "Plugin only supports Left 4 Dead 2.");
strcopy(error, err_max, "Plugin only supports Left 4 Dead 2.");
return APLRes_SilentFailure;
return APLRes_SilentFailure;
}
}


g_bLateLoad = late;
g_bLateLoad = late;
RegPluginLibrary("l4d2_airstrike");
RegPluginLibrary("l4d2_airstrike");
CreateNative("F18_ShowAirstrike", Native_ShowAirstrike);
CreateNative("F18_ShowAirstrike", Native_ShowAirstrike);


return APLRes_Success;
return APLRes_Success;
}
}


public OnPluginStart()
public OnPluginStart()
{
{
new Handle:hConf = LoadGameConfigFile("l4d2_airstrike");
if( hConf == INVALID_HANDLE )
SetFailState("Missing required 'gamedata/l4d2_airstrike.txt', please re-download.");
StartPrepSDKCall(SDKCall_Player);
if( PrepSDKCall_SetFromConf(hConf, SDKConf_Signature, "CTerrorPlayer::OnStaggered") == false )
SetFailState("Could not load the 'CTerrorPlayer::OnStaggered' gamedata signature.");
PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer);
PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
g_hConfStagger = EndPrepSDKCall();
if( g_hConfStagger == INVALID_HANDLE )
SetFailState("Could not prep the 'CTerrorPlayer::OnStaggered' function.");

g_hForwardOnAirstrike = CreateGlobalForward("F18_OnAirstrike", ET_Ignore, Param_Float, Param_Float, Param_Float);
g_hForwardOnAirstrike = CreateGlobalForward("F18_OnAirstrike", ET_Ignore, Param_Float, Param_Float, Param_Float);
g_hForwardOnMissileHit = CreateGlobalForward("F18_OnMissileHit", ET_Ignore, Param_Float, Param_Float, Param_Float);
g_hForwardOnMissileHit = CreateGlobalForward("F18_OnMissileHit", ET_Ignore, Param_Float, Param_Float, Param_Float);
g_hForwardPluginState = CreateGlobalForward("F18_OnPluginState", ET_Ignore, Param_Cell);
g_hForwardPluginState = CreateGlobalForward("F18_OnPluginState", ET_Ignore, Param_Cell);
g_hForwardRoundState = CreateGlobalForward("F18_OnRoundState", ET_Ignore, Param_Cell);
g_hForwardRoundState = CreateGlobalForward("F18_OnRoundState", ET_Ignore, Param_Cell);


g_hCvarAllow = CreateConVar( "l4d2_airstrike_allow", "1", "0=Plugin off, 1=Plugin on.", CVAR_FLAGS );
g_hCvarAllow = CreateConVar( "l4d2_airstrike_allow", "1", "0=Plugin off, 1=Plugin on.", CVAR_FLAGS );
g_hCvarDamage = CreateConVar( "l4d2_airstrike_damage", "200", "Hurt players by this much at the center of the explosion. Damages falls off based on the maximum distance.", CVAR_FLAGS );
g_hCvarDamage = CreateConVar( "l4d2_airstrike_damage", "200", "Hurt players by this much at the center of the explosion. Damages falls off based on the maximum distance.", CVAR_FLAGS );
g_hCvarDistance = CreateConVar( "l4d2_airstrike_distance", "500", "The range at which the airstrike explosion can hurt players.", CVAR_FLAGS );
g_hCvarDistance = CreateConVar( "l4d2_airstrike_distance", "500", "The range at which the airstrike explosion can hurt players.", CVAR_FLAGS );
g_hCvarHorde = CreateConVar( "l4d2_airstrike_horde", "5", "0=Off. The chance out of 100 to make a panic event when the bomb explodes.", CVAR_FLAGS );
g_hCvarHorde = CreateConVar( "l4d2_airstrike_horde", "5", "0=Off. The chance out of 100 to make a panic event when the bomb explodes.", CVAR_FLAGS );
g_hCvarModes = CreateConVar( "l4d2_airstrike_modes", "", "Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).", CVAR_FLAGS );
g_hCvarModes = CreateConVar( "l4d2_airstrike_modes", "", "Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).", CVAR_FLAGS );
g_hCvarModesOff = CreateConVar( "l4d2_airstrike_modes_off", "", "Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).", CVAR_FLAGS );
g_hCvarModesOff = CreateConVar( "l4d2_airstrike_modes_off", "", "Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).", CVAR_FLAGS );
g_hCvarModesTog = CreateConVar( "l4d2_airstrike_modes_tog", "0", "Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.", CVAR_FLAGS );
g_hCvarModesTog = CreateConVar( "l4d2_airstrike_modes_tog", "0", "Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.", CVAR_FLAGS );
g_hCvarShake = CreateConVar( "l4d2_airstrike_shake", "1000", "The range at which the explosion can shake players screens.", CVAR_FLAGS );
g_hCvarShake = CreateConVar( "l4d2_airstrike_shake", "1000", "The range at which the explosion can shake players screens.", CVAR_FLAGS );
g_hCvarSpread = CreateConVar( "l4d2_airstrike_spread", "100", "The maximum distance to vary the missile target zone.", CVAR_FLAGS );
g_hCvarSpread = CreateConVar( "l4d2_airstrike_spread", "100", "The maximum distance to vary the missile target zone.", CVAR_FLAGS );
g_hCvarStumble = CreateConVar( "l4d2_airstrike_stumble", "400", "0=Off, Range at which players are stumbled from the explosion.", CVAR_FLAGS );
g_hCvarStumble = CreateConVar( "l4d2_airstrike_stumble", "400", "0=Off, Range at which players are stumbled from the explosion.", CVAR_FLAGS );
g_hCvarStyle = CreateConVar( "l4d2_airstrike_style", "15", "1=Blue Fire, 2=Flames, 4=Sparks, 8=RPG Smoke, 15=All.", CVAR_FLAGS );
g_hCvarStyle = CreateConVar( "l4d2_airstrike_style", "15", "1=Blue Fire, 2=Flames, 4=Sparks, 8=RPG Smoke, 15=All.", CVAR_FLAGS );
g_hCvarVocalize = CreateConVar( "l4d2_airstrike_vocalize", "20", "0=Off. The chance out of 100 to vocalize the player nearest the explosion.", CVAR_FLAGS );
g_hCvarVocalize = CreateConVar( "l4d2_airstrike_vocalize", "20", "0=Off. The chance out of 100 to vocalize the player nearest the explosion.", CVAR_FLAGS );
CreateConVar( "l4d2_airstrike_version", PLUGIN_VERSION, "F-18 Airstrike plugin version.", CVAR_FLAGS|FCVAR_DONTRECORD);
CreateConVar( "l4d2_airstrike_version", PLUGIN_VERSION, "F-18 Airstrike plugin version.", CVAR_FLAGS|FCVAR_DONTRECORD);
AutoExecConfig(true, "l4d2_airstrike");
AutoExecConfig(true, "l4d2_airstrike");


g_hMPGameMode = FindConVar("mp_gamemode");
g_hMPGameMode = FindConVar("mp_gamemode");
HookConVarChange(g_hMPGameMode, ConVarChanged_Allow);
HookConVarChange(g_hMPGameMode, ConVarChanged_Allow);
HookConVarChange(g_hCvarAllow, ConVarChanged_Allow);
HookConVarChange(g_hCvarAllow, ConVarChanged_Allow);
HookConVarChange(g_hCvarModes, ConVarChanged_Allow);
HookConVarChange(g_hCvarModes, ConVarChanged_Allow);
HookConVarChange(g_hCvarModesOff, ConVarChanged_Allow);
HookConVarChange(g_hCvarModesOff, ConVarChanged_Allow);
HookConVarChange(g_hCvarModesTog, ConVarChanged_Allow);
HookConVarChange(g_hCvarModesTog, ConVarChanged_Allow);
HookConVarChange(g_hCvarDamage, ConVarChanged_Cvars);
HookConVarChange(g_hCvarDamage, ConVarChanged_Cvars);
HookConVarChange(g_hCvarDistance, ConVarChanged_Cvars);
HookConVarChange(g_hCvarDistance, ConVarChanged_Cvars);
HookConVarChange(g_hCvarHorde, ConVarChanged_Cvars);
HookConVarChange(g_hCvarHorde, ConVarChanged_Cvars);
HookConVarChange(g_hCvarShake, ConVarChanged_Cvars);
HookConVarChange(g_hCvarShake, ConVarChanged_Cvars);
HookConVarChange(g_hCvarSpread, ConVarChanged_Cvars);
HookConVarChange(g_hCvarSpread, ConVarChanged_Cvars);
HookConVarChange(g_hCvarStumble, ConVarChanged_Cvars);
HookConVarChange(g_hCvarStumble, ConVarChanged_Cvars);
HookConVarChange(g_hCvarStyle, ConVarChanged_Cvars);
HookConVarChange(g_hCvarStyle, ConVarChanged_Cvars);
HookConVarChange(g_hCvarVocalize, ConVarChanged_Cvars);
HookConVarChange(g_hCvarVocalize, ConVarChanged_Cvars);


RegAdminCmd("sm_strike", CmdAirstrikeMenu, ADMFLAG_ROOT, "Displays a menu with options to show/save a airstrike and triggers.");
RegAdminCmd("sm_strike", CmdAirstrikeMenu, ADMFLAG_ROOT, "Displays a menu with options to show/save a airstrike and triggers.");
}
}


public OnPluginEnd()
public OnPluginEnd()
{
{
ResetPlugin();
ResetPlugin();
}
}


public OnAllPluginsLoaded()
public OnAllPluginsLoaded()
{
{
if( LibraryExists("l4d2_airstrike.triggers") == true )
if( LibraryExists("l4d2_airstrike.triggers") == true )
{
{
g_bPluginTrigger = true;
g_bPluginTrigger = true;
}
}
}
}


public OnLibraryAdded(const String:name[])
public OnLibraryAdded(const String:name[])
{
{
if( strcmp(name, "l4d2_airstrike.triggers") == 0 )
if( strcmp(name, "l4d2_airstrike.triggers") == 0 )
{
{
g_bPluginTrigger = true;
g_bPluginTrigger = true;
}
}
}
}


public OnLibraryRemoved(const String:name[])
public OnLibraryRemoved(const String:name[])
{
{
if( strcmp(name, "l4d2_airstrike.triggers") == 0 )
if( strcmp(name, "l4d2_airstrike.triggers") == 0 )
{
{
g_bPluginTrigger = false;
g_bPluginTrigger = false;
}
}
}
}


public OnMapStart()
public OnMapStart()
{
{
PrecacheParticle(PARTICLE_BOMB1);
PrecacheParticle(PARTICLE_BOMB1);
PrecacheParticle(PARTICLE_BOMB2);
PrecacheParticle(PARTICLE_BOMB2);
PrecacheParticle(PARTICLE_BOMB3);
PrecacheParticle(PARTICLE_BOMB3);
PrecacheParticle(PARTICLE_BOMB4);
PrecacheParticle(PARTICLE_BOMB4);
PrecacheParticle(PARTICLE_BLUE);
PrecacheParticle(PARTICLE_BLUE);
PrecacheParticle(PARTICLE_FIRE);
PrecacheParticle(PARTICLE_FIRE);
PrecacheParticle(PARTICLE_SMOKE);
PrecacheParticle(PARTICLE_SMOKE);
PrecacheParticle(PARTICLE_SPARKS);
PrecacheParticle(PARTICLE_SPARKS);
PrecacheModel(MODEL_AGM65, true);
PrecacheModel(MODEL_AGM65, true);
PrecacheModel(MODEL_F18, true);
PrecacheModel(MODEL_F18, true);
PrecacheModel(MODEL_BOX, true);
PrecacheModel(MODEL_BOX, true);
PrecacheSound(SOUND_PASS1, true);
PrecacheSound(SOUND_PASS1, true);
PrecacheSound(SOUND_PASS2, true);
PrecacheSound(SOUND_PASS2, true);
PrecacheSound(SOUND_PASS3, true);
PrecacheSound(SOUND_PASS3, true);
PrecacheSound(SOUND_PASS4, true);
PrecacheSound(SOUND_PASS4, true);
PrecacheSound(SOUND_PASS5, true);
PrecacheSound(SOUND_PASS5, true);
PrecacheSound(SOUND_PASS6, true);
PrecacheSound(SOUND_PASS6, true);
PrecacheSound(SOUND_PASS7, true);
PrecacheSound(SOUND_PASS7, true);
PrecacheSound(SOUND_PASS8, true);
PrecacheSound(SOUND_PASS8, true);
}
}


public OnMapEnd()
public OnMapEnd()
{
{
ResetPlugin();
ResetPlugin();
OnRoundState(0);
OnRoundState(0);
}
}


ResetPlugin()
ResetPlugin()
{
{
g_iRoundStart = 0;
g_iRoundStart = 0;
g_iPlayerSpawn = 0;
g_iPlayerSpawn = 0;
}
}






// ====================================================================================================
// ====================================================================================================
// CVARS
// CVARS
// ====================================================================================================
// ====================================================================================================
public OnConfigsExecuted()
public OnConfigsExecuted()
IsAllowed();
IsAllowed();


public ConVarChanged_Cvars(Handle:convar, const String:oldValue[], const String:newValue[])
public ConVarChanged_Cvars(Handle:convar, const String:oldValue[], const String:newValue[])
GetCvars();
GetCvars();


public ConVarChanged_Allow(Handle:convar, const String:oldValue[], const String:newValue[])
public ConVarChanged_Allow(Handle:convar, const String:oldValue[], const String:newValue[])
IsAllowed();
IsAllowed();


GetCvars()
GetCvars()
{
{
g_iCvarDamage = GetConVarInt(g_hCvarDamage);
g_iCvarDamage = GetConVarInt(g_hCvarDamage);
g_iCvarDistance = GetConVarInt(g_hCvarDistance);
g_iCvarDistance = GetConVarInt(g_hCvarDistance);
g_iCvarHorde = GetConVarInt(g_hCvarHorde);
g_iCvarHorde = GetConVarInt(g_hCvarHorde);
g_iCvarShake = GetConVarInt(g_hCvarShake);
g_iCvarShake = GetConVarInt(g_hCvarShake);
g_iCvarSpread = GetConVarInt(g_hCvarSpread);
g_iCvarSpread = GetConVarInt(g_hCvarSpread);
g_iCvarStumble = GetConVarInt(g_hCvarStumble);
g_iCvarStumble = GetConVarInt(g_hCvarStumble);
g_iCvarStyle = GetConVarInt(g_hCvarStyle);
g_iCvarStyle = GetConVarInt(g_hCvarStyle);
g_iCvarVocalize = GetConVarInt(g_hCvarVocalize);
g_iCvarVocalize = GetConVarInt(g_hCvarVocalize);
}
}


IsAllowed()
IsAllowed()
{
{
new bool:bCvarAllow = GetConVarBool(g_hCvarAllow);
new bool:bCvarAllow = GetConVarBool(g_hCvarAllow);
new bool:bAllowMode = IsAllowedGameMode();
new bool:bAllowMode = IsAllowedGameMode();
GetCvars();
GetCvars();


if( g_bCvarAllow == false && bCvarAllow == true && bAllowMode == true )
if( g_bCvarAllow == false && bCvarAllow == true && bAllowMode == true )
{
{
g_bCvarAllow = true;
g_bCvarAllow = true;
HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_PostNoCopy);
HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_PostNoCopy);
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);


Call_StartForward(g_hForwardPluginState);
Call_StartForward(g_hForwardPluginState);
Call_PushCell(1);
Call_PushCell(1);
Call_Finish();
Call_Finish();


if( g_bLateLoad == true )
if( g_bLateLoad == true )
{
{
g_bLateLoad = false;
g_bLateLoad = false;
OnRoundState(1);
OnRoundState(1);
}
}
}
}


else if( g_bCvarAllow == true && (bCvarAllow == false || bAllowMode == false) )
else if( g_bCvarAllow == true && (bCvarAllow == false || bAllowMode == false) )
{
{
ResetPlugin();
ResetPlugin();
g_bCvarAllow = false;
g_bCvarAllow = false;
UnhookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_PostNoCopy);
UnhookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_PostNoCopy);
UnhookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
UnhookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
UnhookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
UnhookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);


Call_StartForward(g_hForwardPluginState);
Call_StartForward(g_hForwardPluginState);
Call_PushCell(0);
Call_PushCell(0);
Call_Finish();
Call_Finish();
}
}
}
}


static g_iCurrentMode;
static g_iCurrentMode;


bool:IsAllowedGameMode()
bool:IsAllowedGameMode()
{
{
if( g_hMPGameMode == INVALID_HANDLE )
if( g_hMPGameMode == INVALID_HANDLE )
return false;
return false;


new iCvarModesTog = GetConVarInt(g_hCvarModesTog);
new iCvarModesTog = GetConVarInt(g_hCvarModesTog);
if( iCvarModesTog != 0 )
if( iCvarModesTog != 0 )
{
{
g_iCurrentMode = 0;
g_iCurrentMode = 0;


new entity = CreateEntityByName("info_gamemode");
new entity = CreateEntityByName("info_gamemode");
DispatchSpawn(entity);
DispatchSpawn(entity);
HookSingleEntityOutput(entity, "OnCoop", OnGamemode, true);
HookSingleEntityOutput(entity, "OnCoop", OnGamemode, true);
HookSingleEntityOutput(entity, "OnSurvival", OnGamemode, true);
HookSingleEntityOutput(entity, "OnSurvival", OnGamemode, true);
HookSingleEntityOutput(entity, "OnVersus", OnGamemode, true);
HookSingleEntityOutput(entity, "OnVersus", OnGamemode, true);
HookSingleEntityOutput(entity, "OnScavenge", OnGamemode, true);
HookSingleEntityOutput(entity, "OnScavenge", OnGamemode, true);
AcceptEntityInput(entity, "PostSpawnActivate");
AcceptEntityInput(entity, "PostSpawnActivate");
AcceptEntityInput(entity, "Kill");
AcceptEntityInput(entity, "Kill");


if( g_iCurrentMode == 0 )
if( g_iCurrentMode == 0 )
return false;
return false;


if( !(iCvarModesTog & g_iCurrentMode) )
if( !(iCvarModesTog & g_iCurrentMode) )
return false;
return false;
}
}


decl String:sGameModes[64], String:sGameMode[64];
decl String:sGameModes[64], String:sGameMode[64];
GetConVarString(g_hMPGameMode, sGameMode, sizeof(sGameMode));
GetConVarString(g_hMPGameMode, sGameMode, sizeof(sGameMode));
Format(sGameMode, sizeof(sGameMode), ",%s,", sGameMode);
Format(sGameMode, sizeof(sGameMode), ",%s,", sGameMode);


GetConVarString(g_hCvarModes, sGameModes, sizeof(sGameModes));
GetConVarString(g_hCvarModes, sGameModes, sizeof(sGameModes));
if( strcmp(sGameModes, "") )
if( strcmp(sGameModes, "") )
{
{
Format(sGameModes, sizeof(sGameModes), ",%s,", sGameModes);
Format(sGameModes, sizeof(sGameModes), ",%s,", sGameModes);
if( StrContains(sGameModes, sGameMode, false) == -1 )
if( StrContains(sGameModes, sGameMode, false) == -1 )
return false;
return false;
}
}


GetConVarString(g_hCvarModesOff, sGameModes, sizeof(sGameModes));
GetConVarString(g_hCvarModesOff, sGameModes, sizeof(sGameModes));
if( strcmp(sGameModes, "") )
if( strcmp(sGameModes, "") )
{
{
Format(sGameModes, sizeof(sGameModes), ",%s,", sGameModes);
Format(sGameModes, sizeof(sGameModes), ",%s,", sGameModes);
if( StrContains(sGameModes, sGameMode, false) != -1 )
if( StrContains(sGameModes, sGameMode, false) != -1 )
return false;
return false;
}
}


return true;
return true;
}
}


public OnGamemode(const String:output[], caller, activator, Float:delay)
public OnGamemode(const String:output[], caller, activator, Float:delay)
{
{
if( strcmp(output, "OnCoop") == 0 )
if( strcmp(output, "OnCoop") == 0 )
g_iCurrentMode = 1;
g_iCurrentMode = 1;
else if( strcmp(output, "OnSurvival") == 0 )
else if( strcmp(output, "OnSurvival") == 0 )
g_iCurrentMode = 2;
g_iCurrentMode = 2;
else if( strcmp(output, "OnVersus") == 0 )
else if( strcmp(output, "OnVersus") == 0 )
g_iCurrentMode = 4;
g_iCurrentMode = 4;
else if( strcmp(output, "OnScavenge") == 0 )
else if( strcmp(output, "OnScavenge") == 0 )
g_iCurrentMode = 8;
g_iCurrentMode = 8;
}
}






// ====================================================================================================
// ====================================================================================================
// EVENTS
// EVENTS
// ====================================================================================================
// ====================================================================================================
public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
{
ResetPlugin();
ResetPlugin();
OnRoundState(0);
OnRoundState(0);
}
}


public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
{
if( g_iPlayerSpawn == 1 && g_iRoundStart == 0 )
if( g_iPlayerSpawn == 1 && g_iRoundStart == 0 )
{
{
CreateTimer(1.0, tmrStart, _, TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(1.0, tmrStart, _, TIMER_FLAG_NO_MAPCHANGE);
}
}
g_iRoundStart = 1;
g_iRoundStart = 1;
}
}


public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
{
if( g_iPlayerSpawn == 0 && g_iRoundStart == 1 )
if( g_iPlayerSpawn == 0 && g_iRoundStart == 1 )
{
{
CreateTimer(1.0, tmrStart, _, TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(1.0, tmrStart, _, TIMER_FLAG_NO_MAPCHANGE);
}
}
g_iPlayerSpawn = 1;
g_iPlayerSpawn = 1;
}
}


public Action:tmrStart(Handle:timer)
public Action:tmrStart(Handle:timer)
{
{
OnRoundState(1);
OnRoundState(1);
}
}


OnRoundState(roundstate)
OnRoundState(roundstate)
{
{
static mystate;
static mystate;


if( roundstate == 1 && mystate == 0 )
if( roundstate == 1 && mystate == 0 )
{
{
mystate = 1;
mystate = 1;
Call_StartForward(g_hForwardRoundState);
Call_StartForward(g_hForwardRoundState);
Call_PushCell(1);
Call_PushCell(1);
Call_Finish();
Call_Finish();
}
}
else if( roundstate == 0 && mystate == 1 )
else if( roundstate == 0 && mystate == 1 )
{
{
mystate = 0;
mystate = 0;
Call_StartForward(g_hForwardRoundState);
Call_StartForward(g_hForwardRoundState);
Call_PushCell(0);
Call_PushCell(0);
Call_Finish();
Call_Finish();
}
}
}
}






// ====================================================================================================
// ====================================================================================================
// COMMANDS
// COMMANDS
// ====================================================================================================
// ====================================================================================================
public Action:CmdAirstrikeMenu(client, args)
public Action:CmdAirstrikeMenu(client, args)
{
{
ShowMenuMain(client);
ShowMenuMain(client);
return Plugin_Handled;
return Plugin_Handled;
}
}


ShowMenuMain(client)
ShowMenuMain(client)
{
{
new Handle:hMenu = CreateMenu(MainMenuHandler);
new Handle:hMenu = CreateMenu(MainMenuHandler);
AddMenuItem(hMenu, "1", "Airstrike on Crosshair");
AddMenuItem(hMenu, "1", "Airstrike on Crosshair");
AddMenuItem(hMenu, "2", "Airstrike on Position");
AddMenuItem(hMenu, "2", "Airstrike on Position");
if( g_bPluginTrigger == true )
if( g_bPluginTrigger == true )
AddMenuItem(hMenu, "3", "Airstrike Triggers");
AddMenuItem(hMenu, "3", "Airstrike Triggers");
SetMenuTitle(hMenu, "F-18 Airstrike");
SetMenuTitle(hMenu, "F-18 Airstrike");
DisplayMenu(hMenu, client, MENU_TIME_FOREVER);
DisplayMenu(hMenu, client, MENU_TIME_FOREVER);
}
}


public MainMenuHandler(Handle:menu, MenuAction:action, client, index)
public MainMenuHandler(Handle:menu, MenuAction:action, client, index)
{
{
if( action == MenuAction_End )
if( action == MenuAction_End )
{
{
CloseHandle(menu);
CloseHandle(menu);
}
}
else if( action == MenuAction_Select )
else if( action == MenuAction_Select )
{
{
if( index == 0 )
if( index == 0 )
{
{
decl Float:vPos[3], Float:vAng[3], Float:direction;
decl Float:vPos[3], Float:vAng[3], Float:direction;
GetClientEyePosition(client, vPos);
GetClientEyePosition(client, vPos);
GetClientEyeAngles(client, vAng);
GetClientEyeAngles(client, vAng);
direction = vAng[1];
direction = vAng[1];


new Handle:trace = TR_TraceRayFilterEx(vPos, vAng, MASK_SHOT, RayType_Infinite, TraceFilter);
new Handle:trace = TR_TraceRayFilterEx(vPos, vAng, MASK_SHOT, RayType_Infinite, TraceFilter);


if( TR_DidHit(trace) )
if( TR_DidHit(trace) )
{
{
decl Float:vStart[3];
decl Float:vStart[3];
TR_GetEndPosition(vStart, trace);
TR_GetEndPosition(vStart, trace);
GetAngleVectors(vAng, vAng, NULL_VECTOR, NULL_VECTOR);
GetAngleVectors(vAng, vAng, NULL_VECTOR, NULL_VECTOR);
vPos[0] = vStart[0] + vAng[0];
vPos[0] = vStart[0] + vAng[0];
vPos[1] = vStart[1] + vAng[1];
vPos[1] = vStart[1] + vAng[1];
vPos[2] = vStart[2] + vAng[2];
vPos[2] = vStart[2] + vAng[2];
ShowAirstrike(vPos, direction);
ShowAirstrike(vPos, direction);
}
}


CloseHandle(trace);
CloseHandle(trace);
ShowMenuMain(client);
ShowMenuMain(client);
}
}
else if( index == 1 )
else if( index == 1 )
{
{
decl Float:vPos[3], Float:vAng[3];
decl Float:vPos[3], Float:vAng[3];
GetClientAbsOrigin(client, vPos);
GetClientAbsOrigin(client, vPos);
GetClientEyeAngles(client, vAng);
GetClientEyeAngles(client, vAng);
ShowAirstrike(vPos, vAng[1]);
ShowAirstrike(vPos, vAng[1]);
ShowMenuMain(client);
ShowMenuMain(client);
}
}
else if( index == 2 )
else if( index == 2 )
{
{
FakeClientCommand(client, "sm_strike_triggers");
FakeClientCommand(client, "sm_strike_triggers");
}
}
}
}
}
}


public bool:TraceFilter(entity, contentsMask)
public bool:TraceFilter(entity, contentsMask)
{
{
return entity > MaxClients;
return entity > MaxClients;
}
}






// ====================================================================================================
// ====================================================================================================
// SHOW AIRSTRIKE
// SHOW AIRSTRIKE
// ====================================================================================================
// ====================================================================================================
ShowAirstrike(Float:vPos[3], Float:direction)
ShowAirstrike(Float:vPos[3], Float:direction)
{
{
new index = -1;
new index = -1;
for( new i = 0; i < MAX_ENTITIES; i++ )
for( new i = 0; i < MAX_ENTITIES; i++ )
{
{
if( IsValidEntRef(g_iEntities[i]) == false )
if( IsValidEntRef(g_iEntities[i]) == false )
{
{
index = i;
index = i;
break;
break;
}
}
}
}


if( index == -1 )
if( index == -1 )
return;
return;


decl Float:vAng[3], Float:vSkybox[3];
decl Float:vAng[3], Float:vSkybox[3];
vAng[0] = 0.0;
vAng[0] = 0.0;
vAng[1] = direction;
vAng[1] = direction;
vAng[2] = 0.0;
vAng[2] = 0.0;


GetEntPropVector(0, Prop_Data, "m_WorldMaxs", vSkybox);
GetEntPropVector(0, Prop_Data, "m_WorldMaxs", vSkybox);


new entity = CreateEntityByName("prop_dynamic_override");
new entity = CreateEntityByName("prop_dynamic_override");
g_iEntities[index] = EntIndexToEntRef(entity);
g_iEntities[index] = EntIndexToEntRef(entity);
DispatchKeyValue(entity, "targetname", "silver_f18_model");
DispatchKeyValue(entity, "targetname", "silver_f18_model");
DispatchKeyValue(entity, "disableshadows", "1");
DispatchKeyValue(entity, "disableshadows", "1");
DispatchKeyValue(entity, "model", MODEL_F18);
DispatchKeyValue(entity, "model", MODEL_F18);
DispatchSpawn(entity);
DispatchSpawn(entity);
SetEntProp(entity, Prop_Data, "m_iHammerID", RoundToNearest(vPos[2]));
SetEntProp(entity, Prop_Data, "m_iHammerID", RoundToNearest(vPos[2]));
new Float:height = vPos[2] + 1150.0;
new Float:height = vPos[2] + 1150.0;
if( height > vSkybox[2] - 200 )
if( height > vSkybox[2] - 200 )
vPos[2] = vSkybox[2] - 200;
vPos[2] = vSkybox[2] - 200;
else
else
vPos[2] = height;
vPos[2] = height;
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);


SetEntPropFloat(entity, Prop_Send, "m_flModelScale", 5.0);
SetEntPropFloat(entity, Prop_Send, "m_flModelScale", 5.0);


new random = GetRandomInt(1, 5);
new random = GetRandomInt(1, 5);
if( random == 1 )
if( random == 1 )
SetVariantString("flyby1");
SetVariantString("flyby1");
else if( random == 2 )
else if( random == 2 )
SetVariantString("flyby2");
SetVariantString("flyby2");
else if( random == 3 )
else if( random == 3 )
SetVariantString("flyby3");
SetVariantString("flyby3");
else if( random == 4 )
else if( random == 4 )
SetVariantString("flyby4");
SetVariantString("flyby4");
else if( random == 5 )
else if( random == 5 )
SetVariantString("flyby5");
SetVariantString("flyby5");
AcceptEntityInput(entity, "SetAnimation");
AcceptEntityInput(entity, "SetAnimation");
AcceptEntityInput(entity, "Enable");
AcceptEntityInput(entity, "Enable");


SetVariantString("OnUser1 !self:Kill::6.5.0:1");
SetVariantString("OnUser1 !self:Kill::6.5.0:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
AcceptEntityInput(entity, "FireUser1");


CreateTimer(0.5, tmrDrop, EntIndexToEntRef(entity));
CreateTimer(0.5, tmrDrop, EntIndexToEntRef(entity));


Call_StartForward(g_hForwardOnAirstrike);
Call_StartForward(g_hForwardOnAirstrike);
Call_PushFloat(vPos[0]);
Call_PushFloat(vPos[0]);
Call_PushFloat(vPos[1]);
Call_PushFloat(vPos[1]);
Call_PushFloat(vPos[2]);
Call_PushFloat(vPos[2]);
Call_Finish();
Call_Finish();
}
}


public Action:TimerGrav(Handle:timer, any:entity)
public Action:TimerGrav(Handle:timer, any:entity)
{
{
if( IsValidEntRef(entity) )
if( IsValidEntRef(entity) )
CreateTimer(0.1, TimerGravity, entity, TIMER_REPEAT);
CreateTimer(0.1, TimerGravity, entity, TIMER_REPEAT);
}
}


public Action:TimerGravity(Handle:timer, any:entity)
public Action:TimerGravity(Handle:timer, any:entity)
{
{
if( IsValidEntRef(entity) )
if( IsValidEntRef(entity) )
{
{
new tick = GetEntProp(entity, Prop_Data, "m_iHammerID");
new tick = GetEntProp(entity, Prop_Data, "m_iHammerID");
if( tick > 15 )
if( tick > 15 )
{
{
SDKHook(EntRefToEntIndex(entity), SDKHook_Touch, OnBombTouch);
SDKHook(EntRefToEntIndex(entity), SDKHook_Touch, OnBombTouch);
SetEntityMoveType(entity, MOVETYPE_FLYGRAVITY);
SetEntityMoveType(entity, MOVETYPE_FLYGRAVITY);
return Plugin_Stop;
return Plugin_Stop;
}
}
else
else
{
{
SetEntProp(entity, Prop_Data, "m_iHammerID", tick + 1);
SetEntProp(entity, Prop_Data, "m_iHammerID", tick + 1);


decl Float:vAng[3];
decl Float:vAng[3];
GetEntPropVector(entity, Prop_Data, "m_vecVelocity", vAng);
GetEntPropVector(entity, Prop_Data, "m_vecVelocity", vAng);
vAng[2] -= 50.0;
vAng[2] -= 50.0;
TeleportEntity(entity, NULL_VECTOR, NULL_VECTOR, vAng);
TeleportEntity(entity, NULL_VECTOR, NULL_VECTOR, vAng);
return Plugin_Continue;
return Plugin_Continue;
}
}
}
}
return Plugin_Stop;
return Plugin_Stop;
}
}


public Action:tmrDrop(Handle:timer, any:f18)
public Action:tmrDrop(Handle:timer, any:f18)
{
{
if( IsValidEntRef(f18) )
if( IsValidEntRef(f18) )
{
{
decl Float:vPos[3], Float:vAng[3], Float:vVec[3];
decl Float:vPos[3], Float:vAng[3], Float:vVec[3];
GetEntPropVector(f18, Prop_Data, "m_vecAbsOrigin", vPos);
GetEntPropVector(f18, Prop_Data, "m_vecAbsOrigin", vPos);
GetEntPropVector(f18, Prop_Data, "m_angRotation", vAng);
GetEntPropVector(f18, Prop_Data, "m_angRotation", vAng);


new entity = CreateEntityByName("grenade_launcher_projectile");
new entity = CreateEntityByName("grenade_launcher_projectile");
DispatchSpawn(entity);
DispatchSpawn(entity);
SetEntityModel(entity, MODEL_AGM65);
SetEntityModel(entity, MODEL_AGM65);


SetEntityMoveType(entity, MOVETYPE_NOCLIP);
SetEntityMoveType(entity, MOVETYPE_NOCLIP);
CreateTimer(1.2, TimerGrav, EntIndexToEntRef(entity));
CreateTimer(1.2, TimerGrav, EntIndexToEntRef(entity));


GetAngleVectors(vAng, vVec, NULL_VECTOR, NULL_VECTOR);
GetAngleVectors(vAng, vVec, NULL_VECTOR, NULL_VECTOR);
NormalizeVector(vVec, vVec);
NormalizeVector(vVec, vVec);
ScaleVector(vVec, -700.0);
ScaleVector(vVec, -700.0);


new height = GetEntProp(f18, Prop_Data, "m_iHammerID");
new height = GetEntProp(f18, Prop_Data, "m_iHammerID");
new target = RoundToNearest(vPos[2]);
new target = RoundToNearest(vPos[2]);
new Float:diff = target - height + 1600.0;
new Float:diff = target - height + 1600.0;
diff -= (diff / 10);
diff -= (diff / 10);
MoveForward(vPos, vAng, vPos, diff);
MoveForward(vPos, vAng, vPos, diff);


vPos[0] += GetRandomFloat(-1.0 * g_iCvarSpread, float(g_iCvarSpread));
vPos[0] += GetRandomFloat(-1.0 * g_iCvarSpread, float(g_iCvarSpread));
vPos[1] += GetRandomFloat(-1.0 * g_iCvarSpread, float(g_iCvarSpread));
vPos[1] += GetRandomFloat(-1.0 * g_iCvarSpread, float(g_iCvarSpread));
TeleportEntity(entity, vPos, vAng, vVec);
TeleportEntity(entity, vPos, vAng, vVec);


SetVariantString("OnUser1 !self:Kill::10.0:1");
SetVariantString("OnUser1 !self:Kill::10.0:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
AcceptEntityInput(entity, "FireUser1");


SetEntPropFloat(entity, Prop_Send, "m_flModelScale", 0.3);
SetEntPropFloat(entity, Prop_Send, "m_flModelScale", 0.3);


new projectile = entity;
new projectile = entity;




// BLUE FLAMES
// BLUE FLAMES
if( g_iCvarStyle & (1<<0) )
if( g_iCvarStyle & (1<<0) )
{
{
entity = CreateEntityByName("info_particle_system");
entity = CreateEntityByName("info_particle_system");
if( entity != -1 )
if( entity != -1 )
{
{
DispatchKeyValue(entity, "effect_name", PARTICLE_BLUE);
DispatchKeyValue(entity, "effect_name", PARTICLE_BLUE);
DispatchSpawn(entity);
DispatchSpawn(entity);
ActivateEntity(entity);
ActivateEntity(entity);
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);


SetVariantString("!activator");
SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", projectile);
AcceptEntityInput(entity, "SetParent", projectile);


SetVariantString("OnUser4 !self:Kill::10.0:1");
SetVariantString("OnUser4 !self:Kill::10.0:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser4");
AcceptEntityInput(entity, "FireUser4");
AcceptEntityInput(entity, "Start");
AcceptEntityInput(entity, "Start");
}
}
}
}




// FLAMES
// FLAMES
if( g_iCvarStyle & (1<<1) )
if( g_iCvarStyle & (1<<1) )
{
{
entity = CreateEntityByName("info_particle_system");
entity = CreateEntityByName("info_particle_system");
if( entity != -1 )
if( entity != -1 )
{
{
DispatchKeyValue(entity, "effect_name", PARTICLE_FIRE);
DispatchKeyValue(entity, "effect_name", PARTICLE_FIRE);
DispatchSpawn(entity);
DispatchSpawn(entity);
ActivateEntity(entity);
ActivateEntity(entity);
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);


SetVariantString("!activator");
SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", projectile);
AcceptEntityInput(entity, "SetParent", projectile);


SetVariantString("OnUser4 !self:Kill::10.0:1");
SetVariantString("OnUser4 !self:Kill::10.0:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser4");
AcceptEntityInput(entity, "FireUser4");
AcceptEntityInput(entity, "Start");
AcceptEntityInput(entity, "Start");
}
}
}
}




// SPARKS
// SPARKS
if( g_iCvarStyle & (1<<2) )
if( g_iCvarStyle & (1<<2) )
{
{
entity = CreateEntityByName("info_particle_system");
entity = CreateEntityByName("info_particle_system");
if( entity != -1 )
if( entity != -1 )
{
{
DispatchKeyValue(entity, "effect_name", PARTICLE_SPARKS);
DispatchKeyValue(entity, "effect_name", PARTICLE_SPARKS);
DispatchSpawn(entity);
DispatchSpawn(entity);
ActivateEntity(entity);
ActivateEntity(entity);
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);


SetVariantString("!activator");
SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", projectile);
AcceptEntityInput(entity, "SetParent", projectile);


SetVariantString("OnUser4 !self:Kill::10.0:1");
SetVariantString("OnUser4 !self:Kill::10.0:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser4");
AcceptEntityInput(entity, "FireUser4");
AcceptEntityInput(entity, "Start");
AcceptEntityInput(entity, "Start");
}
}
}
}




// RPG SMOKE
// RPG SMOKE
if( g_iCvarStyle & (1<<3) )
if( g_iCvarStyle & (1<<3) )
{
{
entity = CreateEntityByName("info_particle_system");
entity = CreateEntityByName("info_particle_system");
if( entity != -1 )
if( entity != -1 )
{
{
DispatchKeyValue(entity, "effect_name", PARTICLE_SMOKE);
DispatchKeyValue(entity, "effect_name", PARTICLE_SMOKE);
DispatchSpawn(entity);
DispatchSpawn(entity);
ActivateEntity(entity);
ActivateEntity(entity);
AcceptEntityInput(entity, "start");
AcceptEntityInput(entity, "start");
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);
TeleportEntity(entity, vPos, vAng, NULL_VECTOR);


SetVariantString("!activator");
SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", projectile);
AcceptEntityInput(entity, "SetParent", projectile);


SetVariantString("OnUser3 !self:Kill::10.0:1");
SetVariantString("OnUser3 !self:Kill::10.0:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser3");
AcceptEntityInput(entity, "FireUser3");


// Refire
// Refire
SetVariantString("OnUser1 !self:Stop::0.65:-1");
SetVariantString("OnUser1 !self:Stop::0.65:-1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
SetVariantString("OnUser1 !self:FireUser2::0.7:-1");
SetVariantString("OnUser1 !self:FireUser2::0.7:-1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
AcceptEntityInput(entity, "FireUser1");


SetVariantString("OnUser2 !self:Start::0:-1");
SetVariantString("OnUser2 !self:Start::0:-1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
SetVariantString("OnUser2 !self:FireUser1::0:-1");
SetVariantString("OnUser2 !self:FireUser1::0:-1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "AddOutput");
}
}
}
}




// SOUND
// SOUND
new random = GetRandomInt(1, 8);
new random = GetRandomInt(1, 8);
if( random == 1 )
if( random == 1 )
EmitSoundToAll(SOUND_PASS1, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
EmitSoundToAll(SOUND_PASS1, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
else if( random == 2 )
else if( random == 2 )
EmitSoundToAll(SOUND_PASS2, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
EmitSoundToAll(SOUND_PASS2, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
else if( random == 3 )
else if( random == 3 )
EmitSoundToAll(SOUND_PASS3, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
EmitSoundToAll(SOUND_PASS3, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
else if( random == 4 )
else if( random == 4 )
EmitSoundToAll(SOUND_PASS4, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
EmitSoundToAll(SOUND_PASS4, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
else if( random == 5 )
else if( random == 5 )
EmitSoundToAll(SOUND_PASS5, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
EmitSoundToAll(SOUND_PASS5, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
else if( random == 6 )
else if( random == 6 )
EmitSoundToAll(SOUND_PASS6, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
EmitSoundToAll(SOUND_PASS6, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
else if( random == 7 )
else if( random == 7 )
EmitSoundToAll(SOUND_PASS7, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
EmitSoundToAll(SOUND_PASS7, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
else if( random == 8 )
else if( random == 8 )
EmitSoundToAll(SOUND_PASS8, entity, SNDCHAN_A
EmitSoundToAll(SOUND_PASS8, entity, SNDCHAN_AUTO, SNDLEVEL_HELICOPTER);
}
}

MoveForward(const Float:vPos[3], const Float:vAng[3], Float:vReturn[3], Float:fDistance)
{
decl Float:vDir[3];
GetAngleVectors(vAng, vDir, NULL_VECTOR, NULL_VECTOR);
vReturn = vPos;
vReturn[0] += vDir[0] * fDistance;
vReturn[1] += vDir[1] * fDistance;
vReturn[2] += vDir[2] * fDistance;
}

public OnBombTouch(entity, activator)
{
decl String:sTemp[64];
GetEdictClassname(activator, sTemp, sizeof(sTemp));

if( strcmp(sTemp, "trigger_multiple") &&
strcmp(sTemp, "trigger_hurt") )
{
SDKUnhook(entity, S