#1

how can i make with this
Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
	SetVehicleToRespawn(i);
}
set vehicle to respawn only if its empty?
Reply
#2

copy and paste this and then you only need a command with RespawnEmptyCars(); in it

Код:
RespawnEmptyCars();
public RespawnEmptyCars()
{
for(new i=0; i<MAX_VEHICLES; i++)
{
for(new pl = 0; pl<MAX_PLAYERS; pl++)
{
if(IsPlayerConnected(pl))
{
if(!IsVehicleInUse(i))//if(!IsPlayerInVehicle(pl, i))
{
SetVehicleToRespawn(i);
}
}
}
}
}
stock IsVehicleInUse(vehicleid)
{
    for(new i=0; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerVehicleID(i) == vehicleid)
            return true;
        }
    }
    return false;
}
Reply
#3

didnt help -.-
Reply
#4

Try this:
pawn Код:
for(new i=0; i<MAX_VEHICLES; i++)
    {
        new pcount=0;
        for(new pl=0, tx=GetMaxPlayers(); pl<=tx; pl++)
        {
            if(IsPlayerConnected(pl))
            {
                if(GetPlayerVehicleID(pl)==i)
                {
                    pcount++;
                    break;
                }
            }
        }
        if(pcount==0)SetVehicleToRespawn(i);
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)