Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include sdkhooks
- #pragma tabsize 0
- float GrenadeRadius = 1000.0
- float PipeBombRadius = 1000.0
- float BarrelRadius = 1000.0
- bool IsAllow = false;
- Handle g_hConfStagger;
- public OnPluginStart()
- {
- Handle hConf = LoadGameConfigFile("StaggerInfected");
- if( hConf == null )
- 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 == null )
- SetFailState("Could not prep the 'CTerrorPlayer::OnStaggered' function.");
- }
- public OnMapStart()
- {
- IsAllow = false;
- CreateTimer(3.0, allow)
- }
- public Action allow(Handle timer)
- {
- IsAllow = true;
- }
- public void OnEntityDestroyed(int entity)
- {
- if(!IsAllow) return;
- if (IsValidEntity(entity) && IsValidEdict(entity))
- {
- char classname[128];
- GetEntityClassname(entity, classname, sizeof(classname));
- if (StrEqual(classname, "grenade_launcher_projectile", false))
- {
- GrenadeTouch(entity);
- }
- if (StrEqual(classname, "pipe_bomb_projectile", false))
- {
- BombTouch(entity);
- }
- if (StrEqual(classname, "prop_fuel_barrel", false))
- {
- BarrelTouch(entity);
- }
- }
- }
- public int GrenadeTouch(int entity)
- {
- float pos[3];
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
- GranadeExplode(pos);
- }
- public int BombTouch(int entity)
- {
- float pos[3];
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
- BombExplode(pos)
- }
- public int BarrelTouch(int entity)
- {
- float pos[3];
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
- BarrelExplode(pos);
- }
- int GranadeExplode(float pos[3])
- {
- float fDistance = 0.0;
- float pos2[3];
- for( int i = 0; i < 32; i++ )
- {
- if(IsValidClient(i) && GetClientTeam(i) == 3)
- {
- int vClass = GetEntProp(i, Prop_Send, "m_zombieClass")
- if(vClass == 6)
- {
- GetClientAbsOrigin(i, pos2);
- fDistance = GetVectorDistance(pos, pos2);
- if(fDistance < GrenadeRadius)
- {
- SDKCall(g_hConfStagger, i, 0.0, pos2);
- }
- }
- }
- }
- }
- int BombExplode(float pos[3])
- {
- float fDistance = 0.0;
- float pos2[3];
- for( int i = 0; i < 32; i++ )
- {
- if(IsValidClient(i) && GetClientTeam(i) == 3)
- {
- int vClass = GetEntProp(i, Prop_Send, "m_zombieClass")
- if(vClass == 6)
- {
- GetClientAbsOrigin(i, pos2);
- fDistance = GetVectorDistance(pos, pos2);
- if(fDistance < PipeBombRadius)
- {
- SDKCall(g_hConfStagger, i, 0.0, pos2);
- }
- }
- }
- }
- }
- int BarrelExplode(float pos[3])
- {
- float fDistance = 0.0;
- float pos2[3];
- for( int i = 0; i < 32; i++ )
- {
- if(IsValidClient(i) && GetClientTeam(i) == 3)
- {
- int vClass = GetEntProp(i, Prop_Send, "m_zombieClass")
- if(vClass == 6)
- {
- GetClientAbsOrigin(i, pos2);
- fDistance = GetVectorDistance(pos, pos2);
- if(fDistance < BarrelRadius)
- {
- SDKCall(g_hConfStagger, i, 0.0, pos2);
- }
- }
- }
- }
- }
- stock bool:IsValidClient(client)
- {
- if ( client < 1 || client > MaxClients ) return false;
- if ( !IsClientConnected( client )) return false;
- if ( !IsClientInGame( client )) return false;
- if ( GetClientTeam( client ) != 3 ) return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement