Server Freeze after send command
#4

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
use this
pawn Код:
while(pv < MAX_PLAYER_VEHICLES)
    {
        if(validcar(PlayerVehicle[playerid][pv]))
        {
            format(string, sizeof(string), "Numero: %d || Vehicleid: %d", pv, PlayerVehicle[playerid][pv]);
            SendClientMessage(playerid, -1, string);
           
        }
     pv++;//outside the "if" not inside
    }
the 1st problem is told in the above reply
but the 2nd problem is that pv++ should be out side "if" statement because if one of the car id is not valid then it would result in an infinite loop which would cause the server freeze
I have this loops and work fine:

pawn Код:
new pv = 0;
    for(new v = 1; v < MAX_VEHICLES; v ++)
    {
        if(validcar[v])
        {
            if(cInformacion[v][cVenta] == 0)
            {
                if(strcmp(NombreJ(playerid), cInformacion[v][cOwner]) == 0)
                {
                    pv ++;
                    PlayerVehicle[playerid][pv] = v;
                    PlayerVCantidad[playerid] ++;
                }
            }
        }
    }
    return 1;
pawn Код:
CMD:checkvehicles(playerid, params[])
{
    if(Logueado[playerid] == 0) return SendClientMessage(playerid, -1, "{47D751}« ! » {FFFFFF}No estas logueado");
    if(PlayerVCantidad[playerid] == 0) return SendClientMessage(playerid, -1, "{47D751}« ! » {FFFFFF}No tienes vehiculos");
    new string[6], pv = 1;
    while(pv < MAX_PLAYER_VEHICLES)
    {
        if(validcar[PlayerVehicle[playerid][pv]])
        {
            format(string, sizeof(string), "%d: %d", pv, PlayerVehicle[playerid][pv]);
            SendClientMessage(playerid, -1, string);
            print(string);
            pv ++;
        }
    }
    return 1;
}
I'll try anyway
Reply


Messages In This Thread
Server Freeze after send command - by FullCircle - 28.07.2014, 02:31
Re: Server Freeze after send command - by Pulsefire - 28.07.2014, 03:09
Re: Server Freeze after send command - by BroZeus - 28.07.2014, 05:55
Respuesta: Re: Server Freeze after send command - by FullCircle - 28.07.2014, 14:42
Respuesta: Re: Server Freeze after send command - by FullCircle - 28.07.2014, 15:03

Forum Jump:


Users browsing this thread: 1 Guest(s)