why it's not working ?
#1

why this cmd respan all vehicles even if players in the vehicles!!!

pawn Код:
stock IsVehicleUnOccupied(vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(!IsPlayerInVehicle(i, vehicleid)) return 1;
            return 0;
        }
    }
    return 0;
}
pawn Код:
CMD:respawnv(playerid, params[])
{
    for(new v = 0; v < MAX_VEHICLES; v++)
    {
        if(IsVehicleUnOccupied(v))
        {
            SetVehicleToRespawn(v);
        }
    }
Reply
#2

Quote:
Originally Posted by AnonScripter
Посмотреть сообщение
why this cmd respan all vehicles even if players in the vehicles!!!

pawn Код:
stock IsVehicleUnOccupied(vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(!IsPlayerInVehicle(i, vehicleid)) return 1;
            return 0;
        }
    }
    return 0;
}
pawn Код:
CMD:respawnv(playerid, params[])
{
    for(new v = 0; v < MAX_VEHICLES; v++)
    {
        if(IsVehicleUnOccupied(v))
        {
            SetVehicleToRespawn(v);
        }
    }
pawn Код:
stock IsVehicleUnOccupied(vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i, vehicleid)) return 0;
        }
    }
    return 1;
}
That should fix it for you, it was checking/returning wrong.

Best regards,
Jesse
Reply
#3

yea it is, thanks very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)