Raised This Month: $ Target: $400
 0% 

Getting distance between player and entity gives wrong result.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 07-10-2013 , 02:46   Getting distance between player and entity gives wrong result.
Reply With Quote #1

Hello everybody,

I try to store the position of a End Button using this Code

Code:
new Float:g_flDist[33][3]
.
.
.
new ent = -1
while((ent = find_ent_by_class(ent, "counter_off")))
	pev(ent, pev_origin, g_flDist[id])
while((ent = find_ent_by_class(ent, "clockstopbutton")))
	pev(ent, pev_origin, g_flDist[id])
while((ent = find_ent_by_class(ent, "clockstop")))
	pev(ent, pev_origin, g_flDist[id])
while((ent = find_ent_by_class(ent, "but_stop")))
	pev(ent, pev_origin, g_flDist[id])
while((ent = find_ent_by_class(ent, "counter_stop_button")))
	pev(ent, pev_origin, g_flDist[id])
while((ent = find_ent_by_class(ent, "multi_stop")))
	pev(ent, pev_origin, g_flDist[id])
while((ent = find_ent_by_class(ent, "stop_counter")))
	pev(ent, pev_origin, g_flDist[id])
while((ent = find_ent_by_class(ent, "m_counter_end_emi")))
	pev(ent, pev_origin, g_flDist[id])
Then getting the origin of the player
Code:
static Float:origin[3]
pev(id, pev_origin, origin)
and showing the distance in a HUD
Code:
get_distance_f(origin, g_flDist[id])
But I always get wrong results, when I stand next to the button it shows me 3000 Units distance. Can anyone tell me whats wrong?
__________________

Last edited by Kia; 07-10-2013 at 02:51.
Kia is offline
 



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 06:32.


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