SA-MP Forums Archive
Array must be index, expected token ';' but found this '}' And must be assigned to array again. - 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)
+--- Thread: Array must be index, expected token ';' but found this '}' And must be assigned to array again. (/showthread.php?tid=368840)



Array must be index, expected token ';' but found this '}' And must be assigned to array again. - Deal-or-die - 14.08.2012

The Errors.
pawn Код:
(4990) : error 033: array must be indexed (variable "inputtext")
    (4990) : error 001: expected token: ";", but found "}"
    (4995) : error 006: must be assigned to an array
The Code.
pawn Код:
(4984)          case 166: //How many rooms?
    (4985)          {
    (4986)              if(!response) return ShowPlayerDialog(playerid, 160, DIALOG_STYLE_LIST, "House Creation Menu", "Set Exterior Position\r\nSet Interior Position\r\nSet Lock\r\nSet Alarm\r\nSet Address\r\nSet Number of Rooms\r\nSet number of Vehicle slots\r\nFinalise","Continue","Close");
    (4987)              if(response)
    (4988)              {
    (4989)                  format(string, sizeof(string), "Please select a value of rooms between 1 and %d", MAX_ROOMS);
    (4990)                  if(!IsNumeric(inputtext) || inputtext > MAX_ROOMS){SendClientMessage(playerid,COLOR_GREY,string)}
    (4991)                  else
    (4992)                  {
    (4993)                          format(string, sizeof(string), "You selected %d Rooms", inputtext);
    (4994)                          SendClientMessage(playerid, -1, string);
    (4995)                          House[playerid][hRooms] = inputtext;
    (4996)                          return 1;
    (4997)                  }
    (4998)              }
    (4999)          }



Re: Array must be index, expected token ';' but found this '}' And must be assigned to array again. - [KHK]Khalid - 14.08.2012

Inputtext is a string. You have to use strval to get the value of it:

pawn Код:
House[playerid][hRooms] = strval(inputtext);



Re: Array must be index, expected token ';' but found this '}' And must be assigned to array again. - Deal-or-die - 14.08.2012

Ahh of course, Wicked! thanks heaps mate.