Help with Removing Spawned Vehicle
#1

I created a command for players to spawn vehicles, Now i would like to edit the command so that it deletes the previous vehicle spawned by a person when he spawns a new vehicle. Please dictate me as to how i can achieve this.
Reply
#2

pawn Код:
new PlayerSpawnedVehicles[MAX_PLAYERS];

public OnPlayerConnect(playerid) {
    PlayerSpawnedVehicles[playerid] = -1;
}

public OnPlayerDisconnect(playerid, reason) {
    if (PlayerSpawnedVehicles[playerid] != -1) {
        DestroyVehicle(PlayerSpawnedVehicles[playerid]);
    }
}

CMD:spawncar(playerid, params[]) {
    if (PlayerSpawnedVehicles[playerid] != -1) {
        DestroyVehicle(PlayerSpawnedVehicles[playerid]);
    }

    // your code

    PlayerSpawnedVehicles[playerid] = CreateVehicle(...);
}
Reply
#3

Works Like a charm, i am grateful to you CoaPsyFactor. Plus i gave you rep
Reply
#4

I'm glad I helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)