Mission with nearest start
#1

Hi, i am building a pilot system.
I want the system to know which start point is the closest one from the position of the player.
And maybe if it's possible but optional: it generates couples of points (the point A and B)(the airports and gates) and if it starts at Las Venturas Gate 1, it may not get the destination Las Venturas Gate 2 or the same as startpoint.
Please help me.
Reply
#2

well this function will help

https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint

HTH's
Reply
#3

Yeah i thought so but don't realy know how to start with it
Reply
#4

Ill give ya a general rundown but wont code this for ya as i dont have the skillset just yet.
and i think i know what your looking for but not 100%

but if it was me ID start off with an array of the start points something like {id,name,x,y,z}
then I would run a loop and get my distance from each point
after that is some simple math to find the closest point

Id wrap that up in a function and return the ID back so I could mark it in game.

depending on how your gonna use it you may need a timer also.
Like if you want it to update itself.

Goodluck
Reply
#5

Yeah and i never made a script like that, so i want someone to make a start with it if it's possible.
Reply
#6

give me the...code...
i can make it get nearest..
Reply
#7

Quote:
Originally Posted by ejul
Посмотреть сообщение
give me the...code...
i can make it get nearest..
Ejul I'm trying to do the same thing in my server, please respond if your still willing to help, i'll post cost
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)