I am making a race system for my server, and need help. I can get the player to teleport and the car to spawn... All I need is help with getting the player into the vehicle... here is the code:
Код:
new RaceVehicleID[25];
new LastRaceVehicle = 0;
CMD:joinrace(playerid, params[])
{
if(EventOpen == 0) return SendClientMessage(playerid, COLOR_GREY, "There are no races currently open");
if(InRace[playerid] != 0) return SendClientMessage(playerid, COLOR_GREY, "You are already in a race");
if(RaceTrack == 1)
{
new Float: pX, Float: pY, Float: pZ;
new col1 = random(50);
new col2 = random(50);
new rand = random(sizeof(DillimoreGrid));
GetPlayerPos(playerid, pX, pY, pZ);
BeforeRaceX[playerid] = pX;
BeforeRaceY[playerid] = pY;
BeforeRaceZ[playerid] = pZ;
SetPlayerPos(playerid, DillimoreGrid[rand][0], DillimoreGrid[rand][1], DillimoreGrid[rand][2]+0.7);
LastRaceVehicle++;
RaceVehicleID[LastRaceVehicle] = CreateVehicleEx(RaceVehicle, DillimoreGrid[rand][0], DillimoreGrid[rand][1], DillimoreGrid[rand][2], 88.6200, col1, col2, 1000);
printf("Race Car Spawned: %i", LastRaceVehicle);
InRace[playerid] = 1;
PutPlayerInVehicle(playerid, RaceVehicleID[LastRaceVehicle], 0);
}
return 1;
}