SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/05/2018, 12:19 PM   #1
Dirda
Big Clucker
 
Dirda's Avatar
 
Join Date: Jan 2018
Location: Indonesia
Posts: 84
Reputation: 0
Default Set Nearest Checkpoint

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.
__________________
Dirda is offline   Reply With Quote
Old 25/05/2018, 12:23 PM   #2
Monotox
Gangsta
 
Monotox's Avatar
 
Join Date: Mar 2015
Location: São Paulo - SP
Posts: 520
Reputation: 37
Default Re: Set Nearest Checkpoint

You need to use the GetPlayerDistanceFromPoint function.

http://wiki.sa-mp.com/wiki/GetPlayerDistanceFromPoint
__________________
Do you know the IPFS project?
Monotox is offline   Reply With Quote
Old 25/05/2018, 02:15 PM   #3
Dirda
Big Clucker
 
Dirda's Avatar
 
Join Date: Jan 2018
Location: Indonesia
Posts: 84
Reputation: 0
Default Re: Set Nearest Checkpoint

Quote:
Originally Posted by Monotox View Post
You need to use the GetPlayerDistanceFromPoint function.

http://wiki.sa-mp.com/wiki/GetPlayerDistanceFromPoint
Then what should I do?
__________________
Dirda is offline   Reply With Quote
Old 25/05/2018, 02:36 PM   #4
DarkSkull
Huge Clucker
 
DarkSkull's Avatar
 
Join Date: Aug 2014
Location: Dubai, United Arab Emirates
Posts: 326
Reputation: 43
Default Re: Set Nearest Checkpoint

Quote:
Originally Posted by Dirda View Post
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.
DarkSkull is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
nearest id's XaibBaba Scripting Help 0 08/06/2016 07:42 AM
nearest checkpoint bugmenotlol Scripting Help 14 16/02/2016 12:29 PM
Starting work at nearest checkpoint Coz Scripting Help 4 18/07/2013 08:36 PM
[Include] Get Nearest T0pAz Includes 22 28/02/2012 04:54 PM
Show the nearest checkpoint Takumi.WS Help Archive 0 04/04/2010 12:52 AM


All times are GMT. The time now is 10:49 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.