AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Trigger a button like func_door? (https://forums.alliedmods.net/showthread.php?t=327979)

inspire 10-19-2020 14:51

Trigger a button like func_door?
 
Does anyone know how I trigger for example that a CT has pressed a button, and shows that in public chat?

using ent "func_door"

Could be nice if anyone could help me.

Drixevel 10-19-2020 23:07

Re: Trigger a button like func_door?
 
Code:

public void OnPluginStart()
{
        HookEntityOutput("func_door", "OnFullyOpen", OnDoorOpened);
}

public void OnDoorOpened(const char[] output, int caller, int activator, float delay)
{
        if (activator > 0 && activator <= MaxClients && GetClientTeam(activator) == 3)
                PrintToChatAll("%N has opened the door.", activator);
}

Something like this if it's a door and it's fully opened. There's a lot of things you can change with this to get it how you want.

inspire 10-20-2020 20:05

Re: Trigger a button like func_door?
 
cant get it to work, with your lines above.

Drixevel 10-21-2020 01:56

Re: Trigger a button like func_door?
 
Code:

public void OnPluginStart()
{
        HookEntityOutput("func_button", "OnPressed", OnButtonPressed);
}

public void OnButtonPressed(const char[] output, int caller, int activator, float delay)
{
        if (activator > 0 && activator <= MaxClients && GetClientTeam(activator) == 3)
                PrintToChatAll("%N has pressed a button.", activator);
}

Think I misunderstood what you meant by using ent "func_door", this should work for buttons and only be called if you're a CT.


All times are GMT -4. The time now is 19:54.

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