16.06.2018, 02:48
Add on top of your game mode
This will cause the vehicle to be destroyed when the player exits the server.
Код:
new VehiclePlayerID[MAX_PLAYERS] = 999;
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_DRIFTCAR) { if(response) { switch(listitem) { case 0: { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(VehiclePlayerID[playerid] != 999) DestroyVehicle(VehiclePlayerID[playerid]); VehiclePlayerID[playerid] = AddStaticVehicleEx(562, x, y, z, 0.0, -1, -1, 30); PutPlayerInVehicle(playerid, VehiclePlayerID[playerid], 0); } case 1: { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(VehiclePlayerID[playerid] != 999) DestroyVehicle(VehiclePlayerID[playerid]); VehiclePlayerID[playerid] = AddStaticVehicleEx(560, x, y, z, 0.0, -1, -1, 30); PutPlayerInVehicle(playerid, VehiclePlayerID[playerid], 0); } case 2: { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(VehiclePlayerID[playerid] != 999) DestroyVehicle(VehiclePlayerID[playerid]); VehiclePlayerID[playerid] = AddStaticVehicleEx(402, x, y, z, 0.0, -1, -1, 30); PutPlayerInVehicle(playerid, VehiclePlayerID[playerid], 0); } } } return 1; } return 0; }
Код:
public OnPlayerDisconnect(playerid, reason) { if(VehiclePlayerID[playerid] != 999) DestroyVehicle(VehiclePlayerID[playerid]); return 1; }