Loading Objects
#1

Hello sa-mp comunity. I need your help with a furniture system. I don't understoode why my furniture system don't load complety the object. I'ill explain with more details the problem. My furniture system is based on MYSQL and all objects are insert and loaded from the database. When the server is online and i use the furniture system works fine, objects are load and is good all, but when i restart the server, objects don't load complety, they are transparently..

Images:
Before the restart: http://imgur.com/5EURq4l
After the restart: http://imgur.com/a/Eppet


Code for Load
Код:
public OnFurnituresLoad(houseid)
{
    new rows, fields;
	new total = 0;
    cache_get_data(rows, fields);
    if(rows)
    {
		while(total < rows)
		{
			FurnitureInfo[houseid][total][fID] = cache_get_row_int(total, 0);
			FurnitureInfo[houseid][total][fModel] = cache_get_row_int(total, 1);
			cache_get_row(total, 2, FurnitureInfo[houseid][total][fName], dbHandle, 128);
			FurnitureInfo[houseid][total][fHouseID] = houseid;
			FurnitureInfo[houseid][total][fInterior] = cache_get_row_int(total, 4);
			FurnitureInfo[houseid][total][fVirtualWorld] = cache_get_row_int(total, 5);
			FurnitureInfo[houseid][total][fMarketPrice] = cache_get_row_int(total, 6);
			FurnitureInfo[houseid][total][fPosX] = cache_get_row_float(total, 7);
			FurnitureInfo[houseid][total][fPosY] = cache_get_row_float(total, 8);
			FurnitureInfo[houseid][total][fPosZ] = cache_get_row_float(total, 9);
			FurnitureInfo[houseid][total][fPosRX] = cache_get_row_float(total, 10);
			FurnitureInfo[houseid][total][fPosRY] = cache_get_row_float(total, 11);
			FurnitureInfo[houseid][total][fPosRZ] = cache_get_row_float(total, 12);
			FurnitureInfo[houseid][total][fMode] = cache_get_row_int(total, 15);
            cache_get_row(total, 16, FurnitureInfo[houseid][total][fTxd], dbHandle, 128);
            cache_get_row(total, 17, FurnitureInfo[houseid][total][fTexture], dbHandle, 128);
			FurnitureInfo[houseid][total][fOn] = 1;
			FurnitureInfo[houseid][total][fObject] = CreateDynamicObject(FurnitureInfo[houseid][total][fModel], FurnitureInfo[houseid][total][fPosX], FurnitureInfo[houseid][total][fPosY], FurnitureInfo[houseid][total][fPosZ], FurnitureInfo[houseid][total][fPosRX], FurnitureInfo[houseid][total][fPosRY], FurnitureInfo[houseid][total][fPosRZ], FurnitureInfo[houseid][total][fVirtualWorld], FurnitureInfo[houseid][total][fInterior], -1, 200.0);
			SetDynamicObjectMaterial(FurnitureInfo[houseid][total][fObject], 0, FurnitureInfo[houseid][total][fMode], FurnitureInfo[houseid][total][fTxd], FurnitureInfo[houseid][total][fTexture], 0);
			if(isHouseDoor(FurnitureInfo[houseid][total][fModel]))
			{
				FurnitureInfo[houseid][total][fLocked] = 1;
				FurnitureInfo[houseid][total][fOpened] = 0;
			}
			total++;
		}
    }
    return 1;
}
When you bought an item
Код:
			if(GetCash(playerid) < GetIntVar(playerid, "FurniturePriceBuying")) return NoCashMSG(playerid);
			GiveCash(playerid, -GetIntVar(playerid, "FurniturePriceBuying"));
			format(msg, sizeof(msg), "You have bought a {00FF00}%s{FFFFFF}, for ${00FF00}%d{FFFFFF}.", GetStringVar(playerid, "FurnitureNameBuying"), GetIntVar(playerid, "FurniturePriceBuying"));
			ServerMSG(playerid, msg);
			ServerMSG(playerid, "You may press {FFFF00}ESC{FFFFFF} if you want to cancel the purchase");
			PutPlayer(playerid, x, y, z+1);
			FurnitureInfo[houseid][i][fObject] = CreateDynamicObject(GetIntVar(playerid, "FurnitureModelBuying"), x, y, z-1, 0.0, 0.0, 0.0, GetWorld(playerid), GetInterior(playerid), -1, 200.0);
			HouseInfo[houseid][hFurnitures] += 1;
			SetIntVar(playerid, "JustBoughtFurniture", 1);
			SetIntVar(playerid, "ChosenFurnitureSlot", i);
			EditDynamicObject(playerid, FurnitureInfo[houseid][i][fObject]);
			UpdateHouseInfo(houseid);
			OnPlayerBuyFurniture(houseid, GetInterior(playerid), GetWorld(playerid), i, GetIntVar(playerid, "FurnitureModelBuying"), GetIntVar(playerid, "FurniturePriceBuying"), GetStringVar(playerid, "FurnitureNameBuying"), x, y, z);
Код:
stock OnPlayerBuyFurniture(houseid, interior, world, furnitureslot, model, price, name[], Float:x, Float:y, Float:z)
{
	format(query, sizeof(query), "INSERT INTO `furnitures` (model, name, houseid, interior, virworld, marketprice, posx, posy, posz) VALUES (%d, '%s', %d, %d, %d, %d, %f, %f, %f)",
	model, name, HouseInfo[houseid][hID], interior, world, price, x, y ,z);
	mysql_function_query(dbHandle, query, true, "OnFurnitureInsert", "iiiiiis[128]fff", houseid, interior, world, furnitureslot, model, price, name, x, y, z);
	return 1;
}
Thank you for help and sorry for my bad english.
Reply


Messages In This Thread
Loading Objects - by Dominic123 - 09.09.2016, 21:20
Re: Loading Objects - by Dominic123 - 10.09.2016, 09:23
Re: Loading Objects - by Misiur - 10.09.2016, 09:30
Re: Loading Objects - by thefirestate - 10.09.2016, 09:32
Re: Loading Objects - by Dominic123 - 10.09.2016, 09:38
Re: Loading Objects - by Dominic123 - 10.09.2016, 10:58

Forum Jump:


Users browsing this thread: 1 Guest(s)