Checking where "+use" is used.
Hi. Sorry I don't have any code because I don't know where to start. Basically what I would like to do is to check if +use is not used for pushing buttons, defusing bomb, taking hostages, starting a car or other similar things and then execute my code. Otherwise if it is used for anything mentioned before then simply allow it to work and do not execute my code. It would be enough if someone could just show any plugin that has such functionality.
Thank you. |
Re: Checking where "+use" is used.
Are you saying it's possible to do those things you mentioned without using +use? If yes, it must be some sort of trigger entity in the map and you should be able to hook when a player touches the trigger (I think).
|
Re: Checking where "+use" is used.
You want your code to be executed, when the "+use" key doesn't activate ANYTHING?
What fysiks said, you can hook "Ham_Use" or a similar name, check if the hooked function was called. Another (much easier) method is to; before you check when they pushed the use key. Do a trace line (get_user_aiming) and see if there looking at a "usable" entity. Here's the second method: Code:
public client_PreThink(id) |
Re: Checking where "+use" is used.
Quote:
I was also thinking about Ham_Use but I have no idea about "..check if the hooked function was called.." part. Should I check if it returs anything when it is called by a player and if not then execute my code ? As far as I know PreThink would consume more resources than the method with Ham_Use so I'd like to give it a try. |
Re: Checking where "+use" is used.
Quote:
|
Re: Checking where "+use" is used.
Ok. Thank you, Drak. I'll use prethink :)
|
Re: Checking where "+use" is used.
Best method is to hook Ham_ObjectCaps.
|
Re: Checking where "+use" is used.
Thanks Exolent[jNr] for pointing out Ham_ObjectCaps.
Now I'm using it instead of prethink and everything works great. |
All times are GMT -4. The time now is 10:24. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.