SA-MP Forums Archive
DestroyVehicle Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: DestroyVehicle Help (/showthread.php?tid=456790)



DestroyVehicle Help - Stefand - 07.08.2013

Hello,

Every time I destroy a Vehicle, It comes back...
How is that possible?

pawn Код:
public OnPlayerSpawn(playerid)
{
    TogglePlayerSpectating(playerid, 0);
    if(MapTime != 1200)
    {
        Player[playerid][IsActive] = 1;
        new rand = random(SpawnPointsCounter - 1);
        new Float:info[4];

        new rand_car = random(MAX_RANDOM_VEHICLES - 1);
        new car = AllCars[rand_car];
        new vehicle;

        info[0] = SpawnPoints[rand][SPAWN_X];
        info[1] = SpawnPoints[rand][SPAWN_Y];
        info[2] = SpawnPoints[rand][SPAWN_Z];
        info[3] = SpawnPoints[rand][SPAWN_ROT];

        vehicle = CreateVehicle(car, info[0], info[1], info[2], info[3], random(100), random(100), -1);
        PutPlayerInVehicle(playerid, vehicle, 0);
        Player[playerid][IsActive] = 1;
        SetPlayerColor(playerid, ALIVEGREEN);
        Player[playerid][State] = 2;
    }
    else
    {
        SCM(playerid, NOTICE2, "> The game will start shortly!");
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    DestroyVehicle(GetPlayerVehicleID(playerid));
    SetPlayerColor(playerid, DEADRED);
    TogglePlayerSpectating(playerid, true);
    Player[playerid][SpeccingPlayer] = 0;
    SpectatorRefresh(playerid, Player[playerid][SpeccingPlayer]);
    SetTimerEx("RespawnAfterDeath", 6000, false, "d", playerid);
    Player[playerid][RespawnTime] = 6;
    Player[playerid][IsActive] = 0;
    Player[playerid][LastCar] = -1;
    Player[playerid][AliveTime] = 0;
    return 1;
}