SA-MP Forums Archive
Please help [Error] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Please help [Error] (/showthread.php?tid=100347)



Please help [Error] - Dj_maryo1993 - 04.10.2009

Код:
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;
}



Re: Please help [Error] - Kurence - 04.10.2009

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 );


Re: Please help [Error] - Dj_maryo1993 - 04.10.2009

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


Re: Please help [Error] - Correlli - 04.10.2009

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



Re: Please help [Error] - Dj_maryo1993 - 04.10.2009

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;