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

Quote:
Originally Posted by Aly
Посмотреть сообщение
Код:
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
As you can see inputtext is an array, a string to be more precise.
So you should do something like this.Instead of
Код:
new criminal = inputtext;
Use
Код:
if(sscanf(inputtext, "u", criminal))
      return SendClientMessage(playerid, COLOR, "Invalid player.");
I guess you're familiar with the sscanf function.
Now I've come into another problem. It works now, no errors. But in-game, when I type in the criminal's name, it does nothing. Here's my code:
PHP код:
if(dialogid == DIALOG_POLICE_NAMESEARCH)
    {
        if(!
response)
        {
            
ShowPlayerDialog(playeridDIALOG_POLICE_MDCDIALOG_STYLE_LIST"        ____[MDC - Mobile Data Computer]___""{FFFFFF}Name Search\n{FFFFFF}Plate Search\n{FFFFFF}BOLOs\n""Select""Cancel");
        }
        if(
response)
        {
            new 
string[128];
            new 
criminal;
            new 
Float:XFloat:YFloat:Z;
            
GetPlayerPos(criminalXYZ);
            if(
sscanf(inputtext"u"criminal))
            {
                
format(stringsizeof(string),"_______________________________[MDC - Mobile Data Computer]_______________________________");
                
SCM(playeridCOLOR_WHITEstring);
                 
format(stringsizeof(string),"Full Name: "COL_WHITE"%s",  GetName(criminal));
                
SCM(playeridCOLOR_SJPDstring);
                
format(stringsizeof(string),"Full Name: "COL_WHITE"%s"PlayerInfo[criminal][pName]);
                
SCM(playeridCOLOR_SJPDstring);
                  return 
1;
            }
        }
    } 
Same thing with plates:
PHP код:
if(dialogid == DIALOG_POLICE_PLATESEARCH)
    {
        if(!
response)
        {
            
ShowPlayerDialog(playeridDIALOG_POLICE_MDCDIALOG_STYLE_LIST"[MDC - Mobile Data Computer]""{FFFFFF}Name Search\n{FFFFFF}Plate Search\n{FFFFFF}BOLOs\n""Select""Cancel");
        }
        if(
response)
        {
            new 
string[128];
            new 
plate;
            if(
sscanf(inputtext"d"plate))
            {
                foreach(
Player,i)
                {
                    if(
plate == PlayerInfo[i][pPlate1] || plate == PlayerInfo[i][pPlate2] || plate == PlayerInfo[i][pPlate3])
                    {
                        
format(stringsizeof(string),"_______________________________[%d]_______________________________"plate);
                        
SCM(playeridCOLOR_WHITEstring);
                        
format(stringsizeof(string), "[Vehicle Owner:] "COL_WHITE"%s."PlayerInfo[i][pName]);
                        
SCM(playeridCOLOR_SJPDstring);
                    } else return 
SCM(playeridCOLOR_LIGHTRED"There is no player with that license plate.");
                }
                  return 
1;
            }
        }
    } 
Reply


Messages In This Thread
error 033: array must be indexed (variable "-unknown-") - by oSAINTo - 19.05.2017, 19:49
Re: error 033: array must be indexed (variable "-unknown-") - by Aly - 19.05.2017, 19:55
Re: error 033: array must be indexed (variable "-unknown-") - by oSAINTo - 19.05.2017, 19:59
Re: error 033: array must be indexed (variable "-unknown-") - by oSAINTo - 19.05.2017, 20:04
Re: error 033: array must be indexed (variable "-unknown-") - by Aly - 19.05.2017, 20:07
Re: error 033: array must be indexed (variable "-unknown-") - by oSAINTo - 20.05.2017, 00:04

Forum Jump:


Users browsing this thread: 1 Guest(s)