SA-MP Forums Archive
Race vehicle - 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: Race vehicle (/showthread.php?tid=604006)



Race vehicle - ScIrUsna - 30.03.2016

Hi,

I want to make race start position i have position and i want to place car how much is racers if for ex:

2

position will be like that:

| |


if 3


| |
|



if four 4



| |
| |



if five 5


| |
| |
|


and so..


Re: Race vehicle - Mencent - 30.03.2016

Hi!

I don't understand your problem. How can we help you?


Re: Race vehicle - Lucky13 - 30.03.2016

Okay it's very easy to do. First of all, let's say you have a 4 people race. This means they should be placed like this:

Код:
| |
| |
Now, go in game and use /save to save these positions at the race start.

Now in your script, create a variable:

Код:
new Racers=0;
new bool: pInRace[MAX_PLAYERS];
Now, when someone joins the race:

Код:
Racers++;
pInRace[playerid]=true;
if(Racers == 1) { SetPlayerPos(playerid, X1, Y1, Z1); }
else if(Racers == 2) { SetPlayerPos(playerid, X2, Y2, Z2); }
// and so on...
Код:
 
X1 = The X position for first racer
Y1 = The Y position for the first racer
Z1 = The Z position for the first racer
X2 = The X position for the second racer
Y2 = The Y position for the second racer
Z2 = The Z position for the second racer
// And so on...
Also, make sure to do Racers=0; when the race ends and if a racer disconnects:

Код:
if(pInRace[playerid] == true) { Racers--; }



Re: Race vehicle - ScIrUsna - 30.03.2016

I know that, but i'am searcing for easier way, i want to calculate from any position because start could by anywhere i need calculate from one position, others


Re: Race vehicle - theonethatownz - 30.03.2016

Its easier via the method above, otherwise you need to start working the difference between vehicles and objects around those vehicles.