Jump to content

[REL] HeroInventory - Inventory System [Groups + More]


Recommended Posts

  • 3 months later...
-- exportando inventario 
  
--exports [ "heroinventory" ]:addInventoryGroup( "Armas", "Armas.png" ) 
--exports [ "heroinventory" ]:addInventoryGroup( "Itens", "Itens.png" ) 
  
  
function InventarioSpawn() 
exports [ "heroinventory" ]:addPlayerItem(source,1,1) 
exports [ "heroinventory" ]:addPlayerItem(source,2,1) 
exports [ "heroinventory" ]:addPlayerItem(source,3,1) 
exports [ "heroinventory" ]:addPlayerItem(source,4,1) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),InventarioSpawn) 
  
function UsarItemInventario(ID,qu) 
  if ID == 1 and  getPedWeapon (source) == 22 and getPedTotalAmmo(source)>0 then 
  exports [ "heroinventory" ]:removeItemFromPlayer(source,1,1) 
  setWeaponAmmo(source,22,getPedTotalAmmo(source)+17) 
setPedAnimation( source, "COLT45", "colt45_reload",-1000,false) 
AnimacaoNula(source,1000) 
   elseif ID == 2 and  getPedWeapon (source) == 25 and getPedTotalAmmo(source)>0 then 
  exports [ "heroinventory" ]:removeItemFromPlayer(source,2,1) 
  setWeaponAmmo(source,25,getPedTotalAmmo(source)+7) 
setPedAnimation( source, "BUDDY", "buddy_reload",-1700,false) 
AnimacaoNula(source,1700) 
elseif ID == 3 and  getPedWeapon (source) == 34 and getPedTotalAmmo(source)>0 then 
  exports [ "heroinventory" ]:removeItemFromPlayer(source,3,1) 
  setWeaponAmmo(source,34,getPedTotalAmmo(source)+5) 
setPedAnimation( source, "BUDDY", "buddy_reload",-1700,false) 
AnimacaoNula(source,1700) 
  
elseif ID == 4 and  getPedWeapon (source) == 29 or getPedWeapon (source) == 28 or getPedWeapon (source) == 32  and getPedTotalAmmo(source)>0 then 
  exports [ "heroinventory" ]:removeItemFromPlayer(source,4,1) 
local Wid = getPedWeapon (source) 
  setWeaponAmmo(source,Wid,getPedTotalAmmo(source)+math.random(10,20)) 
setPedAnimation( source, "UZI", "UZI_reload",-1500,false) 
AnimacaoNula(source,1500) 
  end 
   end 
 addEvent("onPlayerUseItem",true) 
addEventHandler("onPlayerUseItem",getRootElement(),UsarItemInventario) 
  
function AnimacaoNula(source,Tempo) 
setTimer(setPedAnimation,Tempo,1,source,nil) 
end 

I have a problem. Even after the item away (vanish), the player can still click and get more.

obs: I added the group "armas" in inventories (heroinventory).

Link to comment
  • 2 months later...
  • 1 month later...
  • 5 months later...
  • 2 months later...
  • 4 months later...
  • 2 years later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...