/adminveh
#2

You can create a variable for each player which saves the last ID of vehicle that has been created by him.
Код:
new LastVehicleID[MAX_PLAYERS];
Reset and delete it on join and on leave.
Код:
public OnPlayerConnect(playerid)
{
    LastVehicleID[playerid] = INVALID_VEHICLE_ID;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(LastVehicleID[playerid] != INVALID_VEHICLE_ID) DestroyVehicle(LastVehicleID[playerid]);
    LastVehicleID[playerid] = INVALID_VEHICLE_ID;
    return 1;
}
And when you spawn a new vehicle just check whether the LastVehicleID is valid or not.
Код:
if(LastVehicleID[playerid] != INVALID_VEHICLE_ID) DestroyVehicle(LastVehicleID[playerid]);
Don't forget to assign the ID of the new vehicle after it's spawned.
Код:
LastVehicleID[playerid] = CreateVehicle(...);
Reply


Messages In This Thread
/adminveh - by Maky184 - 04.11.2017, 12:48
Re: /adminveh - by Skimmer - 04.11.2017, 13:27
Re: /adminveh - by Maky184 - 04.11.2017, 13:35

Forum Jump:


Users browsing this thread: 1 Guest(s)