Arrays problem
#1

I made 2 variables:
1_ PlayerVCantidad[MAX_PLAYERS] for store the total of player vehicles
2_ PlayerVehicle[MAX_PLAYERS][MAX_PLAYER_VEHICLES] for store playervehicles ids in differents arrays

I put this when player login, but doesn't work, when I use the test command print:
Quote:

1: 0
2: 0
3: 0
4: 0
5: 0

pawn Код:
new vv = 1;
for(new v = 1; v < MAX_VEHICLES; v ++)
{
    if(strcmp(NombreJ(playerid), cInformacion[v][cOwner]) == 0) //This check if the player is Owner
    {
        vv ++
        PlayerVehicle[playerid][vv] = v;
        PlayerVCantidad[playerid] ++;
    }
}
Command:
pawn Код:
CMD:TEST(playerid, params[])
{
    new string[6];
    for(new pv = 1; pv < MAX_PLAYER_VEHICLES; pv ++)
    {
        format(string, sizeof(string), "%d: %d", pv, PlayerVehicle[playerid][pv]);
        SendClientMessage(playerid, -1, string);
    }
    return 1;
}
Reply
#2

pawn Код:
new vv;
for(new v = 1; v < MAX_VEHICLES; v++)
{
    if(cInformacion[v][cOwner][0] != '\0' && strcmp(NombreJ(playerid), cInformacion[v][cOwner]) == 0 && ++vv < MAX_PLAYER_VEHICLES) //This check if the player is Owner
    {
        PlayerVehicle[playerid][vv] = v;
        PlayerVCantidad[playerid]++;
    }
}

CMD:test(playerid, params[])
{
    if(PlayerVCantidad[playerid] == 0) SendClientMessage(playerid,-1,"No vehicles owned");
    else{
        new string[10];
        for(new pv = 1; pv < PlayerVCantidad[playerid]; pv++)
        {
            format(string, sizeof(string), "%d: %d", pv, PlayerVehicle[playerid][pv]);
            SendClientMessage(playerid, -1, string);
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
new vv;
for(new v = 1; v < MAX_VEHICLES; v++)
{
    if(cInformacion[v][cOwner][0] != '\0' && strcmp(NombreJ(playerid), cInformacion[v][cOwner]) == 0 && ++vv < MAX_PLAYER_VEHICLES) //This check if the player is Owner
    {
        PlayerVehicle[playerid][vv] = v;
        PlayerVCantidad[playerid]++;
    }
}

CMD:test(playerid, params[])
{
    if(PlayerVCantidad[playerid] == 0) SendClientMessage(playerid,-1,"No vehicles owned");
    else{
        new string[10];
        for(new pv = 1; pv < PlayerVCantidad[playerid]; pv++)
        {
            format(string, sizeof(string), "%d: %d", pv, PlayerVehicle[playerid][pv]);
            SendClientMessage(playerid, -1, string);
        }
    }
    return 1;
}
Doesn't work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)