Timer that deletes a vehicle (no driver) problem...
#4

Hi Reklez,

That function will indeed delete every vehicle in the server if it's un-occupied. If you want to avoid it deleting certain vehicles you will need to make a function that will tell the script that vehicle x should not be deleted. For instance:

pawn Код:
//Top Of Script
new do_not_delete[MAX_VEHICLES];

public OnGameModeInit()
{
    do_not_delete[0] = CreateVehicle...
}

public DeleteVehicles()
{
    for(new veh = 0; veh < MAX_VEHICLES; veh++)
    {
        if(!VehicleOccupied(veh) && CanDeleteVehicle(veh))
        {
            DestroyVehicle(veh);
        }
    }
    return 1;
}

public CanDeleteVehicle(vehicleid)
{

    for(new i = 0; i < sizeof(do_not_delete); i ++)
    {

         if(vehicleid == do_not_delete[i]) return false;

    }
    return true;
}
I hope that made sense..

Cheers,

TJ
Reply


Messages In This Thread
Timer that deletes a vehicle (no driver) problem... - by Reklez - 14.03.2012, 07:02
Re: Timer that deletes a vehicle (no driver) problem... - by Daddy Yankee - 14.03.2012, 09:48
Re: Timer that deletes a vehicle (no driver) problem... - by HighPitchedVoice - 14.03.2012, 10:08
Re: Timer that deletes a vehicle (no driver) problem... - by TTJJ - 14.03.2012, 10:12

Forum Jump:


Users browsing this thread: 1 Guest(s)