Destroying vehicles
#1

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);
}
Reply
#2

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;
}
Reply
#3

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

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;
}
Reply
#5

this doesnt working!

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)