Raised This Month: $ Target: $400
 0% 

Origin -> Units


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-03-2010 , 20:03   Origin -> Units
Reply With Quote #1

Alright, so I'm working on a plugin that involves finding the origin before an entity is mvoed, and then AFTER an entity is moved, and I need to subtract these two origins and then convert them to units. I've searched both LJ Stats plugins and have found nothing on how to convert the origin (which, when I tested it, was about 9 digits each axis) to units. If you're not familiar with LJ Stats, it gives an amount of units (usually around 240, 250, etc.) instead of the origin number. If anyone could give me an equation or method of converting these two things, I'd appreciated it.

Thanks.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 02-03-2010 , 20:41   Re: Origin -> Units
Reply With Quote #2

im not sure if this is what u want, but using get_distance_f() will return the distane between the 2 origins
__________________
minimiller is offline
Send a message via MSN to minimiller
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-03-2010 , 20:46   Re: Origin -> Units
Reply With Quote #3

Would this return the value in a float like 250.6789? Or would it give me some random origin like the nine digit one that I explained in my last post?
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 02-03-2010 , 23:03   Re: Origin -> Units
Reply With Quote #4

If you want to find distance between 2 origins you can do it this way:
PHP Code:
    new Float:o[3], Float:v[3]
    
//now store your origins in o and v
    
v[0] = v[0]-o[0]
    
v[1] = v[1]-o[1]
    
v[2] = v[2]-o[2]
    new 
Float:distance floatsqroot(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]) 
__________________
Impossible is Nothing
Sylwester is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-03-2010 , 23:11   Re: Origin -> Units
Reply With Quote #5

I'm very aware as to how I can store origins, but I need them to be stored in a certain way. If I had done the way that you've presented, I'd end up with a 8-10 digit number, doing me no good. I need a value to come out such as 256.8726 or something of that sort.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-03-2010 , 23:30   Re: Origin -> Units
Reply With Quote #6

My LJStats uses get_distance().
The difference is that it uses the distance from where the player jumped to where the player landed.

Code:
new Float:fUnits = get_distance_f( vStartOrigin, vStopOrigin );
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-03-2010 , 23:34   Re: Origin -> Units
Reply With Quote #7

Ah, thought it would be a little more complicated than that.

Thanks Exolent.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 02-04-2010 , 01:08   Re: Origin -> Units
Reply With Quote #8

Quote:
Originally Posted by wrecked_ View Post
I'm very aware as to how I can store origins, but I need them to be stored in a certain way. If I had done the way that you've presented, I'd end up with a 8-10 digit number, doing me no good. I need a value to come out such as 256.8726 or something of that sort.
It's stored in the same way everywhere. It's just displayed differently.

PHP Code:
    new Float:distance
    
// get distance ...
    
new msg[128]
    
format(msg127"distance: %.4f"distance
__________________
Impossible is Nothing
Sylwester 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 07:26.


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