Hello, I’m trying to fix 2 bugs with the inventory mod, made by jakegadget: http://www.facepunch.com/threads/955706
So I’m going to post them, hoping you guys have ideas.
- The pickup glitch
When you select a weapon from the inventory, using the option ‘pickup’ it doesn’t give you anything. Everything else works when you press pickup, just not the guns, I’m using mad cows weapons. I have some code that might be useful:
This is in lua/autorun/server/drpinv.lua:
local function useswep(ply, cmd, args)
local item = tonumber(args[1])
if !item or ply.inv.sweps[item] == nil then
if shouldlog:GetBool() then
print("[DrpInv]: " .. ply:Nick() .. " tried to use invalid swep " .. item .. "!")
end
return
end
local ent = ents.Create("spawned_weapon")
ent:SetPos(ply:GetPos())
ent:SetModel(ply.inv.sweps[item].model)
ent.weaponclass = ply.inv.sweps[item].class
ent.ShareGravgun = true
ent.nodupe = true
ent:Spawn()
ent:Activate()
ent:Use(ply, ply)
if shouldlog:GetBool() then
print("[DrpInv]: " .. ply:Nick() .. " dropped and used swep " .. item .. "!")
end
ply.inv._size = ply.inv._size - 1
ply:RemoveSwep(item)
end
concommand.Add("drp_useswep", useswep)
So that adds the console command, I guess?
Anyway here is what’s in lua/autorun/client/cl_drpinv.lua:
local use = vgui.Create("DButton", DPanel1)
use:SetSize(45, 15)
use:SetPos(360, 54)
use:SetText("Pickup")
use.DoClick = function()
RunConsoleCommand("drp_useswep", k)
DFrame1:Remove()
end
list2:AddItem(DPanel1)
So that is what it runs when you click the button ‘pickup’ i guess…?
Anyway, I added all the weapons in right, I am for sure on that, if you think i’m wrong here you go:
weps = {
weapon_real_cs_desert_eagle = {
name = "Desert Eagle", -- Print name
desc = "\"BOOM! Headshot!\"" -- description
},
weapon_real_cs_p228 = {
name = "P228", -- Print name
desc = "Why does it have numbers in its name? Who cares!" -- description
},
weapon_real_cs_ak47 = {
name = "AK47", -- Print name
desc = "Stereotypical weapon of the terrorist." -- description
},
weapon_real_cs_mp5a5 = {
name = "MP5", -- Print name
desc = "Baby-gun used by those SWAT guys." -- description
},
weapon_real_cs_five_seven = {
name = "Fiveseven", -- Print name
desc = "It shoots bullets, what else need be said?" -- description
},
weapon_real_cs_m4a1 = {
name = "M4", -- Print name
desc = "Iraqi nightmare." -- description
},
weapon_real_cs_mac10 = {
name = "Mac 10", -- Print name
desc = "An automatic weapon for the rest of us." -- description
},
weapon_real_cs_pumpshotgun = {
name = "Pump Shotty", -- Print name
desc = "\"Get off my lawn...\"" -- description
},
weapon_real_cs_g3sg1 = {
name = "G3SG1", -- Print name
desc = "Snipin Dem Bitchz" -- description
},
weapon_real_cs_p90 = {
name = "P90",
desc = "Optimus's favorite.",
},
weapon_real_cs_galil = {
name = "Galil",
desc = "Boom",
}
}
- Inventory not picking up DurgzMod
It doesn’t go into the inventory when I spawn it from the Drug Dealer class in the DarkRP f4 menu,
but when you spawn it from the Q menu, it does go into the inventory! So any ideas…?
Here is the code I put for adding the Drugs:
items = {
durgz_aspirin = { -- classname
name = "Aspirin", -- Print name
desc = "For your headaches, or you could abuse it.", -- description
useable = true, --can they use it from the invenotry?
max = 0, --max that can be carried, 0 for infinate
model = "models/jaanus/aspbtl.mdl" -- model
},
durgz_acid = { -- classname
name = "Acid", -- Print name
desc = "Trip out", -- description
useable = true, --can they use it from the invenotry?
max = 0, --max that can be carried, 0 for infinate
model = "models/smile/smile.mdl" -- model
},--commands on all closing brackets except the last one
durgz_alcohol = {
name = "Alcohol",
desc = "Get drunk",
useable = true,
max = 0,
model = "models/drug_mod/alcohol_can.mdl",
},
durgz_cigarette = {
name = "cigarette",
desc = "Basic Shiborro smokes",
useable = true,
max = 0,
model = "models/boxopencigshib.mdl",
},
durgz_cocaine = {
name = "cocaine",
desc = "Sniff dat shit",
useable = true,
max = 0,
model = "models/cocn.mdl"
},
durgz_heroine = {
name = "heroine",
desc = "Probably not a good idea to take this...",
useable = true,
max = 0,
model = "models/katharsmodels/syringe_out/syringe_out.mdl",
},
durgz_weed = {
name = "weed",
desc = "yeah man",
useable = true,
max = 0,
model = "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl",
},
durgz_water = {
name = "water bottle",
desc = "For some reason this instantly wears off your high",
useable = true,
max = 0,
model = "models/drug_mod/the_bottle_of_water.mdl",
}
}
So yeah, any ideas? Maybe something I could change in DarkRP that would make the Durgz that spawn from the F4 like the Q menu ones?
Thanks for your time, hope you can help!