28.07.2014, 14:42
Quote:
|
use this
pawn Код:
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 |
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;
}


