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

How to make a script refer to ingame entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Porcellian
Member
Join Date: Oct 2017
Old 11-09-2020 , 09:38   How to make a script refer to ingame entity
Reply With Quote #1

Hi,

If I press a button on a map, it will teleport all players to a room. However, I need my plugin to be able to access this button somehow.

This entity is called "Meeting", how can I access that Entity using a script in my plugin?

(This is for CSGO)

Last edited by Porcellian; 11-09-2020 at 09:50. Reason: added game
Porcellian is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 11-09-2020 , 10:20   Re: How to make a script refer to ingame entity
Reply With Quote #2

1. Use FindEntityByClassname to find entities with a certain classname. Since your target entity is a button, I'm assuming the classname is "func_button" but of course I don't know the details of that entity so you'll have to find that out on your own.
2. If the button has a targetname, you can check its "m_iName" prop so you can filter out other func_buttons or entities with the same classname as your target entity. Of course, you may have other means of checking which entity you're looking for so that's for you to figure out as well.
3a. If you want to press the button yourself, you can use AcceptEntityInput to send the "Press" input to that button.
3b. If you want to catch the output of the button, you can use HookSingleEntityOutput to catch the "OnPressed" output.
__________________
Psyk0tik 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 02:56.


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