/d (/distance)

Started by Fender, May 03, 2012, 10:11

Spekter

This would be useful in many ways, +1.




Prosonic

Quote from: Joshy on May 03, 2012, 16:05
I can see this being abused to tell if staff are spectating. So that needs to be avoided, and hopefully fixed in /loc too.

I think it should be merged with /loc, like this:
[12:34:56] Joshy is heading North in Whitewood Estates, Las Venturas, 3.14km away from you.

Remember to allow MPH users to use miles instead.

Anyway, to script it's fairly easy, just use Pythagoras theorem to calculate the hypotenuse of a triangle. Mick already knows how to do this (either using this or some other method) as it's up and running in /dst.

However I must point out that it will be point-to-point distance, and not road route distance. Like /dst.

+1

/ What Cocasquash said.

"No you where not ban evading.. nooo and im stupid..." - Konali

Deff

Quote from: Storm94 on May 04, 2012, 05:49
Quote from: Deff on May 04, 2012, 01:31
Quote from: Joshy on May 04, 2012, 00:40
Quote from: Storm94 on May 03, 2012, 23:50
Or, you know, GetPlayerDistanceFromPoint() where the point is the other players position. It doesnt take complicated scripting, SAMP has the function built in.
One does not simply look cool without using Pythgoras. 8)

I think this would be faster (in terms of miniseconds or micro lol), since the calculation will be directly done without calling any external functions.

I dont know much about samp scripting though.
Calling a SAMP function is near instantaneous. Doing all that math would take time.

That would be faster (using that function) in overall script if the distance equation needs to be used multiple times, if its just the case for one time, then direct calculation is faster, because in that predefined function its obvious there would be calculation (most probably the same theorem as stated above) which can be viewed in the respect include.

DJ_Smashon

Quote from: Joshy on May 03, 2012, 16:05
I can see this being abused to tell if staff are spectating. So that needs to be avoided, and hopefully fixed in /loc too.

I think it should be merged with /loc, like this:
[12:34:56] Joshy is heading North in Whitewood Estates, Las Venturas, 3.14km away from you.

Remember to allow MPH users to use miles instead.

Anyway, to script it's fairly easy, just use Pythagoras theorem to calculate the hypotenuse of a triangle. Mick already knows how to do this (either using this or some other method) as it's up and running in /dst.

However I must point out that it will be point-to-point distance, and not road route distance. Like /dst.

+1


+1
A.K.A NaftaTorque
Old ID=9149

Leoviz

nahh, /locate does it better ... distances do not correspond to the roads, but from point to point on the map.

-1

Storm94

Quote from: Deff on May 04, 2012, 23:11
Quote from: Storm94 on May 04, 2012, 05:49
Quote from: Deff on May 04, 2012, 01:31
Quote from: Joshy on May 04, 2012, 00:40
Quote from: Storm94 on May 03, 2012, 23:50
Or, you know, GetPlayerDistanceFromPoint() where the point is the other players position. It doesnt take complicated scripting, SAMP has the function built in.
One does not simply look cool without using Pythgoras. 8)

I think this would be faster (in terms of miniseconds or micro lol), since the calculation will be directly done without calling any external functions.

I dont know much about samp scripting though.
Calling a SAMP function is near instantaneous. Doing all that math would take time.

That would be faster (using that function) in overall script if the distance equation needs to be used multiple times, if its just the case for one time, then direct calculation is faster, because in that predefined function its obvious there would be calculation (most probably the same theorem as stated above) which can be viewed in the respect include.

Hardly the most effecient way when it comes to scripting though. That function is built into the a_samp include for a reason. Why reinvent the wheel, when the function already exists?

I'm back, bitches :D

[glow=#282828,10,500]"I dislike Apple, so no." -mick88
"$nake honestly you are one arrogant prick." -Shane0
"The rest of you who I could consider trolls, just go fuck yourself." -Joshy
"TheGame, All I have to say is you complain a lot, and you're probally gonna be an even more arrogant, pompous jackass after this." -RaceRX
"I have a suggestion: Repost this in a respectful manner without caps, silly colors and big fonts, and perhaps someone will give a fuck about your complaint." -mick88
[/glow]

Can't read my quotes? Stop using the white style.

Strato

Quote from: Storm94 on May 07, 2012, 04:34
Quote from: Deff on May 04, 2012, 23:11
Quote from: Storm94 on May 04, 2012, 05:49
Quote from: Deff on May 04, 2012, 01:31
Quote from: Joshy on May 04, 2012, 00:40
Quote from: Storm94 on May 03, 2012, 23:50
Or, you know, GetPlayerDistanceFromPoint() where the point is the other players position. It doesnt take complicated scripting, SAMP has the function built in.
One does not simply look cool without using Pythgoras. 8)

I think this would be faster (in terms of miniseconds or micro lol), since the calculation will be directly done without calling any external functions.

I dont know much about samp scripting though.
Calling a SAMP function is near instantaneous. Doing all that math would take time.

That would be faster (using that function) in overall script if the distance equation needs to be used multiple times, if its just the case for one time, then direct calculation is faster, because in that predefined function its obvious there would be calculation (most probably the same theorem as stated above) which can be viewed in the respect include.

Hardly the most effecient way when it comes to scripting though. That function is built into the a_samp include for a reason. Why reinvent the wheel, when the function already exists?


I have this script created by myself + my friend on my computer. I may look for it if mick wants help.