Pls, help me with this dialog
#1

I'm getting this error when i type the command /nombrecarreritasxdd: (RaceNames)

[22:22:22] [debug] Run time error 4: "Array index out of bounds"
[22:22:22] [debug] Attempted to read/write array element at negative index -400
[22:22:22] [debug] AMX backtrace:
[22:22:22] [debug] #0 000371a8 in public cmd_nombrecarreritasxdd (playerid=0) at carreras.pwn:206
[22:22:22] [debug] #1 00036174 in public cmd_iniciarcarrera (playerid=0, params[]=@04221d68 "") at carreras.pwn:116
[22:22:22] [debug] #2 native CallLocalFunction () from samp-server.exe
[22:22:22] [debug] #3 00008fac in public OnPlayerCommandText (playerid=0, cmdtext[]=@04221d28

Code:
PHP код:
CMD:nombrecarreritasxdd(playerid)
{
    if(
Usuario[playerid][Admin] >= 2)
    {
        new 
file[64],rFile[64];
        new 
rname[54],lista[30 * (52)],total, string[100];
        
strcat(lista,"{FFFFFF}Nombre\t{FFFFFF}Auto\tCheckpoints\tTipo de carrera\n");
        
format(file, sizeof file, "Carreras/Nombres/CarrerasNombre.txt");
        
total = dini_Int(file, "TotalRaces");
        
        for(new 
i = 0; i < total; i++)
        {
            
format(string, sizeof(string), "Race_%d", i);
            
strmid(rname, dini_Get(file, string), 0, 20, sizeof(rname));
            
format(rFile, sizeof(rFile), "/Carreras/%s.ulfrc", rname);
            
RaceVehicle = dini_Int(rFile, "vModel");
            
RaceType = dini_Int(rFile, "rType");
            
TotalCP = dini_Int(rFile, "TotalCP");
            
format(lista,sizeof(lista),"%s\n%s\t%s\t%d\t%s\n",lista,rname,gVehicleNames[RaceVehicle-400],TotalCP,macro(RaceType == 3,"Aera","Terrestre"));
        }
        
ShowPlayerDialog(playerid,DIALOGO_CARRERAS_NOMBRE, DIALOG_STYLE_TABLIST_HEADERS,"{FFFFFF}Nombres de carrera - "colorkaki"ULF",lista,"Salir","");
    }else return 
SendClientMessage(playerid, COLOR_ROJO,"No estas autorizado para usar este comando.");
    return 
1;
} 
Line of error:
PHP код:
format(lista,sizeof(lista),"%s\n%s\t%s\t%d\t%s\n",lista,rname,gVehicleNames[RaceVehicle-400],TotalCP,macro(RaceType == 3,"Aera","Terrestre")); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)