19.05.2017, 19:49
I'm having trouble figuring out how to use inputtext for a dialog based MDC. I got the code to work using a regular command and SendClientMessage, but I'm trying to move it to dialogs. Now, here's the code:
Errors:
Lines w/ Errors:
PHP код:
if(dialogid == DIALOG_POLICE_MDC)
{
if(!response)
{
return 1;
}
if(response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, DIALOG_POLICE_NAMESEARCH, DIALOG_STYLE_INPUT, "{FFFFFF}MDC - Name Search", "{FFFFFF}Enter the name of the suspect:", "Search", "Back");
}
case 1:
{
ShowPlayerDialog(playerid, DIALOG_POLICE_PLATESEARCH, DIALOG_STYLE_INPUT, "{FFFFFF}MDC - Plate Search", "{FFFFFF}Enter the plate of the vehicle:", "Search", "Back");
}
case 3:
{
SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: Coming soon!");
}
}
return 1;
}
}
if(dialogid == DIALOG_POLICE_NAMESEARCH)
{
if(!response)
{
ShowPlayerDialog(playerid, DIALOG_POLICE_MDC, DIALOG_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 = inputtext;
new Float:X, Float:Y, Float:Z;
GetPlayerPos(criminal, X, Y, Z);
format(string, sizeof(string),"_______________________________[MDC - Mobile Data Computer]_______________________________");
SCM(playerid, COLOR_WHITE, string);
format(string, sizeof(string),"Full Name: "COL_WHITE"%s", GetName(criminal));
SCM(playerid, COLOR_SJPD, string);
format(string, sizeof(string),"Full Name: "COL_WHITE"%s", PlayerInfo[criminal][pName]);
SCM(playerid, COLOR_SJPD, string);
return 1;
}
}
if(dialogid == DIALOG_POLICE_PLATESEARCH)
{
if(!response)
{
ShowPlayerDialog(playerid, DIALOG_POLICE_MDC, DIALOG_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 = inputtext;
foreach(Player,i)
{
if(plate == PlayerInfo[i][pPlate1] || plate == PlayerInfo[i][pPlate2] || plate == PlayerInfo[i][pPlate3])
{
format(string, sizeof(string),"_______________________________[%d]_______________________________", plate);
SCM(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "[Vehicle Owner:] "COL_WHITE"%s.", PlayerInfo[i][pName]);
SCM(playerid, COLOR_SJPD, string);
} else return SCM(playerid, COLOR_LIGHTRED, "There is no player with that license plate.");
}
return 1;
}
}
PHP код:
C:\Users\Saint\Desktop\PRP\gamemodes\PRP.pwn(5131) : error 033: array must be indexed (variable "-unknown-")
C:\Users\Saint\Desktop\PRP\gamemodes\PRP.pwn(5153) : error 033: array must be indexed (variable "-unknown-")
Код:
new criminal = inputtext;
Код:
new plate = inputtext;