Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local metaInv = {}
- metaInv.__index = metaInv
- function _R.Player:GetInventory()
- if (self.Inv) then return self.Inv end
- local o = {}
- setmetatable( o, metaInv )
- o:New( self )
- self.Inv = o
- return o
- end
- function metaInv:New( ply )
- self.Owner = ply
- self.Items = {}
- print( "Inventory object for " .. ply:Nick() .. " created." )
- end
- function metaInv:PickupItem( ent )
- print( self.Owner:Nick() .. " picked up a " .. ent:ClassName() .. "." )
- ent:Remove()
- end
- hooks.Add( "PlayerUse", "testinventory", function( ply, ent )
- if (ent:ClassName() == "prop_physics") then
- ply:GetInventory():PickupItem( ent )
- end
- end )
Advertisement
Add Comment
Please, Sign In to add comment