06.12.2011, 22:27
You need a create an array of Player Vehicles.
OnPlayerConnect
Then when you're creating the vehicle
Before you create the vehicle and OnPlayerDisconnect
pawn Код:
new g_PlayerCars[MAX_PLAYERS]; // Create an array to store the current vehicle of all the players.
pawn Код:
g_PlayerCars[playerid] = -1; // As it defaults to 0, someone else's car might be destroyed.
pawn Код:
g_PlayerCars[playerid] = CreateVehicle(... // CreateVehicle returns the ID of the vehicle which will be stored in g_PlayerCars
pawn Код:
DestroyVehicle(g_PlayerCars[playerid]); // Destroy current vehicle before creating another.