local plyMeta = FindMetaTable( "Player" )
function plyMeta:AddInventoryItem(ent, count)
local eq = loadData(self,"Inventory")
if eq == nil then
eq = {}
for i=1,16 do
eq[i] = {}
eq[i].isOccupied = false
eq[i].Count = 0
eq[i].Name = "unknown"
eq[i].ItemClass = "unknown"
eq[i].WeaponClass = "unknown"
eq[i].SingleWeight = 0
end
end
local totalWeight = getTotalWeight(eq)
for i, slot in ipairs(eq) do
if ent.StackSize == nil then ent.StackSize = 1 end
if slot.isOccupied == false or (ent.StackSize > slot.Count and slot.ItemClass == ent:GetClass()) then
if ent.Weight ~= nil then
slot.SingleWeight = ent.Weight
else
slot.SingleWeight = 1
end
if (slot.SingleWeight + totalWeight) <= getMaxWeight(self, "Inventory") then
slot.isOccupied = true
if ent.Name ~= nil then slot.Name = ent.Name else
slot.Name = ent:GetClass()
end
slot.ItemClass = ent:GetClass()
slot.Count = slot.Count + 1
slot.Model = ent:GetModel()
slot.MaxStack = ent.StackSize
if slot.ItemClass == "spawned_weapon" then
slot.WeaponClass = ent:GetWeaponClass()
else
slot.WeaponClass = nil
end
saveData(self, eq,"Inventory")
if ent:GetClass() == "spawned_weapon" and ent:Getamount() > 1 then
ent:Setamount(ent:Getamount()-1)
else
ent:Remove()
end
self:EmitSound(InventoryConfig.Sounds.pickUp)
return
else
showNotification(self, InventoryConfig.Messages.tooHeavy)
return
end
end
end
-- no space
showNotification(ply, InventoryConfig.Messages.noSpace)
end
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}