SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 17/05/2019, 09:27 PM   #1
Ejected
Big Clucker
 
Ejected's Avatar
 
Join Date: Jul 2012
Location: United States Discord: ABC#6701
Posts: 155
Reputation: 16
Default How can I get the place of a player in a race each time they enter a checkpoint?

I'm trying to get the place of a player in a race each time they enter a racecheckpoint but I cant figure out how to do it. Can anyone point me in the right direction?
Ejected is offline   Reply With Quote
Old 17/05/2019, 09:33 PM   #2
Plastikmensch
Big Clucker
 
Join Date: Aug 2016
Posts: 49
Reputation: 4
Default Re: How can I get the place of a player in a race each time they enter a checkpoint?

Hmh, I have some ideas...
- Track the time between checkpoints and assign places by time
- Use a variable to store which players entered a checkpoint and increase the place every time someone else enters it
I can't give examples though...
Plastikmensch is offline   Reply With Quote
Old 17/05/2019, 10:00 PM   #3
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,171
Reputation: 381
Default Re: How can I get the place of a player in a race each time they enter a checkpoint?

Check points are always detected automatically you can check GetPlayerPos at OnPlayerEnterCheckpoint callback,

Other than that if you use manual checkpoints you set yourself you can keep using IsPlayerInRangeOfPoint of the check point and then GetPlayerPos to see where he is in that range if you want. Doing all of that either under OnPlayerUpdate or a constantly running timer as long as the player is in a race using some kind of a PlayerInRace variable.
__________________

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is online now   Reply With Quote
Old 18/05/2019, 12:47 AM   #4
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,858
Reputation: 1291
Default Re: How can I get the place of a player in a race each time they enter a checkpoint?

Here is what I did a while ago.....

- Add up the distance of all next checkpoints to the finish
- Calculate the distance to the next checkpoint
- Add those values together
- Do this for every player
- Use quicksort to order the distances

Now you have the place of each player
Pottus 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
How to make when player enter in checkpoint to show on map new CP and when player enter in the second CPto get $ ? bustern Scripting Help 1 30/08/2013 07:43 AM
How to make when player enter in checkpoint, to show another and give money when enter on each checkpoint ? bustern Scripting Help 5 28/08/2013 12:50 PM
How to create a checkpoint for more than 1 time in the same place? bhuvanesh Scripting Help 2 05/08/2012 03:33 PM
FilterScript? event player position 1,2...place race in checkpoint OFirst Scripting Help 4 18/11/2011 12:32 AM


All times are GMT. The time now is 07:42 PM.


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