Raised This Month: $ Target: $400
 0% 

get_entity_distance


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jordan
Veteran Member
Join Date: Aug 2005
Old 12-17-2005 , 14:33   get_entity_distance
Reply With Quote #1

Question: What do I do with get_entity_distance?

Can I have like:

Code:
if (get_entity_distance(id, id2)) > 30

I figured that I would need coordinates, so what is the point of get_entity_distance?
Jordan is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 12-17-2005 , 14:53  
Reply With Quote #2

Code:
stock get_entity_distance(ent1, ent2)
{
	new Float:orig1[3], Float:orig2[3], origin1[3], origin2[3]
	entity_get_vector(ent1, EV_VEC_origin, orig1)
	for(new a = 0; a < 3; a++)
		origin1[a] = floatround(orig1[a])

	entity_get_vector(ent2, EV_VEC_origin, orig2)
	for(new b = 0; b < 3; b++)
		origin2[b] = floatround(orig2[b])

	return get_distance(origin1, origin2)
}
It does it for you.

Code:
if(get_entity_distance(id, id2) > 30)
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Jordan
Veteran Member
Join Date: Aug 2005
Old 12-17-2005 , 18:51  
Reply With Quote #3

Thank you Just one thing though - how far exactly is 30? o.O
Jordan is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 12-17-2005 , 19:24  
Reply With Quote #4

Thirty units. Well, 16 is a player, so...yeah.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Jordan
Veteran Member
Join Date: Aug 2005
Old 12-17-2005 , 19:25  
Reply With Quote #5

Got ya. Thanks a lot
Jordan is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 12-17-2005 , 20:25  
Reply With Quote #6

I usually do this:
Code:
new distance = floatround(entity_range(ent1, ent2));
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-18-2005 , 04:35  
Reply With Quote #7

Why?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 12-18-2005 , 08:54  
Reply With Quote #8

I dunno, it's all KleeneX's fault!
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 16:07.


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