Raised This Month: $12 Target: $400
 3% 

Solved Hook Gasstation Explosion


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 09-27-2020 , 04:58   Hook Gasstation Explosion
Reply With Quote #1

Hi there,

does anyone know how to hook the gasstation explosion?

I looked at the
[L4D] No Mercy's Elevator [APRIL/2020]
https://forums.alliedmods.net/showth...elevator+doors

He hooks the elevator by

HookSingleEntityOutput(entity, "OnReachedBottom", OnReachedBottom, true);

What entity would it be to hook the gasstation explosion? And how would I find that one out? Tried stripper_dump but don't know what to look for.


Basically I want the plugin to hook explosion, set off a mega horde and catapult 2-3 cars high away from the gasstation in the direction of the burger sign.

Give the lil oops moment to the players with luck incap a player with one of those cars…
__________________

Last edited by finishlast; 09-28-2020 at 01:05.
finishlast is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-27-2020 , 06:19   Re: Hook Gasstation Explosion
Reply With Quote #2

Can you show stripper dump ?
And can you also, go to elevator gas station and use command getpos, show us output
__________________
Do not Private Message @me

Last edited by Bacardi; 09-27-2020 at 06:21.
Bacardi is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 09-27-2020 , 07:11   Re: Hook Gasstation Explosion
Reply With Quote #3

This is the position right unter the gasstation.

setang 18.078381 89.387306 0.000000
setpos 12386.853516 6288.364258 116.332886;

Stripper Dump attached.
Attached Files
File Type: zip l4d_vs_hospital03_sewers.0000.cfg.zip (57.4 KB, 32 views)
__________________

Last edited by finishlast; 09-27-2020 at 07:13.
finishlast is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-27-2020 , 08:53   Re: Hook Gasstation Explosion
Reply With Quote #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[] outputint callerint activatorfloat delay)
{
    
char m_iName[MAX_NAME_LENGTH];
    
GetEntPropString(callerProp_Data"m_iName"m_iNamesizeof(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_endEventHookMode_PostNoCopy);
}

public 
void round_freeze_end(Event eventchar[] namebool dontBroadcast)
{
    
int entity = -1;
    
char m_iName[MAX_NAME_LENGTH];

    while( (
entity FindEntityByClassname(entity"logic_relay")) != -)
    {
        
GetEntPropString(entityProp_Data"m_iName"m_iNamesizeof(m_iName));

        if(!
StrEqual(m_iName"gasstation_explosion_relay"false)) continue;


        
// Fire this hook once and remove it.
        
HookSingleEntityOutput(entity"OnTrigger"OnTriggertrue);
        break;
    }
}

public 
void OnTrigger(const char[] outputint callerint activatorfloat 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
Bacardi is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 09-27-2020 , 10:03   Re: Hook Gasstation Explosion
Reply With Quote #5

Thanks you, I tried both suggestions but I don't see anything in chat when I shoot the gas station.

Any idea why it might not give any output?
__________________
finishlast is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-27-2020 , 10:14   Re: Hook Gasstation Explosion
Reply With Quote #6

Dam, I have maybe do something wrong.

*edit
Just for test, edit
Code:
public void OnTrigger(const char[] output, int caller, int activator, float delay)
{
    if(caller > MaxClients)
    {
        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);
    }
} 

to

public void OnTrigger(const char[] output, int caller, int activator, float delay)
{
        PrintToChatAll("- OnTrigger 'gasstation_explosion_relay' index %i", caller);
} 

Last edited by Bacardi; 09-27-2020 at 10:15.
Bacardi is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 09-27-2020 , 10:16   Re: Hook Gasstation Explosion
Reply With Quote #7

This fires


- OnTrigger 'gasstation_explosion_relay' index -2119029715
- OnTrigger 'gasstation_explosion_relay' index -2134451156
- OnTrigger 'gasstation_explosion_relay' index -2104460105
- OnTrigger 'gasstation_explosion_relay' index -2137469871
- OnTrigger 'gasstation_explosion_relay' index -2046321482
- OnTrigger 'gasstation_explosion_relay' index -2073998298
- OnTrigger 'gasstation_explosion_relay' index -2107548637

I found it!

changed

if(!StrEqual(
to
if(StrEqual(

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)){
PrintToChatAll("- OnTrigger 'gasstation_explosion_relay' index %i", caller);
}


Thanks a lot!!!
__________________

Last edited by finishlast; 09-27-2020 at 10:37.
finishlast is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-27-2020 , 10:56   Re: Hook Gasstation Explosion
Reply With Quote #8

Yes. I had to make a test map to look problem.
I didn't know that logic_* don't have entity index (above zero).

I fix my previous examples
__________________
Do not Private Message @me
Bacardi is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 09-27-2020 , 13:02   Re: Hook Gasstation Explosion
Reply With Quote #9

Thanks a lot man.

Here is what I have now

Unexpected, when you stand in the car's way!

Unfortunately the car can't fly to the burger sign, there must be some transparent barrier blocking it at the truck.

So now it flies to the other side, that's OK too.


One strange thing occurres though, when you jump on that car and then jump again, it pulls you away to one direction.

I have no idea what is causing it. When you jump on the car pre explode it is normal.

I replace the car after six seconds with another one, that fixes it.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_hospital03_sewers_pimp.sp - 82 views - 3.5 KB)
__________________

Last edited by finishlast; 09-29-2020 at 16:44.
finishlast is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode