[Solved for now]Player in duct (?
Which is the best way to detect if a player is inside a duct (ventilations)?
Once he is inside there's no need to duck so checking player's buttons in inefficient. I was thinking in force player to stand up and check if he could/couldn't, but I'm not sure how to proceed :/ It's for hns to avoid planting lasermines inside ducts ._. Any help will be appreciated ^_^ |
Re: Player in duct (?
By hooking Ham_Duck. (Not sure if this is it's right name. AFAIK this ham is called in the time, while the user is ducking. So you can set protection from these mines in the function of this ham.
|
Re: Player in duct (?
Quote:
It will detect duck when the player presses duck key and not detect when hes in vent ( duck without pressing the key) So i would suggest to try getting flags for ducking Youfunction() if(pev(id, pev_flags) & FL_DUCKIN) // hes ducking I'm sure it detects player size and not the key so it will work inside vents |
Re: Player in duct (?
Quote:
|
Re: Player in duct (?
Quote:
|
Re: Player in duct (?
You can quite easily check if a player is in a spot where they can not stand up using a EngFunc_TraceHull call. Simply get the origin and add some amount to the z axis (going upwards) and use that as the trace target. If TR_AllSolid is false and TR_flFraction is smaller than 1.0 the player is in a space where they can not stand up. You maybe have to play around a little with how far you need to move up to accurately detect this.
|
Re: Player in duct (?
A simple trace_hull() call should suffice.
|
Re: Player in duct (?
These are my 2 options .-.
PHP Code:
PHP Code:
Will be testing later :) |
Re: Player in duct (?
4 Attachment(s)
Bumping ^ Here are the results
https://forums.alliedmods.net/attach...1&d=1404156929 https://forums.alliedmods.net/attach...1&d=1404156929 https://forums.alliedmods.net/attach...1&d=1404156929 https://forums.alliedmods.net/attach...1&d=1404156929 TR_AllSolid turns to true inside ventilations & turns false outside. TR_flFraction always in 1.0 no matter where I am. In other words, I wasn't able to accurate detect if a player is inside ducts :/ This is my current stock PHP Code:
Any help? :c |
Re: Player in duct (?
It's obvious.
PHP Code:
|
| All times are GMT -4. The time now is 21:15. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.