How to block PlayerUse ?
Edit (ConnorMcLeod) : Posts moved from http://forums.alliedmods.net/showthr...74#post1444174
If you want to block PlayerUse, than I would suggest to change pev_button at FM_PlayerPreThink pre to: PHP Code:
|
Re: Ghost after death
Hook FM_Use could be better since you just want to supercede all kind of use.
|
Re: Ghost after death
Quote:
|
Re: Ghost after death
You mean objects such as buttons ?
|
Re: Ghost after death
Yes. If player uses a button, than two use functions should be called:
1. Player using the button. 2. Button using a door or a camera or whatever. FM_Use will not hook the first one. In other words FM_Use isn't called when player uses something with +use button, that's why I think it's best to block the key or the search of entities near by. Also for example func_pushable object isn't called neither by FM_Use, neither by Ham_Use (though here I may be wrong, but all I'm sure that returning HAM_SUPERCEDE inside Ham_Use for pushable objects doesn't block player from grabbing and later moving the object). |
Re: Ghost after death
Then yes, can be disabled from client_PostThink forward.
So following code should block any kind of use : PHP Code:
About plugin, fakemeta_util is not used, don't include it. |
Re: Ghost after death
Well, I personally would still suggest prethink, cause than you won't have to worry about possible problems with m_afButtonReleased (engine may think that it was never released, what may cause problems).
|
Re: Ghost after death
But Use is checked at PostThink and in PreThink you would have to set those 3 ones to.
Also, if you don't care about vehicles, you can just do the same code at EmitSound : PHP Code:
WAIT, gonna do a nice thing for this thread :P Edit : done, posts moved, his release thread was turning into code discussion :) |
Re: How to hook PlayerUse ?
Nice... Moved posts. Though I do think that "How to block PlayerUse ?" would fit a bit more than "How to hook PlayerUse ?" for thread name. =P
And the reason why I am suggesting to use PlayerPreThink rather than PlayerPostThink is because if using Post, than you will have IN_USE set in pev_oldbuttons, at functions where it shouldn't be there. In other words if you are holding IN_USE and block it at every PlayerPostThink, than during the time when you are holding your use key, pev_oldbuttons will have IN_USE in them. That won't necessary lead to some engine glitches (though it might - here I'm just guessing), but it can cause problems with other plugins what detect when you release USE key (this once I can say for sure - don't know if such a plugin exists, but it wont he hard to create one). |
Re: How to block PlayerUse ?
I don't think pev->oldbuttons are used anywhere.
About plugins you are right but pdatas should be checked then instead of oldbuttons, better to make plugins act as the game does. So, you recommand to do stuff at PreThink (POST) right ? I recommand PostThink (PRE). Also, if you don't care about vehicles but only buttons and objects, i recommande EmitSound method that is more efficient and uses less cpu. Last, m_afButtonPressed can be checked only if button doesn't contain IN_USE and m_afButtonReleased can be check only in the other case, gonna update code later. |
Re: How to block PlayerUse ?
Variable pev->oldbuttons itself is checked when jumping. Am not sure is it checked anywhere for IN_USE, but I'd rather be safe than sorry.
No, I recommend PreThink pre. In any way both of our methods will work. Except that my is based on "better safe than sorry", and wont make glitches for various plugins. Well, blocking emit_sound will just block emitted sound of the player. You mean m_afButtonPressed can be checked only if oldbuttons don't contain IN_USE, and release if old do contain. |
Re: How to block PlayerUse ?
No, i mean this following code blocks any object use, but will not block vehicle use, so for such block it is more efficient than other methods :
PHP Code:
|
Re: How to block PlayerUse ?
Isn't that sound for switching the weapons? Isn't it better to use ham and supercede it on func_vehicle entities?
|
Re: How to block PlayerUse ?
hm, one question.
Event of open door and event of touch button (in deathrun maps) - it's different event's? |
Re: How to block PlayerUse ?
If you need to use a button it's the same, but if the only fact to touch makes the door open, then it's different.
|
Re: How to block PlayerUse ?
@Connor
Quote:
|
Re: How to block PlayerUse ?
Quote:
|
Re: How to block PlayerUse ?
Quote:
|
Re: How to block PlayerUse ?
Quote:
2. Yes, if you already knows what entities exist on the map. |
Re: How to block PlayerUse ?
Quote:
"Don't act like a bitch." Grow up. :) |
Re: How to block PlayerUse ?
i try it on the player who is using tank but did not work is there othere way pleas ?
|
All times are GMT -4. The time now is 13:08. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.