Nearest point in range of player
#1

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):
http://pastebin.com/aeLHzrbA

And if you're wanting to correct my current code (which doesn't work), feel free to do so:
http://pastebin.com/DTcgKaUQ

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

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 https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint instead of that stock.
Reply
#3

I totally forgot to call the function itself, thank you!

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

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!
Reply
#5

Dont forget you are using streamer, so its a streamed CP (You will only see it when you are nearby)
Reply
#6

It is showing up but it always picks the first point (aka ID 0)
Reply
#7

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?
Reply
#8

It's always 0 and while debugging it does the same.
Reply
#9

Out of the sudden, everything works again while no code was changed.
Oh well, fuck logic anyways.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)