Array must be indexed - 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 indexed (
/showthread.php?tid=576557)
Array must be indexed -
Callum98 - 05.06.2015
The error:
pawn Код:
error 033: array must be indexed (variable "RestrictedSkins")
The error relates to this line:
pawn Код:
if (strval(inputtext) == RestrictedSkins[i])
The array:
pawn Код:
new RestrictedSkins[29][] =
{
74, 71, 265, 266, 267, 274, 275, 276, 277, 278, 279, 280, 281, 282,
283, 284, 285, 286, 287, 288, 300, 301, 302, 306, 307, 308, 309,
310, 311
};
The code:
pawn Код:
for (new i=0; i < sizeof RestrictedSkins; i++)
{
if (strval(inputtext) == RestrictedSkins[i])
{
SendClientMessage(playerid, COLOUR_WHITE, ERROR_PREFIX"You entered a skin ID that is blocked from public use.");
ShowPlayerDialog(playerid, dialog_skin, DIALOG_SKIN_STYLE, DIALOG_SKIN_CAPTION, DIALOG_SKIN_INFO, DIALOG_SKIN_BUTTON_1, DIALOG_SKIN_BUTTON_2);
return 1;
}
}
Re: Array must be indexed -
Konstantinos - 05.06.2015
No need for a 2D array:
Re: Array must be indexed -
Callum98 - 05.06.2015
Quote:
Originally Posted by Konstantinos
|
Ah thank you, sorry just learning arrays again.