Raised This Month: $ Target: $400
 0% 

Players position on ground


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mati_
Member
Join Date: Sep 2010
Old 12-24-2010 , 01:25   Players position on ground
Reply With Quote #1

Hello,
I need to get a players position (coordinates) which is touching the ground. It has to return the same value, regardless if he's standing, half, or fully crouching.

There seems to be no engine const for that, Ham_Center looked promising but crashes the server, obv. get_user_origin doesn't make it either.

Maybe the coordinates can be received from a players feet?
Mati_ is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 12-24-2010 , 02:25   Re: Players position on ground
Reply With Quote #2

http://forums.alliedmods.net/showthr...+player+ground

->

Took the code from the above link.

PHP Code:
if( (get_user_flags(id) & FL_ONGROUND) ) {
             
// BLA!

Proper use to get player origin while on ground:

PHP Code:
if( (get_user_flags(id) & FL_ONGROUND) )
{
    new 
origin[3]
    
get_user_originindexorigin)

__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-24-2010 , 02:29   Re: Players position on ground
Reply With Quote #3

You can use pev_origin x and y and pev_absmin z
PHP Code:
new Float:flTempFloat:fVecGround[3]
pev(idpev_absminsfVecGround)
flTemp fVecGround[2]
pev(idpev_originfVecGround)
fVecGround[2] = flTemp 1.0 

Also you can consider GetBonePosition (see snippet forum and fakemeta functions descriptions)
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 12-24-2010 at 12:46.
ConnorMcLeod is offline
Mati_
Member
Join Date: Sep 2010
Old 12-24-2010 , 10:28   Re: Players position on ground
Reply With Quote #4

Nice, thanks Connor!
Mati_ is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-24-2010 , 11:08   Re: Players position on ground
Reply With Quote #5

You will have to add 1 unit to fVecGround[2] to get correct origin.
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-24-2010 , 12:47   Re: Players position on ground
Reply With Quote #6

Edited.

Also : http://forums.alliedmods.net/showpos...&postcount=103
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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:03.


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