AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   can't block use l4d (https://forums.alliedmods.net/showthread.php?t=322308)

Alexmy 03-23-2020 07:46

can't block use l4d
 
Hi, I'm trying to block a call but nothing works for me, I tried to block on other cards, everything goes well. All that comes out is to kill the essence
https://yadi.sk/i/NWcO7KLF8gxMDA
PHP Code:

    int entity = -1;
        while ((
entity FindEntityByClassname(entity"func_button")) != -1)
        {
            
AcceptEntityInput(entity"Lock");
        
//    if(IsGameLockUse(entity))    
        //        AcceptEntityInput(entity, "Lock");



Silvers 03-23-2020 11:16

Re: can't block use l4d
 
Works for me:

PHP Code:

#include <sdktools>

public void OnPluginStart()
{
    
RegAdminCmd("sm_lock"sm_lockADMFLAG_ROOT);
}

public 
Action sm_lock(int clientint args)
{
    
int entity = -1;
    
char sName[32];

    while( (
entity FindEntityByClassname(entity"func_button")) != INVALID_ENT_REFERENCE )
    {
        
GetEntPropString(entityProp_Data"m_iName"sNamesizeof(sName));
        if( 
strcmp(sName"washer_lift_button2") == )
        {
            
PrintToServer("LOCKED");
            
AcceptEntityInput(entity"Lock");
        }
    }

    return 
Plugin_Handled;



Dragokas 03-23-2020 11:27

Re: can't block use l4d
 
This happens because game already has another one entity that unlocks this button.

For further reference to understand what's going on on the map use Input Hooks by SilverShot.
Quote:

11:07:57 Ent 1427 func_button Cmd Unlock . Name "washer_lift_button2 " Param . Act 5 в˜Ј Drakoshka в˜Ј
As a walkaround, I opened hammer -> Map Entity Report -> func_button -> search for that button, open its properties (Alt + Enter), see "Inputs", see who apply "Unlock". It's "math_counter" entity. So, you can lock it instead. Desired button is already locked when map starts, so you don't need lock it again.

PHP Code:

public void OnPluginStart()
{
    
HookEventEx("round_freeze_end",        Event_RoundStartFreezeEnd,        EventHookMode_PostNoCopy);
}

public 
void Event_RoundStartFreezeEnd(Event event, const char[] namebool dontBroadcast)
{
    
char sName[64];
    
int entity = -1;
    
    while ((
entity FindEntityByClassname(entity"math_counter")) != -1
    {
        
GetEntPropString(entityProp_Data"m_iName"sNamesizeof(sName));
        
        if( 
strcmp(sName"washer_lift_button_counter") == )
        {
            
AcceptEntityInput(entity"Disable");
        }
    }  



Alexmy 03-24-2020 07:51

Re: can't block use l4d
 
Quote:

Originally Posted by Silvers (Post 2688171)
Works for me:

PHP Code:

#include <sdktools>

public void OnPluginStart()
{
    
RegAdminCmd("sm_lock"sm_lockADMFLAG_ROOT);
}

public 
Action sm_lock(int clientint args)
{
    
int entity = -1;
    
char sName[32];

    while( (
entity FindEntityByClassname(entity"func_button")) != INVALID_ENT_REFERENCE )
    {
        
GetEntPropString(entityProp_Data"m_iName"sNamesizeof(sName));
        if( 
strcmp(sName"washer_lift_button2") == )
        {
            
PrintToServer("LOCKED");
            
AcceptEntityInput(entity"Lock");
        }
    }

    return 
Plugin_Handled;



This does not work in Left 4 Dead. I've already tried it like this.

Alexmy 03-24-2020 07:52

Re: can't block use l4d
 
Quote:

Originally Posted by Dragokas (Post 2688174)
This happens because game already has another one entity that unlocks this button.

For further reference to understand what's going on on the map use Input Hooks by SilverShot.


As a walkaround, I opened hammer -> Map Entity Report -> func_button -> search for that button, open its properties (Alt + Enter), see "Inputs", see who apply "Unlock". It's "math_counter" entity. So, you can lock it instead. Desired button is already locked when map starts, so you don't need lock it again.

PHP Code:

public void OnPluginStart()
{
    
HookEventEx("round_freeze_end",        Event_RoundStartFreezeEnd,        EventHookMode_PostNoCopy);
}

public 
void Event_RoundStartFreezeEnd(Event event, const char[] namebool dontBroadcast)
{
    
char sName[64];
    
int entity = -1;
    
    while ((
entity FindEntityByClassname(entity"math_counter")) != -1
    {
        
GetEntPropString(entityProp_Data"m_iName"sNamesizeof(sName));
        
        if( 
strcmp(sName"washer_lift_button_counter") == )
        {
            
AcceptEntityInput(entity"Disable");
        }
    }  



Is it too early during the game, can I temporarily block the call?

Dragokas 03-24-2020 07:59

Re: can't block use l4d
 
Works for me. I don't understand your question.

Silvers 03-24-2020 09:46

Re: can't block use l4d
 
Quote:

Originally Posted by Alexmy (Post 2688304)
This does not work in Left 4 Dead. I've already tried it like this.

I tested this in both L4D1 and L4D2, it worked. So either you're doing something wrong or have something already manipulating that entity breaking it.


Quote:

Originally Posted by Alexmy (Post 2688305)
Is it too early during the game, can I temporarily block the call?

I never use this event, what's wrong with using "round_start"? That shouldn't be too early.

Alexmy 03-24-2020 12:48

Re: can't block use l4d
 
Quote:

Originally Posted by Silvers (Post 2688323)
I tested this in both L4D1 and L4D2, it worked. So either you're doing something wrong or have something already manipulating that entity breaking it.



I never use this event, what's wrong with using "round_start"? That shouldn't be too early.

I tried your code and it doesn't work either :D

Dragokas 03-24-2020 13:00

Re: can't block use l4d
 
Alex, surely it will not work. Did you even read what I wrote to you?

Marttt 03-24-2020 16:04

Re: can't block use l4d
 
Maybe something else is "unlocking" the button, usually a "trigger_multiple"

But I bet that you guys tested in the same place from the screenshot, so I don't know.

Well, my advice for other maps.

I usually remove that unlocks/locks by stripper but you can make it through plugin too.

The stripper way I can explain, would be something like that:

Spoiler


The easiest way to found how the entity is being un/locked, is finding first the entity's targetname from the func_button, I do that with Silvers Dev Cmds Plugin, by typing !ent while aiming to the button.

After that I look through the stripper_dump file generated, where is "planeswitch_button" referenced.

Sometimes to lock you have to change the spawnflags too, depending on the entity classname.


All times are GMT -4. The time now is 02:14.

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