enum H_FURS
{
furID,
furModel,
furObject,
furName[25],
furLocked,
furOpened,
Float:furFirstZ
}
Public::OnHousesLoad()
{
new start = GetTickCount();
new i = 1;
for(new row = 0; row < cache_num_rows(); row++)
{
new ORM:ormid = House:i[ORM_ID] = orm_create("houses");
orm_addvar_int(ormid, House:i[DatabaseID], "id");
orm_setkey(ormid, "id");
orm_addvar_float(ormid, House:i[Enter][0], "x");
orm_addvar_float(ormid, House:i[Enter][1], "y");
orm_addvar_float(ormid, House:i[Enter][2], "z");
orm_addvar_float(ormid, House:i[Enter][3], "a");
orm_addvar_int(ormid, House:i[EnterInt], "enterint");
orm_addvar_int(ormid, House:i[EnterWorld], "enterworld");
orm_addvar_float(ormid, House:i[Exit][0], "exitx");
orm_addvar_float(ormid, House:i[Exit][1], "exity");
orm_addvar_float(ormid, House:i[Exit][2], "exitz");
orm_addvar_float(ormid, House:i[Exit][3], "exita");
orm_addvar_int(ormid, House:i[ExitInt], "exitint");
orm_addvar_int(ormid, House:i[IntType], "inttype");
orm_addvar_int(ormid, House:i[Empty], "empty");
orm_addvar_int(ormid, House:i[Complex], "complex");
orm_addvar_int(ormid, House:i[Door], "door");
orm_addvar_int(ormid, House:i[InsideHouse], "insideHouse");
orm_addvar_int(ormid, House:i[OutsideHouse], "outsideHouse");
orm_addvar_string(ormid, House:i[Owner], 45, "owner");
orm_addvar_int(ormid, House:i[Owned], "owned");
orm_addvar_int(ormid, House:i[Locked], "locked");
orm_addvar_int(ormid, House:i[Price], "price");
orm_addvar_int(ormid, House:i[LevelBuy], "levelbuy");
orm_addvar_int(ormid, House:i[Rentable], "rentable");
orm_addvar_int(ormid, House:i[RentPrice], "rentprice");
orm_addvar_int(ormid, House:i[Cash], "cash");
orm_addvar_int(ormid, House:i[Heal], "heal");
orm_addvar_int(ormid, House:i[Faction], "faction");
orm_addvar_int(ormid, House:i[FType], "factype");
orm_addvar_int(ormid, House:i[RDX], "idx");
orm_addvar_int(ormid, House:i[FurRank], "furrank");
orm_addvar_int(ormid, House:i[Elevator], "elevator");
orm_addvar_string(ormid, House:i[SemiOwner], 45, "secowner");
orm_apply_cache(ormid, row);
// CREATE THE DYNAMIC CHECKPOINT
UpdateHouseEntrace(i);
LoadHouseFurnitures(i);
LoadHouseWeps(i);
i++;
}
printf("[ Loaded %d houses from the database - took %d ]", cache_num_rows(), GetTickCount() - start);
return 1;
}
LoadHouseFurnitures(house)
{
mysql_format(dbHandle, query, sizeof(query), "SELECT * FROM `furniture` WHERE `houseID` = %d ORDER BY `ID` DESC LIMIT %d", House:house[DatabaseID], MAX_FURNITURE - 1);
mysql_tquery(dbHandle, query, "OnHouseFurnitureLoad", "i", house);
}
Public::OnHouseFurnitureLoad(house)
{
new i = 1, Float:pos[3], Float:rot[3], object;
for(new row = 0; row < cache_num_rows(); row++)
{
Fur[house][i][furID] = cache_get_field_content_int(row, "ID");
Fur[house][i][furModel] = cache_get_field_content_int(row, "model");
cache_get_field_content(row, "name", Fur[house][i][furName], dbHandle, 50);
Fur[house][i][furLocked] = cache_get_field_content_int(row, "locked");
Fur[house][i][furOpened] = cache_get_field_content_int(row, "opened");
Fur[house][i][furFirstZ] = cache_get_field_content_float(row, "firstrot");
pos[0] = cache_get_field_content_float(row, "x");
pos[1] = cache_get_field_content_float(row, "y");
pos[2] = cache_get_field_content_float(row, "z");
rot[0] = cache_get_field_content_float(row, "rotx");
rot[1] = cache_get_field_content_float(row, "roty");
rot[2] = cache_get_field_content_float(row, "rotz");
object = CreateDynamicObject(Fur[house][i][furModel], pos[0], pos[1], pos[2], rot[0], rot[1], rot[2], house + 100);
Fur[house][i][furObject] = object;
mysql_format(dbHandle, query, sizeof(query), "SELECT * FROM `textures` WHERE `F_ID` = %d ORDER BY `idx` ASC LIMIT %d", Fur[house][i][furID], MAX_FURNITURE_MATS);
mysql_tquery(dbHandle, query, "OnFurnitureTexturesLoad", "i", object);
i++;
}
return 1;
}
Public::OnFurnitureTexturesLoad(object)
{
new index, model, txdname[45], texturename[45], color[45], newHex;
for(new row = 0; row < cache_num_rows(); row++)
{
index = cache_get_field_content_int(row, "idx");
model = cache_get_field_content_int(row, "model");
cache_get_field_content(row, "txdname", txdname);
cache_get_field_content(row, "texturename", texturename);
cache_get_field_content(row, "color", color);
sscanf(color, "h", newHex);
SetDynamicObjectMaterial(object, index, model, txdname, texturename, newHex);
}
return 1;
}
i doubt you need so much furniture.. even 100 objects for one house is too much.. how can u hold 300? put it at like 50 or smthng... and why do u need to name a furniture?
but even with this array isnt it suppose to use only like 12 mb? how is ur GM 122mb |