Race position problem
#2

make a counter;

pawn Код:
new pCounter = 0; // ontop of your script.

// in the callback.
if( pCounter > sizeof( StartPositions[ ] ) ) return SendClientMessage( playerid, -1, "no more slots available" ); // checking if there's still a slot available in the array, if not, it won't spawn the player at the race because it could crash the server / spawn the player at coords 0,0,0( the farm ), or some memory failures could occur.
SetVehiclePos(GetPlayerVehicleID( playerid ),SpawnPos[pCounter][0],SpawnPos[pCounter][1],SpawnPos[pCounter][2]); // setting the player's vehicle to the right pos.
pCounter++; // updating the counter.
this will update the counter when a player has spawned in the race.

the first player to join the race, spawns at the first row of the array ( -1418.0464,-667.8558,1058.8853 ).

the counter updates, it becomes 1.

second player spawns at the coordinates of row 1.

although I prefer using random positions, even though players could spawn ontop of eachother, it'll happen rarely aslong as you've got enough rows in your array.
Reply


Messages In This Thread
Race position problem - by Zaec - 01.03.2014, 10:28
Re: Race position problem - by Smileys - 01.03.2014, 10:37
Re: Race position problem - by Zaec - 01.03.2014, 10:52
Re: Race position problem - by Smileys - 01.03.2014, 10:56
Re: Race position problem - by Zaec - 01.03.2014, 11:23
Re: Race position problem - by Smileys - 01.03.2014, 11:27
Re: Race position problem - by Zaec - 01.03.2014, 11:33
Re: Race position problem - by Zaec - 01.03.2014, 11:37
Re: Race position problem - by Konstantinos - 01.03.2014, 11:43
Re: Race position problem - by Zaec - 01.03.2014, 11:53

Forum Jump:


Users browsing this thread: 6 Guest(s)