Set Nearest Checkpoint - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Set Nearest Checkpoint (
/showthread.php?tid=654276)
Set Nearest Checkpoint -
Dirda - 25.05.2018
I'm planning to improve the pilot job in my Server, but the issue is:
I don't know how to script nearest checkpoint.
Example:
1. There are 3 Airports, Los Santos Airport, San Fierro Airport, Las Venturas Airport
2. You are in a plane, flying above Red County
3. When you do /flight, it detects the nearest airport from the player, so the checkpoint is Set to LSA Gate(Los Santos Airport Gate)
Any help will be appreciated, I'm still newbie.
Re: Set Nearest Checkpoint -
Monotox - 25.05.2018
You need to use the GetPlayerDistanceFromPoint function.
https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint
Re: Set Nearest Checkpoint -
Dirda - 25.05.2018
Quote:
Originally Posted by Monotox
|
Then what should I do?
Re: Set Nearest Checkpoint -
DarkSkull - 25.05.2018
Quote:
Originally Posted by Dirda
Then what should I do?
|
Create 3 variables. Get the distance from the three airports. Then compare which the lowest and then Set Checkpoint. Use 3 if statements.