SA-MP Forums Archive
Destroying vehicles - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Destroying vehicles (/showthread.php?tid=271039)



Destroying vehicles - tbedy - 22.07.2011

i make to respawn vehicles with timer, but i want to destroy vehicles without driver, that that vehicles gone from server...

how to do that?

codE:

Код:
public respawn()
for(new i = 0; i < MAX_VEHICLES; i++)
{
	SetVehicleToRespawn(i);
}



Re: Destroying vehicles - Kitten - 22.07.2011

pawn Код:
forward VehicleOccupied(vehicleid);

public VehicleOccupied(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerInVehicle(i,vehicleid)) return 1;
    }
    return 0;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/respawncars", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, 0xD8D8D8FF, "You Re spawned all vehicles that are not occupied");
        GameTextForAll("Vehicles Respawned :D", 3000,3);

        for(new cars=0; cars<MAX_VEHICLES; cars++)
        {
            if(!VehicleOccupied(cars))
            {
                SetVehicleToRespawn(cars);
            }
        }
        return 1;
    }
    return 0;
}



Re: Destroying vehicles - tbedy - 22.07.2011

but i want to make this with tame, like automatic respawn, understand?


Re: Destroying vehicles - Kitten - 22.07.2011

i see not smart enough to make your own timer well anyways

pawn Код:
forward VehicleOccupied(vehicleid);
forward AutoRespawn(vehicleid);

SetTimer("AutoRespawn",MilisecondsYouWantToAutoRespawn,true);

public AutoRespawn(vehicleid) {
    GameTextForAll("WALALALA CAR RESPAWNED", 3000,3);
    for(new cars=0; cars<MAX_VEHICLES; cars++)
    {
        if(!VehicleOccupied(cars))
        {
            SetVehicleToRespawn(cars);
        }
    }
    return 1;
}

public VehicleOccupied(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerInVehicle(i,vehicleid)) return 1;
    }
    return 0;
}



Re: Destroying vehicles - tbedy - 23.07.2011

this doesnt working!

it respawn again cars, but i want to destroy cars if isnt anyone in them, so that they gone from server


Re: Destroying vehicles - antonio112 - 23.07.2011

Well, use what Kitten said but instead of:
pawn Код:
SetVehicleToRespawn(cars);

Put:
pawn Код:
DestroyVehicle(cars);
Hope that's what you wanted.