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

Trigger a button like func_door?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
inspire
Junior Member
Join Date: Aug 2010
Old 10-19-2020 , 14:51   Trigger a button like func_door?
Reply With Quote #1

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.
inspire is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 10-19-2020 , 23:07   Re: Trigger a button like func_door?
Reply With Quote #2

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.
Drixevel is offline
inspire
Junior Member
Join Date: Aug 2010
Old 10-20-2020 , 20:05   Re: Trigger a button like func_door?
Reply With Quote #3

cant get it to work, with your lines above.
inspire is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 10-21-2020 , 01:56   Re: Trigger a button like func_door?
Reply With Quote #4

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.
Drixevel is offline
Reply



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 11:10.


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