Raised This Month: $ Target: $400
 0% 

Detect player moving


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-30-2011 , 20:08   Re: Detect player moving
Reply With Quote #11

Quote:
Originally Posted by SonicSonedit View Post
xbatista
The best way is well known: check velocity on prethink.
Apparently the best ways are not well known if you prefer using prethink.

Quote:
Originally Posted by SonicSonedit
Bugsy
This will not detect player movement, unless player will press a button.
I know that, did you read his post or just the thread title? He requested a method to detect if a player is walking or running which cannot be done (under normal circumstances) without an IN_button being pressed.
__________________

Last edited by Bugsy; 04-30-2011 at 20:18.
Bugsy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-30-2011 , 20:54   Re: Detect player moving
Reply With Quote #12

https://forums.alliedmods.net/showpo...13&postcount=1
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 04-30-2011 , 22:36   Re: Detect player moving
Reply With Quote #13

Quote:
Originally Posted by SonicSonedit View Post
This will not detect player movement, unless player will press a button.
I'm a little fuzzy, but don't players need to press buttons to move?
__________________
Hi.
Kreation is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-01-2011 , 00:13   Re: Detect player moving
Reply With Quote #14

Quote:
Originally Posted by Kreation View Post
I'm a little fuzzy, but don't players need to press buttons to move?
Falling.
__________________
fysiks is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-01-2011 , 03:38   Re: Detect player moving
Reply With Quote #15

Quote:
Originally Posted by Bugsy View Post
I know that, did you read his post or just the thread title? He requested a method to detect if a player is walking or running which cannot be done (under normal circumstances) without an IN_button being pressed.
Well, plugins force player to move pretty often. And push entities on some maps also do.
But if he needs to detect movement only when player moves intentively, your method is the best.
__________________

SonicSonedit is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-01-2011 , 04:56   Re: Detect player moving
Reply With Quote #16

But why just checking velocity is more than 0 woulnd't help?
__________________
xbatista is offline
Send a message via Skype™ to xbatista
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-01-2011 , 05:02   Re: Detect player moving
Reply With Quote #17

xbatista
It surely will help. But method suggested by Bugsy will use much less resources, yet his method doesn't detect player movement if player doesn't press a button (it will not detect falling/flying/surfing/pushing/etc).
__________________


Last edited by SonicSonedit; 05-01-2011 at 05:07.
SonicSonedit is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-01-2011 , 05:11   Re: Detect player moving
Reply With Quote #18

I know how to detect player is moving , I have made in my plugin, but I need also to detect , if he falls/surfing/knockedback etc.
So, the best way will be to check player's velocity?

new Float:Velo[3];
get_user_velocity( id, Velo);

if ( Velo[0] > 0.0 || Velo[1] > 0.0 || Velo[2] > 0.0 )
__________________

Last edited by xbatista; 05-01-2011 at 05:17.
xbatista is offline
Send a message via Skype™ to xbatista
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-01-2011 , 05:41   Re: Detect player moving
Reply With Quote #19

Quote:
So, the best way will be to check player's velocity?
In your case, yes.

PHP Code:
static Float:Velocity[3], i
pev
(idpev_velocityVelocity)

if (
Velocity[0] > 0.0 || Velocity[1] > 0.0 || Velocity[2] > 0.0
Use static: the differance between new and static is that static variables are not allocated (destroyed&re-created) each time function is called, and prethink is called goddamn pretty often. You can also check some KZ & Deathrun plugins, they are really good examples.
__________________

SonicSonedit is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-01-2011 , 08:27   Re: Detect player moving
Reply With Quote #20

I doubt he's gonna use that in prethink. And what's that i for, Sonic?
__________________
hleV 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 08:10.


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