help dialog
#1

not show that dialog, you can tell me why?
PHP код:
                case 0:
                {
                     new
                         
dstr[2000],
                         
car PlayerInfo[playerid][pPcarkey];
                         
                    new 
nrm[66];
                    if(
CarInfo[car][cLicense] == 0format(nrm,sizeof(nrm),"{FFFFFF}Nu");
                    else 
format(nrm,sizeof(nrm),"{FFFFFF}%s"CarInfo[car][cLicense]);
                    
                    new 
text[60];
                    if(
CarInfo[car][cLock] == 0format(text,sizeof(text),"{00FF00}Deschisa");
                    else 
format(text,sizeof(text),"{FF0000}Incuiata");
                    
                    new 
id[40];
                    
format(idsizeof(id),"%s (ID: %d)",VehicleNames[GetVehicleModel(car)],car);
                    
                    
format(dstrsizeof(dstr), "Model Vehicul: %s\nCuloarea 1: %d\nCuloarea 2: %d\nNumar de inmatriculare: %s\nKilometrii: %d\nUsa: %s",
                    
VehicleNames[GetVehicleModel(car)], CarInfo[car][cColorOne], CarInfo[car][cColorTwo], nrmCarInfo[car][cKM], text);
                     
ShowPlayerDialog(playerid,178,DIALOG_STYLE_MSGBOX,id,dstr,"Iesire","");
                } 
Reply
#2

Run time error 4:
pawn Код:
VehicleNames[GetVehicleModel(car)]
The size of VehicleNames array is 212 so 0-211 are the valid indexes. If you get the model ID and it's a valid vehicle, it will try to access the element with index of greater or equal to 400 which is out of bounds.

Store the modelid to a variable and if it's between the valid model IDs, use it in the array:
pawn Код:
new modelid = GetVehicleModel(car);
...
// in the format as argument:
..., modelid ? VehicleNames[modelid - 400] : ("N/A"), car);
do the same for the second format as well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)