trailer respawning when it is attacthed
#1

i have this code to respawn unocupied vehicles in the server
PHP код:
stock IsVehicleOccupied(vehicleid)
{
for(new 
i=0;i<MAX_PLAYERS;i++)
{
if(
IsPlayerInVehicle (i,vehicleid)) return 1;
}
return 
0;

the prob is when i use this the trailer that is attacthed to truck also will respawn
how to fix it ??
Reply
#2

I have this codes:
Код:
 IsVehicleEmpty(vehicleid)
{
        foreach(new i: Player)
        {
            if(IsPlayerInVehicle(i, vehicleid)) return 0;
        }
        return 1;
}
IsTrailerAttached(trailerid)
{
    for(new i = 1, j=GetVehiclePoolSize(); i <=j ; i++)
    {
        if(GetVehicleTrailer(i) == trailerid) // Check if this trailer attached to another vehicle
        {
            return true;
        }
    }
    return false;
}
And I use them like this
Код:
 vmod = GetVehicleModel(car);
        if(vmod == 435 || vmod == 450 || vmod == 584) // Check if it's a trailer
        {
            if(!IsTrailerAttached(car))
                SetVehicleToRespawn(car);
        }
        else
            if(IsVehicleEmpty(car)) SetVehicleToRespawn(car);
Maybe will help you
Reply
#3

Can u give more codes ?
like ur codes when using respawn command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)