SA-MP Forums Archive
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(playeriditemidamount)
{
    new 
bool:sucess false;
    
    for(new 
0MAX_INVENTORY_SLOTS++)
    {
        if(
pInventory[playerid][pInvSlot][i] == itemid && Items[pInventory[playerid][pInvSlot][i]][item_Limit] > && 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 
0MAX_INVENTORY_SLOTS++)
                {
                    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(playeridInventorySlot[playerid][a], Items[itemid][item_Model]);
                         
                            
PlayerTextDrawHide(playeridInventorySlot[playerid][a]);
                            
PlayerTextDrawShow(playeridInventorySlot[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(stringsizeof(string), "~>~ Amount: %d"pInventory[playerid][pInvSlotAmount][i]);
                                
PlayerTextDrawSetString(playeridDisplayInformation[playerid][3], string);
                                
PlayerTextDrawHide(playeridDisplayInformation[playerid][3]);
                                
PlayerTextDrawShow(playeridDisplayInformation[playerid][3]);
                            }
                        }
                    }
                }
            }
            
sucess true;
             break;
        }
    }
    if(
sucess)
        return 
true;
        
    for(new 
0MAX_INVENTORY_SLOTS++)
     {
        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