Raised This Month: $ Target: $400
 0% 

Distances and units:Solved:


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BigMac
Member
Join Date: Jul 2009
Old 12-04-2010 , 20:01   Distances and units:Solved:
Reply With Quote #1

How to detect if a player is 2 unit away from the ground?
__________________

Last edited by BigMac; 12-05-2010 at 15:05.
BigMac is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-04-2010 , 20:07   Re: Distances and units
Reply With Quote #2

Genious method.
Code:
#include <engine>   public Something(client) {         if (GetDistanceFromGround(client) == 2)         {                 // It's good         } }   GetDistanceFromGround(client) {         // Check if player is on ground?         // if (entity_get_int(client, EV_INT_flags) & FL_ONGROUND)         //         return 0;           new Float:clientOrigin[3], Float:groundOrigin[3];           entity_get_vector(client, EV_VEC_origin, clientOrigin);         drop_to_floor(client);         entity_get_vector(client, EV_VEC_origin, groundOrigin);         entity_set_origin(client, clientOrigin);           return floatround(vector_distance(clientOrigin, groundOrigin)); }
/sarcasm
__________________

Last edited by hleV; 12-04-2010 at 20:11.
hleV is offline
BigMac
Member
Join Date: Jul 2009
Old 12-04-2010 , 20:12   Re: Distances and units
Reply With Quote #3

Thanks will try this
__________________
BigMac is offline
BigMac
Member
Join Date: Jul 2009
Old 12-04-2010 , 20:55   Re: Distances and units
Reply With Quote #4

PHP Code:
public Something(id)
{
 if (
GetDistanceFromGround(id) == 2)
 {
  
client_print(0print_chat"testing");
 }
}
 
GetDistanceFromGround(id)
{
        
// Check if player is on ground?
        // if (entity_get_int(client, EV_INT_flags) & FL_ONGROUND)
        //         return 0;
 
 
new Float:clientOrigin[3], Float:groundOrigin[3];
 
 
entity_get_vector(idEV_VEC_originclientOrigin);
 
//drop_to_floor(id);
 
entity_get_vector(idEV_VEC_origingroundOrigin);
 
entity_set_origin(idclientOrigin);
 
 return 
floatround(vector_distance(clientOrigingroundOrigin));

Why doesn't this work then?
I jump up and didn't get that message and when i jump down or fell down i still didn't get that message!
__________________
BigMac is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 12-05-2010 , 00:49   Re: Distances and units
Reply With Quote #5

Quote:
Originally Posted by BigMac View Post
PHP Code:
public Something(id)
{
 if (
GetDistanceFromGround(id) == 2)
 {
  
client_print(0print_chat"testing");
 }
}
 
GetDistanceFromGround(id)
{
        
// Check if player is on ground?
        // if (entity_get_int(client, EV_INT_flags) & FL_ONGROUND)
        //         return 0;
 
 
new Float:clientOrigin[3], Float:groundOrigin[3];
 
 
entity_get_vector(idEV_VEC_originclientOrigin);
 
//drop_to_floor(id);
 
entity_get_vector(idEV_VEC_origingroundOrigin);
 
entity_set_origin(idclientOrigin);
 
 return 
floatround(vector_distance(clientOrigingroundOrigin));

Why doesn't this work then?
I jump up and didn't get that message and when i jump down or fell down i still didn't get that message!
The odds of you being able to use that command when you're exactly 2 units from the ground are slim. Try checking a range rather than an exact unit amount.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
BigMac
Member
Join Date: Jul 2009
Old 12-05-2010 , 10:54   Re: Distances and units
Reply With Quote #6

Shouldn't the player hit the 2 unit mark on the way down from jump or even on the way up and past it? All i want to do is to check when the player is 2 units away from the ground before the player hits the ground.
__________________
BigMac is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-05-2010 , 11:14   Re: Distances and units
Reply With Quote #7

Why did you comment the
Code:
drop_to_floor(id);
?
__________________
hleV is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-05-2010 , 11:19   Re: Distances and units
Reply With Quote #8

You want to fake jump bug ? cheat plugin ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
BigMac
Member
Join Date: Jul 2009
Old 12-05-2010 , 11:48   Re: Distances and units
Reply With Quote #9

No I just want to check if player has is within 2 units of the ground return value false.
if i use this
if (entity_get_int(client, EV_INT_flags) & FL_ONGROUND)
It works after the player has hit the ground. I want the value to be false right before the player hits the ground.

@ConnorMcLeod You want to fake jump bug ? cheat plugin ?
No just a event that detects a player right before a player hits the ground thats all.
__________________
BigMac is offline
BigMac
Member
Join Date: Jul 2009
Old 12-05-2010 , 12:31   Re: Distances and units
Reply With Quote #10

Never Mind I got it Thanks for your help hleV
__________________
BigMac 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:22.


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