Advertisement
Guest User

Untitled

a guest
May 4th, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1.  
  2. if(isMag) then
  3.     -- Highlight ammo for this magazine.
  4.     local invAmmo={}
  5.     local function getInvammo(target, localItem)
  6.         local isAmmo = IsAmmoForMagazine(item,localItem)
  7.         if(isAmmo) then
  8.             table.insert(invAmmo,localItem:section())
  9.         end
  10.     end
  11.  
  12.     local player = db.actor
  13.     player:iterate_inventory(getInvammo,player)
  14.     if(invAmmo) then
  15.         local inventory = GetActorMenu();
  16.         if not (inventory and inventory:IsShown()) then
  17.             return
  18.         end
  19.    
  20.         for i=1,#invAmmo do
  21.             inventory:highlight_section_in_slot(invAmmo[i],EDDListType.iActorBag)
  22.         end
  23.     end
  24. end
  25.  
  26. if(isWep) then
  27.     -- Highlight mags for this weapon.
  28.     local inventory = GetActorMenu();
  29.     local magsToHighlight={}
  30.  
  31.     local function getInvMags(target, localItem)
  32.         local isMag = isMagazine(localItem)
  33.         if(isMag and IsMagazineForWeapon(item,localItem)) then
  34.             table.insert(magsToHighlight,localItem:section())
  35.         end
  36.     end
  37.    
  38.     local player = db.actor
  39.     player:iterate_inventory(getInvMags,player)
  40.  
  41.     if not (magsToHighlight or (inventory and inventory:IsShown())) then
  42.         return
  43.     end
  44.    
  45.     for i=1,#magsToHighlight do
  46.         inventory:highlight_section_in_slot(magsToHighlight[i],EDDListType.iActorBag)
  47.     end
  48.  
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement