Problem with loop.
#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


Messages In This Thread
Problem with loop. - by Baltimore - 23.12.2014, 13:27
Re: Problem with loop. - by DavidSparks - 23.12.2014, 13:36
Re : Problem with loop. - by Baltimore - 23.12.2014, 13:39
Re: Problem with loop. - by DavidSparks - 23.12.2014, 13:44
Re: Problem with loop. - by Vince - 23.12.2014, 13:56
Re : Problem with loop. - by Baltimore - 23.12.2014, 20:02
Re : Problem with loop. - by Baltimore - 23.12.2014, 23:39
Re : Problem with loop. - by Baltimore - 24.12.2014, 11:44
Re: Problem with loop. - by Threshold - 24.12.2014, 12:23
Re : Problem with loop. - by Baltimore - 24.12.2014, 15:46

Forum Jump:


Users browsing this thread: 3 Guest(s)