29.05.2020, 13:17
This is an example, you must create some position in order to create a car, because if you create the same car in the same location some players will be stucked there (only if you are using collision in your race system).
PHP Code:
stock racelobby(playerid)
{
if(raceplayers < 2)
{
sendtorace(-1, "Waiting for players");
}
else if(raceplayers >= 2)
{
sendtorace(-1, "THE RACE WILL START IN 10 SECONDS");
SetTimer("race", 10000, 0);
}
}
forward race();
public race()
{
SendClientMessageToAll(-1, "DEBUG: RACE StART");
racestatus = 1;
foreach(new i : Player)
{
new car = CreateVehicle(411, -2518.1865, -2301.7817, 14.8012, -90.0000, -1, -1, 100);
PutPlayerInVehicle(i, car, 0);
SendClientMessage(i, -1, "In 5 seconds the race will start");
}
return 1;
}