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)],totalstring[100];
        
strcat(lista,"{FFFFFF}Nombre\t{FFFFFF}Auto\tCheckpoints\tTipo de carrera\n");
        
format(filesizeof file"Carreras/Nombres/CarrerasNombre.txt");
        
total dini_Int(file"TotalRaces");
        
        for(new 
0totali++)
        {
            
format(stringsizeof(string), "Race_%d"i);
            
strmid(rnamedini_Get(filestring), 020sizeof(rname));
            
format(rFilesizeof(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_NOMBREDIALOG_STYLE_TABLIST_HEADERS,"{FFFFFF}Nombres de carrera - "colorkaki"ULF",lista,"Salir","");
    }else return 
SendClientMessage(playeridCOLOR_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)