Problem with loop.
#1

xxxxxx
Reply
#2

Whats the problem?
Reply
#3

xxxxx
Reply
#4

Would be much easier to help if you made it to english..
Reply
#5

Strcmp also returns 0 if either string is empty. Thus, you will want to check if "Proprio" contains anything before trying to compare it.
Reply
#6

pawn Код:
[21:44:00] [debug] Run time error 4: "Array index out of bounds"
[21:44:00] [debug]  Accessing element at index 1000 past array upper bound 999
[21:44:00] [debug] AMX backtrace:
[21:44:00] [debug] #0 00043408 in public cmd_list (0, 1357728) from GM.amx
[21:44:00] [debug] #1 native CallLocalFunction () from samp-server.exe
[21:44:00] [debug] #2 00006500 in public OnPlayerCommandText (0, 1357704) from GM.amx
[21:44:01] [debug] Run time error 4: "Array index out of bounds"
[21:44:01] [debug]  Accessing element at index 12 past array upper bound 11
[21:44:01] [debug] AMX backtrace:
[21:44:01] [debug] #0 000705f8 in ?? (2641, 1374020, 1374016, 1374012, 1374008, 1374004, 1374000, 1, 0) from GM.amx
[21:44:01] [debug] #1 00060a8c in public Itter_OnPlayerDisconnect (0, 1) from GM.amx
[21:44:01] [debug] #2 00007bec in public SSCANF_OnPlayerDisconnect (0, 1) from GM.amx
[21:44:01] [debug] #3 00000614 in public OnPlayerDisconnect (0, 1) from GM.amx
With "crashdetec" when i write /list. Can you help me
Reply
#7

upppp
Reply
#8

Can you help me please?
Reply
#9

pawn Код:
COMMAND:list(playerid, params[])
{
    new string_total[256];
    for(new i = 1; i <= MAX_VEHICLES; i++)
    {
        printf("i = %i | proprio: %s | name: %s", i, VehInfo[(i - 1)][Proprio], NameRequete[playerid]);
        if(!strcmp(VehInfo[(i - 1)][Proprio], NameRequete[playerid], true) && strlen(VehInfo[(i - 1)][Proprio]))
        {
            printf("on a trouver ton veh: i = %i", i);
            if(!IsABike(i))
            {
                printf("et c pas un bike!");
                new stringveh[25];
                format(stringveh, sizeof(stringveh), "%s\n", GetVehicleName(i));
                strins(string_total, stringveh, strlen(string_total));
                printf("fin!");
            }
        }
    }
    return ShowPlayerDialog(playerid, 11, DIALOG_STYLE_LIST, "Veh:", string_total, "Valider", "Annuler");
}
You need to subtract 1 from vehicle IDs, because elements start at '0', however vehicle IDs start at '1'. If you don't, you will get an out of bounds error.
Reply
#10

When i write /list: Unknown command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)