06.12.2016, 21:01
(
Последний раз редактировалось matias770; 06.12.2016 в 22:05.
)
EDIT: FIXED
Hello, today i was doing a system of Furniture (First time trying it), everything was perfect, it loads from my MySQL database without problem and i can put whatever i want, the problem happens when i tried to save it
Using CrashDetect and a few print i ended up realizing that the error lies in 'SaveFurniture(i)', because without it the system works good.
I don't know how the variable takes '-1' or if its bigger than mine, please help and sorry for my english.
Hello, today i was doing a system of Furniture (First time trying it), everything was perfect, it loads from my MySQL database without problem and i can put whatever i want, the problem happens when i tried to save it
Код:
Accessing element at negative index -1
I don't know how the variable takes '-1' or if its bigger than mine, please help and sorry for my english.
Код:
#define MAX_FURNITURES 30 enum FurnitureInfo { mmID, mHouseID, mModel, Float:mFurnitureX, Float:mFurnitureY, Float:mFurnitureZ, Float:mFurnitureRX, Float:mFurnitureRY, Float:mFurnitureRZ, mFurnitureINT, mFurnitureVW } new Furniture[MAX_FURNITURES][FurnitureInfo]; SaveFurniture(idx) { new sql[512]; format(sql, sizeof(sql), "UPDATE `furniture` SET `house`='%d',`model`='%d',`x`='%f',`y`='%f',`z`='%f',`xx`='%f',`yy`='%f',`zz`='%f',`interior`='%d',`virtualworld`='%d' WHERE `id`='%d'", Mueble[idx][mHouseID], Mueble[idx][mModel], Mueble[idx][mFurnitureX], Mueble[idx][mFurnitureY], Mueble[idx][mFurnitureZ], Mueble[idx][mFurnitureRX], Mueble[idx][mFurnitureRY], Mueble[idx][mFurnitureRZ], Mueble[idx][mFurnitureINT], Mueble[idx][mFurnitureVW], Mueble[idx][mmID]); mysql_query(database, sql, false); return 1; } public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) { if(UsingEditor[playerid] == 1) { new house = IsInHouse[playerid]; if(response == EDIT_RESPONSE_FINAL) { if(PlayerToPoint(playerid, 50.0, HouseInfo[house][cxx], HouseInfo[house][cyy], HouseInfo[house][czz])) { for(new i = 0; i < sizeof(Furniture); i++) { if(PlayerToPoint(playerid, 7.0, Furniture[i][mFurnitureX], Furniture[i][mFurnitureY], Furniture[i][mFurnitureZ])) { UsingEditor[playerid] = 0; new msg[128]; format(msg, sizeof(msg), "* Done."); SendClientMessage(playerid, CYAN, msg); Furniture[i][mFurnitureX] = x; Furniture[i][mFurnitureY] = y; Furniture[i][mFurnitureZ] = z; Furniture[i][mFurnitureRX] = rx; Furniture[i][mFurnitureRY] = ry; Furniture[i][mFurnitureRZ] = rz; SaveFurniture(i); // Problem Here return 1; } } } SendClientMessage(playerid, -1, "You must be in your house in order to use this"); } } }