SA-MP Forums Archive
Multi dimensional array problem - 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: Multi dimensional array problem (/showthread.php?tid=473177)



Multi dimensional array problem - CONTROLA - 01.11.2013

Hey guys, I'm having some problems with multi dimensional arrays. So this is the FurnitureInfo:

pawn Код:
#define MAX_HOUSES 500
#define MAX_FURNITURE 30

enum frInfo
{
    frID,
    frModel,
    frHouse,
    frDesc[21],
    Float:frPosX,
    Float:frPosY,
    Float:frPosZ,
    Float:frRotX,
    Float:frRotY,
    Float:frRotZ,
    frObject,
    frPlaced
};
new FurnitureInfo[MAX_HOUSES][MAX_FURNITURE][frInfo];
Basically I want to 'attach' this to my house system. A house will have a maximum of 30(MAX_FURNITURE) furniture pieces.

The problem is that even though this gets succesfully executed:

pawn Код:
cache_get_field_content(index, "frID", result);             FurnitureInfo[i][HouseInfo[i][hFurns]][frID] = strval(result);
cache_get_field_content(index, "frModel", result);          FurnitureInfo[i][HouseInfo[i][hFurns]][frModel] = strval(result);
cache_get_field_content(index, "frPosX", result);           FurnitureInfo[i][HouseInfo[i][hFurns]][frPosX] = floatstr(result);
cache_get_field_content(index, "frPosY", result);           FurnitureInfo[i][HouseInfo[i][hFurns]][frPosY] = floatstr(result);
cache_get_field_content(index, "frPosZ", result);           FurnitureInfo[i][HouseInfo[i][hFurns]][frPosZ] = floatstr(result);
cache_get_field_content(index, "frRotX", result);           FurnitureInfo[i][HouseInfo[i][hFurns]][frRotX] = floatstr(result);
cache_get_field_content(index, "frRotY", result);           FurnitureInfo[i][HouseInfo[i][hFurns]][frRotY] = floatstr(result);
cache_get_field_content(index, "frRotZ", result);           FurnitureInfo[i][HouseInfo[i][hFurns]][frRotZ] = floatstr(result);
cache_get_field_content(index, "frDesc", result);           strmid(FurnitureInfo[i][HouseInfo[i][hFurns]][frDesc], result, 0, 21, 21);
cache_get_field_content(index, "frPlaced", result);         FurnitureInfo[i][HouseInfo[i][hFurns]][frPlaced] = strval(result);
.. FurnitureInfo[i][HouseInfo[i][hFurns] still keeps the default values, and in the database they're different.

Can you tell me what I did wrong?