error 033: array must be indexed (variable "-unknown-")
#1

I get this, maybe you can help me out, thanks in advance.

Код:
./includes/OnDialogResponse.pwn(18835) : error 033: array must be indexed (variable "-unknown-")
./includes/OnDialogResponse.pwn(18875) : error 033: array must be indexed (variable "-unknown-")


PHP код:
if(dialogid == DIALOG_CAR_RADIO)
    {
        if(
response)
        {
            switch(
listitem)
            {
                  case 
0:
                  {
                    switch(
PlayerVehicleInfo[GetPlayerVehicleID(playerid)][pvRadio]) line 18835
                    
{
                           case 
0:
                        {
                              new list[
520];
                              for(new 
i!= sizeof(radiochannels); i++)
                              {
                                if(
isnull(list))
                                {
                                    
format(list, sizeof(list), "%s\n"radiochannels[i][rName]);
                                }
                                else
                                {
                                    
format(list, sizeof(list), "%s%s\n", list, radiochannels[i][rName]);
                                }
                            }
                            
ShowPlayerDialog(playeridDIALOG_CAR_SELECTRADIODIALOG_STYLE_LIST"{FF9900}Vehicle", list, "Play""Cancel");
                        }
                           default:
                        {
                            new 
veh GetPlayerVehicleID(playerid),
                                
msg[65];
                            
format(PlayerVehicleInfo[veh][pvRadio], 200"%s"EOS);
                            
format(msgsizeof(msg), "** > %s turns the vehicle's radio off."GetPlayerNameEx(playerid));
                            
SendClientMessage(playeridCOLOR_PINKmsg);
                            
strdel(msg34);
                            
SetPlayerChatBubble(playeridmsgCOLOR_PINK12.010000);
                            foreach(new 
Player)
                            {
                                if(
GetPlayerVehicleID(i) == veh)
                                {
                                    
StopAudioStreamForPlayer(i);
                                }
                            }
                        }
                    }
                }
                  case 
1:
                   {
                    switch(
PlayerVehicleInfo[GetPlayerVehicleID(playerid)][pvRadio]) line 18875
                    
{
                        case 
0:
                        {
                            
SendClientMessage(playeridCOLOR_GREY"You cannot switch the station as the radio is currently turned off.");
                            
ShowPlayerDialog(playeridDIALOG_CAR_RADIODIALOG_STYLE_LIST"{FF9900}Vehicle""Toggle Radio\nSwitch Station\nUse extern URL""Select""Cancel");
                        }
                        default:
                        {
                            new list[
520];
                              for(new 
i!= sizeof(radiochannels); i++)
                              {
                                if(
isnull(list))
                                {
                                    
format(list, sizeof(list), "%s\n"radiochannels[i][rName]);
                                }
                                else
                                {
                                    
format(list, sizeof(list), "%s%s\n", list, radiochannels[i][rName]);
                                }
                            }
                            
ShowPlayerDialog(playeridDIALOG_CAR_SELECTRADIODIALOG_STYLE_LIST"{FF9900}Vehicle", list, "Play""Cancel");
                        }
                    }
                }
                  case 
2:
                {
                    
ShowPlayerDialog(playeridDIALOG_CAR_RADIOLINKDIALOG_STYLE_INPUT"{FF9900}Vehicle""Enter the URL of your radio channel/song:""Submit""Cancel");
                }
            }
        }
    } 
Reply
#2

pvRadio is a string. You can't put it on a switch statement unless you specify an index.

PHP код:
switch(PlayerVehicleInfo[GetPlayerVehicleID(playerid)][pvRadio][0]) // example 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)