Please help [Error]
#1

Код:
D:\Multiple\Servere\Sa-Mp\0.3\gamemodes\rostunt.pwn(1666) : error 033: array must be indexed (variable "inputtext")

Some help please
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == 1)
  {
    if(inputtext < 400 ||inputtext > 611)
        {
            SendClientMessage(playerid, COLOR_DENY,"WRONG VEHICLE ID");
            SendClientMessage(playerid, COLOR_GRAD2, "Hint: Vehicleid not lower than 400 , or higher than 611");
            return 1;
        }
    return 1;
  }
    return 1;
}
Reply
#2

Lol. vehicle ID is not a string.
Try:
if(!IsNumeric(inputtext)) return SendClientMessage(playerid, color, "vehicle ID is a number!");
and then:
if(strval(inputtext) < 400 || strval(inputtext) > 611) return 1;
and then :
CreateVehicle(strval(inputtext), other params );
Reply
#3

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == 1)
  {
    if(response == 1)
        {
          if(!IsNumeric(inputtext))
          {
            if(strval(inputtext) < 400 || strval(inputtext) > 611)
            {
              ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Error","Bad VehicleID","Retry","Cancel");
              return 1;
            }
            else
                {
              new Float:ax, Float:ay, Float:az;
                    GetPlayerPos(playerid, ax , ay , az);
                    AddStaticVehicle(inputtext, ax+2,ay,az, 0.0, 1, 2);
              return 1;
            }
          }
        }
        if(response == 2)
        {
          SendClientMessage(playerid, COLOR_DENY,"Action canceled");
        }
    return 1;
  }
    return 1;
}
Код:
if(strcmp(cmdtext, "/menutest", true) == 0)
	{
  	ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Enter The vehicle ID","Vehid","Adveh","Cancel");
  	return 1;
	}
What do i do wrong ?



EDIT , SOLVED
Reply
#4

Change:
pawn Код:
if(strval(inputtext) < 400 || strval(inputtext) > 611)
{
to:
pawn Код:
if(strlen(inputtext) < 400 || strlen(inputtext) > 611)
{
Reply
#5

Solved , tnx anywhay

I did something else .
pawn Код:
if(dialogid == 1||dialogid == 2)
  {
    if(response == 1)
        {
          if(IsNumeric(inputtext))
          {
            if(strval(inputtext) < 400 || strval(inputtext) > 611)
            {
              ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Error","Bad VehicleID","Retry","Cancel");
              return 1;
            }
            else
                {
                  new reqestidveh = strval(inputtext);
              new Float:ax, Float:ay, Float:az;
                    GetPlayerPos(playerid, ax , ay , az);
                    CreateVehicle(reqestidveh, ax+2,ay,az, 0.0, 1, 2, 60000);
              return 1;
            }
          }
        }
        if(response == 2)
        {
          SendClientMessage(playerid, COLOR_DENY,"Action canceled");
        }
    return 1;
  }
    return 1;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)