Veteran Member
Join Date: Jan 2010
Location: mom's basement
|
09-27-2020
, 08:53
Re: Hook Gasstation Explosion
|
#4
|
I just guessing, there is logic_relay: gasstation_explosion_relay (and gaspumps have own relays too)
Code:
{
"origin" "12208 6368 112"
"targetname" "gasstation_explosion_relay"
"spawnflags" "1"
"classname" "logic_relay"
"hammerid" "5154080"
"OnTrigger" "gasstation_destructibles,SetAnimation,boom,0.1,-1"
"OnTrigger" "gasstation_destructibles,Enable,,0,-1"
"OnTrigger" "gasstation_brushes,Kill,,0,-1"
"OnTrigger" "gasstation_poles,Kill,,0,-1"
"OnTrigger" "pipe_fire_under,Start,,0,-1"
"OnTrigger" "gasstation_clip_brush,Enable,,1,-1"
"OnTrigger" "gasstation_garbagecan,Kill,,0,-1"
"OnTrigger" "gasstation_pit,Enable,,1,-1"
"OnTrigger" "pump02,Kill,,1,-1"
"OnTrigger" "pump01,Kill,,1,-1"
"OnTrigger" "gaspump02_main_relay,Trigger,,0.1,-1"
"OnTrigger" "gaspump02_first_main_relay,Trigger,,0.1,-1"
"OnTrigger" "gaspump01_main_relay,Trigger,,0.1,-1"
"OnTrigger" "gaspump01_first_main_relay,Trigger,,0.1,-1"
"OnTrigger" "gas_explosion_sound,PlaySound,,0,-1"
"OnTrigger" "gas_impact_sound,PlaySound,,3.1,-1"
"OnTrigger" "gasstation_endstate,Enable,,1,-1"
"OnTrigger_" "gasstation_destructibles,Disable,,10.1,-1"
"OnTrigger" "explosion3,Start,,0.5,-1"
"OnTrigger" "gasstationshake2,StartShake,,0,-1"
"OnTrigger" "gasstation_push_trigger,Disable,,1,-1"
"OnTrigger" "gasstation_hurt_trigger,Disable,,1,-1"
"OnTrigger" "gasstation_endstate,EnableCollision,,1,-1"
"OnTrigger" "gasstation_push_trigger,Enable,,0,-1"
"OnTrigger" "gasstation_hurt_trigger,Enable,,0,-1"
"OnTrigger" "light_explosion,TurnOn,,0,-1"
"OnTrigger" "gasstation_rain,Stop,,0,-1"
"OnTrigger" "gasstation_rain_trigger,Disable,,0,-1"
"OnTrigger" "debris_door,Close,,1,-1"
}
And gaspump relays trigger this logic.
Code:
...
"OnTrigger" "gasstation_explosion_relay,Trigger,,1,-1"
...
So, there is two way.
Listen globally entity outputs
PHP Code:
#include <sdktools>
public void OnPluginStart()
{
HookEntityOutput("logic_relay", "OnTrigger", OnTrigger);
}
public void OnTrigger(const char[] output, int caller, int activator, float delay)
{
char m_iName[MAX_NAME_LENGTH];
GetEntPropString(caller, Prop_Data, "m_iName", m_iName, sizeof(m_iName));
if(!StrEqual(m_iName, "gasstation_explosion_relay", false)) return;
PrintToChatAll("- OnTrigger 'gasstation_explosion_relay' index %i", caller);
}
Or you find entity and hook it.
But you need hook on round_freeze_end or else event. OnMapStart maybe works in L4D, I'm not sure.
PHP Code:
#include <sdktools>
public void OnPluginStart()
{
HookEvent("round_freeze_end", round_freeze_end, EventHookMode_PostNoCopy);
}
public void round_freeze_end(Event event, char[] name, bool dontBroadcast)
{
int entity = -1;
char m_iName[MAX_NAME_LENGTH];
while( (entity = FindEntityByClassname(entity, "logic_relay")) != -1 )
{
GetEntPropString(entity, Prop_Data, "m_iName", m_iName, sizeof(m_iName));
if(!StrEqual(m_iName, "gasstation_explosion_relay", false)) continue;
// Fire this hook once and remove it.
HookSingleEntityOutput(entity, "OnTrigger", OnTrigger, true);
break;
}
}
public void OnTrigger(const char[] output, int caller, int activator, float delay)
{
PrintToChatAll("- OnTrigger 'gasstation_explosion_relay' index %i", caller);
}
__________________
Do not Private Message @me
Last edited by Bacardi; 09-27-2020 at 10:48.
Reason: fix code, logic_ don't have entity index
|
|