Help Textdraw show again. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Textdraw show again. (
/showthread.php?tid=657045)
Help Textdraw show again. -
Libbyphay - 30.07.2018
PHP код:
stock AddItem(playerid, itemid, amount)
{
new bool:sucess = false;
for(new i = 0; i < MAX_INVENTORY_SLOTS; i ++)
{
if(pInventory[playerid][pInvSlot][i] == itemid && Items[pInventory[playerid][pInvSlot][i]][item_Limit] > 1 && pInventory[playerid][pInvSlotAmount][i] != Items[pInventory[playerid][pInvSlot][i]][item_Limit])
{
new check = amount + pInventory[playerid][pInvSlotAmount][i];
if(check > Items[pInventory[playerid][pInvSlot][i]][item_Limit])
{
pInventory[playerid][pInvSlotAmount][i] = Items[itemid][item_Limit];
for(new a = 0; a < MAX_INVENTORY_SLOTS; a ++)
{
if(pInventory[playerid][pInvSlot][a] == 0)
{
pInventory[playerid][pInvSlot][a] = itemid;
new resto = Items[itemid][item_Limit] - check;
pInventory[playerid][pInvSlotAmount][a] = resto*-1;
if(UsingInv[playerid])
{
PlayerTextDrawSetPreviewModel(playerid, InventorySlot[playerid][a], Items[itemid][item_Model]);
PlayerTextDrawHide(playerid, InventorySlot[playerid][a]);
PlayerTextDrawShow(playerid, InventorySlot[playerid][a]);
}
break;
}
}
}
else
{
pInventory[playerid][pInvSlotAmount][i] += amount;
if(UsingInv[playerid])
{
if(pInventory[playerid][pInvSelectedSlot] == i)
{
if(Items[pInventory[playerid][pInvSlot][i]][item_Type] == ITEM_TYPE_NORMAL)
{
if(pInventory[playerid][pInvSlotAmount][i] >= 1)
{
new string[128];
format(string, sizeof(string), "~>~ Amount: %d", pInventory[playerid][pInvSlotAmount][i]);
PlayerTextDrawSetString(playerid, DisplayInformation[playerid][3], string);
PlayerTextDrawHide(playerid, DisplayInformation[playerid][3]);
PlayerTextDrawShow(playerid, DisplayInformation[playerid][3]);
}
}
}
}
}
sucess = true;
break;
}
}
if(sucess)
return true;
for(new i = 0; i < MAX_INVENTORY_SLOTS; i ++)
{
if(pInventory[playerid][pInvSlot][i] == 0)
{
pInventory[playerid][pInvSlot][i] = itemid;
pInventory[playerid][pInvSlotAmount][i] = amount;
break;
}
}
return 1;
}
Код:
if(UsingInv[playerid])
{
PlayerTextDrawSetPreviewModel(playerid, InventorySlot[playerid][a], Items[itemid][item_Model]);
PlayerTextDrawHide(playerid, InventorySlot[playerid][a]);
PlayerTextDrawShow(playerid, InventorySlot[playerid][a]);
}
It no show the item model new, when i use AddItem