31.03.2017, 13:55
(
Последний раз редактировалось jasperschellekens; 31.03.2017 в 13:58.
Причина: forgot something
)
Hello,
I am working on an inventory system which allows players to drop and pickup items.
My question is, how can i save and load the dropped objects after server restart?
Does anyone have an example for me?
Thanks in advance!
Code:
Items will be dropped using this:
I am working on an inventory system which allows players to drop and pickup items.
My question is, how can i save and load the dropped objects after server restart?
Does anyone have an example for me?
Thanks in advance!
Code:
PHP код:
enum ItemData
{
Float:ItemPosX,
Float:ItemPosY,
Float:ItemPosZ,
ItemVWorld,
ItemInterior,
ItemModelID,
Toggled,
};
//Pickupable items that respawn after a certain time
DropItem(2173.8154, -1790.8011, 12.6495, 0, 0, 2902);
DropItem(2159.5239, -1789.5308, 12.6495, 0, 0, 2902);
DropItem(2158.1540, -1807.3875, 12.4795, 0, 0, 2902);
DropItem(2166.3779, -1800.7204, 12.4695, 0, 0, 2902);
//
stock DropItem(Float:X, Float:Y, Float:Z, world,interior,modelid)
{
for(new i = 0; i < sizeof(ItemInfo); i++)
{
if(ItemInfo[i][ItemPosX] == 0.0 && ItemInfo[i][ItemPosY] == 0.0 && ItemInfo[i][ItemPosZ] == 0.0)
{
ItemInfo[i][ItemPosX] = X;
ItemInfo[i][ItemPosY] = Y;
ItemInfo[i][ItemPosZ] = Z;
ItemInfo[i][ItemVWorld] = world;
ItemInfo[i][ItemInterior] = interior;
ItemInfo[i][ItemModelID] = modelid;
Label2[i] = Create3DTextLabel("Item (Press 'C')", COLOR_YELLOW,X,Y,Z, 5.0,world, 0);
Item[i] = CreateDynamicObject(modelid, X, Y, Z,272,0,0, world);
return 1;
}
}
return 1;
}
PHP код:
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
DropItem( X, Y, Z-0.85, GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid),modelid);