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

[TF2] How to detect a player crouching?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Steveh
Member
Join Date: Oct 2010
Old 12-19-2010 , 06:06   [TF2] How to detect a player crouching?
Reply With Quote #1

Hello, I need some help with my plugin, It is supposed to detect when a player crouches. Unfortunately, it does not seem to be working;
PHP Code:
if(GetEntityFlags(i) & IN_DUCK){
        
PrintToChat(i"You are crouching!");

Please help, I am still new to Pawn and any help will be appreciated.

Thanks
Steveh is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 12-19-2010 , 06:36   Re: [TF2] How to detect a player crouching?
Reply With Quote #2

use OnPlayerRunCmd from sdkhooks and use the code above. while changing the "i" to "Client". you also mite need to add a buffer to the flag or it will spam "you are crouching!" in your chat.
__________________
Master(d)



Master53 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 12-19-2010 , 06:38   Re: [TF2] How to detect a player crouching?
Reply With Quote #3

It should be done (the lame way) in OnPlayerRunCmd against buttons.

But a better way is to get some NetProp, I believe I've stumbled upon something like m_bDucking or m_bIsDucking or m_bInDuck.

EDIT: Oh, god damn it, master, no need for SDK Hooks. OnPlayerRunCmd is in SM core or sdktools. But I still think OnGameFrame and netprop should do it.
__________________

Last edited by FaTony; 12-19-2010 at 06:41.
FaTony 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:26.


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