03.08.2016, 23:49
Hi, I got an inventory system from here
https://sampforum.blast.hk/showthread.php?tid=600627
i tried to make a save system for it, for when you log out and login back, you find your items in your inventory but it doesn't save?
please tell me what to add or remove or edit
https://sampforum.blast.hk/showthread.php?tid=600627
i tried to make a save system for it, for when you log out and login back, you find your items in your inventory but it doesn't save?
PHP код:
#define MAX_INVENTORY_SLOTS 15
#define MAX_ITENS_WORLD 500
#define TIMER_ITEM_WORLD 60*10
enum enum_Itens
{
item_id,
item_tipo,
item_modelo,
item_nome[24],
item_limite,
bool:item_canbedropped,
Float:item_previewrot[4],
item_description[200]
}
enum
{
ITEM_TYPE_WEAPON,
ITEM_TYPE_HELMET,
ITEM_TYPE_NORMAL,
ITEM_TYPE_BODY,
ITEM_TYPE_AMMO,
ITEM_TYPE_BACKPACK,
ITEM_TYPE_MELEEWEAPON
}
enum enum_pInventory
{
invSlot[MAX_INVENTORY_SLOTS],
invSelectedSlot,
invSlotAmount[MAX_INVENTORY_SLOTS],
Float:invArmourStatus[MAX_INVENTORY_SLOTS]
}
enum enum_pCharacter
{
charSlot[7],
charSelectedSlot,
Float:charArmourStatus
}
enum enum_Player
{
bool:inInventory,
bool:MessageInventory,
MessageInventoryTimer,
Language
}
enum enum_ItensWorld
{
bool:world_active,
world_itemid,
world_model,
world_amount,
world_object,
world_timer,
Text3D:world_3dtext,
Float:world_armourstatus,
Float:world_position[3],
}
enum pInfo
{
pinvSlot,
pinvSelectedSlot,
pinvSlotAmount,
// pFloat:invArmourStatus
pcharSlot[7],
pcharSelectedSlot
}
new AccountInfo[MAX_PLAYERS][pInfo];
if(gPlayerLogged[playerid] == 1)
{
/* Gets the weapon data and store it into the variables
* And if you don't like my script, *shows butt* - kiss this!
* You can remove this line and the one above.
*/
for (new i = 0; i < 8; i ++)
{
GetPlayerWeaponData(playerid, i, AccountInfo[playerid][pGuns][i], AccountInfo[playerid][pAmmo][i]);
}
dini_IntSet(file, "invSlot",AccountInfo[playerid][pinvSlot]);
dini_IntSet(file, "invSelectedSlot",AccountInfo[playerid][pinvSelectedSlot]);
dini_IntSet(file, "invSlotAmount",AccountInfo[playerid][pinvSlotAmount]);
dini_IntSet(file, "charSlot",AccountInfo[playerid][pcharSlot]);
dini_IntSet(file, "charSelectedSlot",AccountInfo[playerid][pcharSelectedSlot]);
}
gPlayerLogged[playerid] = 0;
if(Player[playerid][MessageInventory])
KillTimer(Player[playerid][MessageInventoryTimer]);
ResetVariables(playerid);
return 1;
}