AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Hook Gasstation Explosion (https://forums.alliedmods.net/showthread.php?t=327576)

finishlast 09-27-2020 05:58

Hook Gasstation Explosion
 
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…

Bacardi 09-27-2020 07:19

Re: Hook Gasstation Explosion
 
Can you show stripper dump ?
And can you also, go to elevator gas station and use command getpos, show us output

finishlast 09-27-2020 08:11

Re: Hook Gasstation Explosion
 
1 Attachment(s)
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.

Bacardi 09-27-2020 09:53

Re: Hook Gasstation Explosion
 
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);



finishlast 09-27-2020 11:03

Re: Hook Gasstation Explosion
 
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?

Bacardi 09-27-2020 11:14

Re: Hook Gasstation Explosion
 
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);
}


finishlast 09-27-2020 11:16

Re: Hook Gasstation Explosion
 
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!!!

Bacardi 09-27-2020 11:56

Re: Hook Gasstation Explosion
 
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

finishlast 09-27-2020 14:02

Re: Hook Gasstation Explosion
 
1 Attachment(s)
Thanks a lot man.

Here is what I have now :D

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.


All times are GMT -4. The time now is 12:09.

Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.