View Full Version : Nearest point in range of player

07/02/2015, 01:18 PM
So after looking through the search option and ******, I'll start my own topic.

I'm trying to get the nearest "load" point of the player, unfortunately due to lacking knowledge of knowing how to do this correctly, I can't get it to work right. It sort of works but it keeps sending me to the first pickup point even though you're next to an other one.

Here is my list of load and unload points (I forgot how these are called):

And if you're wanting to correct my current code (which doesn't work), feel free to do so:

Thank you for your cooperation!
I used pastebin because the PAWN tags appear to be gone.

07/02/2015, 01:27 PM
Just call ClosestMissionStart(playerid) in your /work command in order to set the CurrentMission[playerid] to a value, maybe different than 0. The code looks fine to me, even if you could use http://wiki.sa-mp.com/wiki/GetPlayerDistanceFromPoint instead of that stock.

07/02/2015, 01:29 PM
I totally forgot to call the function itself, thank you!

-edit- still can't get it working, read post after this.

22/02/2015, 10:06 PM
I've updated the main post and my latest post, I still can't seem to get it working. I'd be glad if someone could help me out!

22/02/2015, 10:28 PM
Dont forget you are using streamer, so its a streamed CP (You will only see it when you are nearby)

22/02/2015, 10:29 PM
It is showing up but it always picks the first point (aka ID 0)

22/02/2015, 10:39 PM
Well i checked your code few times and it has to work, but i also noticed that your CP's are pretty close...you sure its always 0? Can you debug CurrentMission[playerid] in your CMD?

22/02/2015, 10:39 PM
It's always 0 and while debugging it does the same.

22/02/2015, 10:46 PM
Out of the sudden, everything works again while no code was changed.
Oh well, fuck logic anyways.