SA-MP Forums Archive
array must be indexed, variable "hInfo" - 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, variable "hInfo" (/showthread.php?tid=426234)



array must be indexed, variable "hInfo" - Apenmeeuw - 28.03.2013

hey all,

i got these weird errors, and i dont really understand why its saying this and how to fix them...


Код:
D:\Program Files\StreetRod\StreetRod 0.3e R2\filterscripts\GarHouse.pwn(860) : error 033: array must be indexed (variable "hInfo")

Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
case 8:
            {
                if(IsPlayerInOwnHouse(playerid))
                {
                    for(new i = 0; i < MAX_HOUSES; i++)
                    {
                        for(new f = 0; f != _:hInfo - _:Furniture; f++) // error line 860
                        {
                            if(hInfo[i][Furniture][f] == -1)
                            {
                                ShowPlayerDialog(playerid, DIALOG_FURNITURE_MAIN, DIALOG_STYLE_LIST, "House Furniture", "Doors\nTables and Chairs\nFitness\nKitchen and Bathroom\nElectronics\nBedroom\nLounge\nFlowers and Plants\nMiscellaneous", "Select", "Cancel");
                                break;
                            }
                            else SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}: you have reached the maximum furniture limit"EMBED_ORANGE" [20/20]");
                        }
                    }
                }
                else return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}: you can only use this furniture inside you're house.");
            }
whats wrong with that? this is the variable:

pawn Код:
enum Data
{
   HousePassword,
   HouseOwner[MAX_PLAYER_NAME],
   HouseName[MAX_HOUSE_NAME],
   HouseLocation[MAX_ZONE_NAME],
   Float:SpawnOutAngle,
   SpawnInterior,
   SpawnWorld,
   Float:CPOutX,
   Float:CPOutY,
   Float:CPOutZ,
   Float:SpawnOutX,
   Float:SpawnOutY,
   Float:SpawnOutZ,
   HouseValue,
   HouseStorage,
   HouseInterior,
   HouseCar,
   HouseCarModel,
   HouseCarWorld,
   HouseCarInterior,
   Float:HouseCarPosX,
   Float:HouseCarPosY,
   Float:HouseCarPosZ,
   Float:HouseCarAngle,
   QuitInHouse,
   Weapon[14],
   Ammo[14],
   ForSale,
   ForSalePrice,
   HousePrivacy,
   HouseAlarm,
   HouseCamera,
   HouseDog,
   UpgradedLock,
   Furniture[MAX_FURNITURE_PER_HOUSE]
}
new hInfo[MAX_HOUSES][Data];
the MAX_FURNITURE_PER_HOUSE is 20, defined
pawn Код:
#define MAX_FURNITURE_PER_HOUSE 20
any idea whats wrong with this?


Re: array must be indexed, variable "hInfo" - RenovanZ - 28.03.2013

Try to change your code with this:
pawn Код:
for(new f = 0; f != _:hInfo - _:MAX_FURNITURE_PER_HOUSE; f++)



Re: array must be indexed, variable "hInfo" - Apenmeeuw - 28.03.2013

still giving the same error...


Re: array must be indexed, variable "hInfo" - Apenmeeuw - 29.03.2013

bump...