1. Post #1
    jakegadget's Avatar
    June 2009
    167 Posts
    [release]
    [release]
    Upon retrospection, this mod has a few flaws. Namely:
    "Limit" variables are not incremented.
    Somethings (drugs) that have setup variables do not save over
    People have trouble setting up new items

    I am currently designing a new framework that will replace this. The basic look and feel will remain the same, but It should be more stable and easier to use. Feel free to modify this to meet your needs in the meantime.

    I have no ETA on a release for this new Framework (It doesn't even have a name)
    [/release]

    What is this?
    DerpRP Inventory is an advanced DarkRP Inventory that supports not only entities but also darkrp dropped weapons and shipments.

    Why...?
    The number one, by far, thing I get requests for is this. People aren't satisfied with something that holds ents or props. They want to keep their sweps and shipments and foods.

    Features?
    -Change-able items database with support for spawned_weapon and spawned_food.
    -Items save over (duh, the main point)
    -Admins can set max inventory size along with limits on a per item or per section basis.
    -Integrated into gameplay smoothly (no binds), just hold alt+use to pickup and type "!inv" to access your inventory
    -Works for DarkRP out of the box
    -Has descriptions and names for items, allowing for a more integrated rp feel for things such as hungermod foods.

    No picky, no clicky




    How does I added moar items!
    Adding more items is easy!

    Just open up drpshared.lua and add your item in following the previous entries as an example. Here is an addition of the money printer:
    --register your normal ents here
    items = {
    	food = { -- classname
    		name = "Chinese Food", -- Print name
    		desc = "Healthy chinese food, fills your whole hunger bar.", -- description
    		useable = true, --can they use it from the invenotry?
    		max = 0, --max that can be carried, 0 for infinate
    		model = "models/props_junk/garbage_takeoutcarton001a.mdl" -- model
    	},
    	drug = { -- classname
    		name = "Drugs", -- Print name
    		desc = "Duuuuuuuude this stuff makes you BUFF.", -- description
    		useable = true, --can they use it from the invenotry?
    		max = 0, --max that can be carried, 0 for infinate
    		model = "models/props_lab/jar01a.mdl" -- model
    	},
    	money_printer = { -- classname
    		name = "Money Printer", -- Print name
    		desc = "It prints money!", -- description
    		useable = false, --can they use it from the invenotry?
    		max = 2, --max that can be carried, 0 for infinate
    		model = "models/props_c17/consolebox01a.mdl" -- model
    	}	--commands on all closing brackets except the last one
    }
    

    Adding weapons is the same syntax. This example adds the hl2 pistol to the inventory, assuming you already added it to addentities.lua
    --register your sweps here
    weps = {
    	--[[...]]--
    	ls_sniper = {
    		name = "Silenced Sniper", -- Print name
    		desc = "How did you even get this?" -- description
    	},
    	weapon_pistol = {
    		name = "Pistol", -- Print name
    		desc = "Useless gun from hl2" -- description
    	} --commands on all closing brackets except the last one
    }
    
    Food is reserved for items from hungermod. To add more things to hungermod open up darkrp/gamemode/modules/HungerMod.lua and scroll to line 68. This example adds an edible baby:
    --[[...]]--
    AddFoodItem("bottle2", "models/props_junk/garbage_glassbottle002a.mdl", 10)
    AddFoodItem("bottle3", "models/props_junk/garbage_glassbottle003a.mdl", 10)
    AddFoodItem("orange", "models/props/cs_italy/orange.mdl", 20)
    AddFoodItem("baby", "models/props_c17/doll01.mdl", 25)
    
    Then open up drpshared.lua and register the food like so:
    --register your foods
    foodies = {
            --[[...]]--
    	["models/props_junk/garbage_glassbottle003a.mdl"] = { -- model
    		name = "Dos Equis", -- Print name
    		desc = "\"When it is raining, it is because he is sad.\"" -- description
    	},
    	["models/props/cs_italy/orange.mdl"] = { -- model
    		name = "Orange", -- Print name
    		desc = "An Orange a day keep der fuhror away." -- description
    	},
    	["models/props_c17/doll01.mdl"] = { -- model
    		name = "Baby", -- Print name
    		desc = "WHO SENT ALL THESE BABIES TO FITE ME." -- description
    	} --commands on all closing brackets except the last one
    }
    

    Remember, the food section is for items from hungermod only. If your food item is an actual sent it must go into items. I will add an option later to load sents into the food section.

    What next?
    Eventually I would like to create a trade system, and I would like to redo the current item system so that ents are stored in the same way that sweps,food, and shipments are stored.

    To my fellow lua coders
    This is my first release. I have been coding for at least 5 months now but due to issues that came up I have yet to release anything.

    Therefore, I have no idea how well I code because I have had no feedback on it. So please look at my code and criticize me so that I can continue to improve.

    Also, if anyone finds any bugs, please report them here.

    Download
    v1.01

    Small update, forgot a AddCSLuaFile

    [/release]
    Reply With Quote Edit / Delete Reply United States Show Events Useful x 26Dumb x 16Lua King x 9Friendly x 2Funny x 1Informative x 1Late x 1Artistic x 1Winner x 1Bad Spelling x 1Agree x 1 (list)

  2. Post #2
    It's been a long time
    Gurrazor's Avatar
    August 2009
    264 Posts
    Fantastic! This is what I have been waiting for in a half year. You just made GMod a lot better.
    Thank you!
    Reply With Quote Edit / Delete Reply Sweden Show Events Agree Agree x 4Friendly Friendly x 2Dumb Dumb x 2 (list)

  3. Post #3
    ManolisV's Avatar
    May 2010
    129 Posts
    UHMHMH. weapon shipments to?

    Edited:

    Wtf. It was banned

    Edited:

    :( gmod.org banned it??!!
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Dumb Dumb x 4Funny Funny x 2Bad Spelling Bad Spelling x 1Agree Agree x 1 (list)

  4. Post #4
    jakegadget's Avatar
    June 2009
    167 Posts
    Sorry I jacked up the AddCSLuaFile part, its fixed now.
    Reply With Quote Edit / Delete Reply United States Show Events Friendly Friendly x 1Funny Funny x 1 (list)

  5. Post #5
    ManolisV's Avatar
    May 2010
    129 Posts
    silly
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Dumb Dumb x 1 (list)

  6. Post #6
    LukeWilliams's Avatar
    September 2009
    169 Posts
    Looks fucking swish, good job man!
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Friendly Friendly x 1Agree Agree x 1 (list)

  7. Post #7
    Cool Kid
    meatwad253's Avatar
    December 2009
    1,211 Posts
    Wow this looks really good holy shit nice lua coding lol

  8. Post #8
    vioman's Avatar
    June 2009
    25 Posts
    This is great! Shit man love it! <3

  9. Post #9
    jakegadget's Avatar
    June 2009
    167 Posts
    Thanks for all the positive feedback. Let me know how it works for you guys.
    Reply With Quote Edit / Delete Reply United States Show Events Informative Informative x 1 (list)

  10. Post #10
    LukeWilliams's Avatar
    September 2009
    169 Posts
    Setting it up now, whats your Steam username? Then you can hop on my server when it's done :)

  11. Post #11

    June 2010
    66 Posts
    this is awesome but i request one thing... could you make it so you press f3 to open the menu and also the pocket would pickup the items with left click and right click would open the menu also?

  12. Post #12
    LukeWilliams's Avatar
    September 2009
    169 Posts
    this is awesome but i request one thing... could you make it so you press f3 to open the menu and also the pocket would pickup the items with left click and right click would open the menu also?
    No you can't, the whole point of this is to remove the pocket.

  13. Post #13
    jakegadget's Avatar
    June 2009
    167 Posts
    My steam username is jakegadget.

    And the purpose of this is alternative to the pocket. I believe they work well together. And I dislike the idea of needing ANOTHER swep.

  14. Post #14

    February 2010
    31 Posts
    Love it, next i think you may be able to do a new scoreboard.

    that would be awesome
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Late Late x 1 (list)

  15. Post #15

    June 2010
    66 Posts
    how about then just making it so you press f3 to open the inventory and normal use to pick it up.

  16. Post #16
    jakegadget's Avatar
    June 2009
    167 Posts
    Love it, next i think you may be able to do a new scoreboard.
    HUD/Derma is my weakest point. I could try but I don't see it happening anytime soon.

    how about then just making it so you press f3 to open the inventory and normal use to pick it up.
    F3 is reserved in DarkRP for the gui clicker.
    Normal use would conflict with actual use of items.

    The idea is for it to be out of sight and out of mind, so you don't feel forced to use it.

    If you want to rebind your inventory open key the command is "drp_showinv".

  17. Post #17
    h4rDm0d's Avatar
    May 2010
    97 Posts
    when i tried to add health and others to the items list it didnt work only when in the weapons list?

  18. Post #18
    MHGooseMH's Avatar
    February 2010
    75 Posts
    Great job,Keep up the good work! Will be using this on my RP server :D

  19. Post #19
    jakegadget's Avatar
    June 2009
    167 Posts
    when i tried to add health and others to the items list it didnt work only when in the weapons list?
    How did you add it? You have to have a sent first, and you have to add it in right. Show me what you did.

  20. Post #20
    redx475's Avatar
    February 2009
    555 Posts
    Lol @ win.

    Didn't realize how many people wanted this type of thing when Jake told me about it :P

  21. Post #21

    February 2010
    31 Posts
    Maybe like the old f4 menu, you could add an admin section

  22. Post #22
    Gold Member
    SlayerFin's Avatar
    May 2008
    4,243 Posts
    Awesome, this is really useful for most of the DarkRP servers.

  23. Post #23
    dumb ass
    RoFLWaFFLEZZ's Avatar
    April 2009
    2,582 Posts
    great, more little kids will be saying "omg mai derp srver haz invetnroy that i md meself"
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 2Agree Agree x 2 (list)

  24. Post #24
    redx475's Avatar
    February 2009
    555 Posts
    I doubt they will say they made it themselves (but who knows...), and I'm pretty sure the code wasn't made to be mod-able

  25. Post #25
    vioman's Avatar
    June 2009
    25 Posts
    great, more little kids will be saying "omg mai derp srver haz invetnroy that i md meself"
    That is true some people do that, but that is the risk the authors have to realize when releasing scripts.

  26. Post #26
    Gold Member
    BillyMays's Avatar
    February 2009
    345 Posts
    This is an addon, correct?
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 1 (list)

  27. Post #27
    h4rDm0d's Avatar
    May 2010
    97 Posts
    when i wanted to add things to the items list like health kit

    Code:
    	med_kit = { -- classname
    		name = "Medic Kit", 
    		desc = "Heals people", -- description
    		useable = true,
    		max = 0, 
    		model = "models/weapons/w_c4.mdl" 
    	}
    the model probably isnt correct but it wast that it just didnt work..

  28. Post #28
    jakegadget's Avatar
    June 2009
    167 Posts
    ...the model probably isnt correct but it wast that it just didnt work.
    So you added it like this right?
    --register your normal ents here
    items = {
    	food = { -- classname
    		name = "Chinese Food", -- Print name
    		desc = "Healthy chinese food, fills your whole hunger bar.", -- description
    		useable = true, --can they use it from the invenotry?
    		max = 0, --max that can be carried, 0 for infinate
    		model = "models/props_junk/garbage_takeoutcarton001a.mdl" -- model
    	},
    	drug = { -- classname
    		name = "Drugs", -- Print name
    		desc = "Duuuuuuuude this stuff makes you BUFF.", -- description
    		useable = true, --can they use it from the invenotry?
    		max = 0, --max that can be carried, 0 for infinate
    		model = "models/props_lab/jar01a.mdl" -- model
    	},
    	med_kit = { -- classname
    		name = "Medic Kit", 
    		desc = "Heals people",
    		useable = true,
    		max = 0, 
    		model = "models/weapons/w_c4.mdl" 
    	}
    }
    

    Also this is a sent correct? sweps are registered differently.

    Edited:

    Also any errors?

  29. Post #29
    Andriko1's Avatar
    November 2009
    559 Posts
    D: I tried adding css realistic weapons to this, and moved the chinese food into the foodies section, but it didn't work... I got this error:

    ERROR: Hook 'DrpPlyUse' Failed: addons\derprp inv\lua\autorun\server\drpinv.lua:61: attempt to index global 'items' (a nil value)
    Removing Hook 'DrpPlyUse'

    and this is my drpshared.lua:

    -- item definitions
    -- These are for custom ents. Default shipments, weapons, and food are already handled

    -- forbidden ent classnames (these will break the addon):
    --[[
    sweps
    ships
    foods
    _size
    ]]--

    --register your normal ents here
    items = {
    drug = { -- classname
    name = "Drugs", -- Print name
    desc = "Duuuuuuuude this stuff makes you BUFF.", -- description
    useable = true, --can they use it from the inventory?
    max = 0, --max that can be carried, 0 for infinite
    model = "models/props_lab/jar01a.mdl" -- model
    } --commands on all closing brackets except the last one
    }

    --register your sweps here
    weps = {
    weapon_real_cs_admin_weapon = {
    name = "Admin Gun",
    desc = "Blast away those mingebags!"
    },
    weapon_real_cs_ak47 = {
    name = "AK47", -- Print name
    desc = "Stereotypical weapon of the terrorist." -- description
    },
    weapon_real_cs_aug = {
    name = "Steyr AUG A1",
    desc = "The BEST bullpup out there."
    },
    weapon_real_cs_awp = {
    name = "UTG L96 AWP",
    desc = "DOUBLE SCOPE! W00T!"
    },
    weapon_real_cs_desert_eagle = {
    name = "Desert Eagle",
    desc = "Hold this as tight as you possibly can while shooting."
    },
    weapon_real_cs_elites = {
    name = "Dual Berreta Elites",
    desc = "Badass, just, badass."
    },
    weapon_real_cs_famas = {
    name = "FAMAS F1",
    desc = "A french bullpup best suited for close range."
    },
    weapon_real_cs_five-seven = {
    name = "FN Five-Seven", -- Print name
    desc = "It shoots bullets, what else need be said?" -- description
    },
    weapon_real_cs_flash = {
    name = "Flash Grenade",
    desc = "And you thought a camera flash was bad."
    },
    weapon_real_cs_g3sg1 = {
    name = "HK G3SG1",
    desc = "Snipe those bitches!"
    },
    weapon_real_cs_galil = {
    name = "Galil SAR",
    desc = "The Israeli AK47, cause Jews can't afford AKs"
    },
    weapon_real_cs_glock18 = {
    name = "Glock 18",
    desc = "The standard police pistol"
    },
    weapon_real_cs_grenade = {
    name = "Frag Grenade",
    desc = "Frag out!"
    },
    weapon_real_cs_knife = {
    name = "Knife",
    desc = "You cut things with this..."
    },
    weapon_real_cs_m4a1 = {
    name = "Colt M4A1",
    desc = "Iraqi nightmare."
    },
    weapon_real_cs_m249 = {
    name = "M249 SAW",
    desc = "You can carry this?"
    },
    weapon_real_cs_mac10 = {
    name = "Ingram Mac M10",
    desc = "An automatic weapon for the rest of us."
    },
    weapon_real_cs_p90 = {
    name = "FN P90",
    desc = "Aww it's so cute."
    },
    weapon_real_cs_p228 = {
    name = "Sig-Sauer P228",
    desc = "Why does it have numbers in its name? Who cares!"
    },
    weapon_real_cs_pumpshotgun = {
    name = "Benelli M3 Super 90",
    desc = "\"Get off my lawn...\""
    },
    weapon_real_cs_scout = {
    name = "Steyr Scout",
    desc = "\"BOOM! Headshot!\""
    },
    weapon_real_cs_sg550 = {
    name = "Sig SG-550 SNIPER",
    desc = "This is the sniper, the SG-552 is the automatic one ;)"
    },
    weapon_real_cs_sg552 = {
    name = "Sig SG-552",
    desc = "Andriko's gun of choice!"
    },
    weapon_real_cs_smoke = {
    name = "Smoke Grenade",
    desc = "Guys, get ready for the lagfest!"
    },
    weapon_real_cs_tmp = {
    name = "Steyr TMP",
    desc = "The smexiest sub-machine gun out there."
    },
    weapon_real_cs_ump_45 = {
    name = "HK UMP-45",
    desc = "Another sub-machine gun..."
    },
    weapon_real_cs_usp = {
    name = "HK USP",
    desc = "Pew pew pew!"
    },
    weapon_real_cs_xm1014 = {
    name = "Benelli M4 Super 90",
    desc = "Auto-shotty baybay!"
    },
    weapon_deagle2 = {
    name = "Desert Eagle", -- Print name
    desc = "\"BOOM! Headshot!\"" -- description
    },
    weapon_fiveseven2 = {
    name = "Fiveseven", -- Print name
    desc = "It shoots bullets, what else need be said?" -- description
    },
    weapon_glock2 = {
    name = "Glock", -- Print name
    desc = "The crappiest gun in the game. Leave it for the popo." -- description
    },
    weapon_p2282 = {
    name = "P228", -- Print name
    desc = "Why does it have numbers in its name? Who cares!" -- description
    },
    weapon_ak472 = {
    name = "AK47", -- Print name
    desc = "Stereotypical weapon of the terrorist." -- description
    },
    weapon_mp52 = {
    name = "MP5", -- Print name
    desc = "Baby-gun used by those SWAT guys." -- description
    },
    weapon_m42 = {
    name = "M4", -- Print name
    desc = "Iraqi nightmare." -- description
    },
    weapon_mac102 = {
    name = "Mac 10", -- Print name
    desc = "An automatic weapon for the rest of us." -- description
    },
    weapon_pumpshotgun2 = {
    name = "Pump Shotty", -- Print name
    desc = "\"Get off my lawn...\"" -- description
    },
    ls_sniper = {
    name = "Silenced Sniper", -- Print name
    desc = "How did you even get this?" -- description
    } --commands on all closing brackets except the last one
    }

    --register your foods
    foodies = {
    ["models/props_junk/garbage_takeoutcarton001a.mdl"] = { -- model
    name = "Chinese Food", -- Print name
    desc = "Healthy chinese food, fills your whole hunger bar." -- description
    },
    ["models/props/cs_italy/bananna.mdl"] = { -- model
    name = "Banana", -- Print name
    desc = "Yummy single banana." -- description
    },
    ["models/props/cs_italy/bananna_bunch.mdl"] = { -- model
    name = "Banana Bunch", -- Print name
    desc = "A whole bunch of 'nanas!" -- description
    },
    ["models/props_junk/watermelon01.mdl"] = { -- model
    name = "Melon", -- Print name
    desc = "A melon from Garry's own farm." -- description
    },
    ["models/props_junk/glassbottle01a.mdl"] = { -- model
    name = "Vodka", -- Print name
    desc = "In Soviet Russia, items put YOU in inventory!" -- description
    },
    ["models/props_junk/popcan01a.mdl"] = { -- model
    name = "Soda", -- Print name
    desc = "Straight from Dr. Breen's private reserve." -- description
    },
    ["models/props_junk/garbage_plasticbottle003a.mdl"] = { -- model
    name = "2-Liter Soda", -- Print name
    desc = "Don't forget the mentos!" -- description
    },
    ["models/props_junk/garbage_milkcarton002a.mdl"] = { -- model
    name = "Melk", -- Print name
    desc = "It's good for your bones or sumthing." -- description
    },
    ["models/props_junk/garbage_glassbottle001a.mdl"] = { -- model
    name = "B33R", -- Print name
    desc = "Now you can be just like Mastur Cheef!" -- description
    },
    ["models/props_junk/garbage_glassbottle002a.mdl"] = { -- model
    name = "Bagged Bud Light", -- Print name
    desc = "BYOB?" -- description
    },
    ["models/props_junk/garbage_glassbottle003a.mdl"] = { -- model
    name = "Dos Equis", -- Print name
    desc = "\"When it is raining, it is because he is sad.\"" -- description
    },
    ["models/props/cs_italy/orange.mdl"] = { -- model
    name = "Orange", -- Print name
    desc = "An Orange a day keep der fuhror away." -- description
    } --commands on all closing brackets except the last one
    }

  30. Post #30
    jakegadget's Avatar
    June 2009
    167 Posts
    I know I didn't make this clear and I apologize, but food items are reserved for models added in hunger mod only. Food ents should be registered under entities.

    The error means you messed up something on your table so look for another error higher up. Also wrap your code in lua tags.

    Edited:

    Also your css weapons look like they were added correctly.

  31. Post #31
    Andriko1's Avatar
    November 2009
    559 Posts
    So, if I add the model in hungermod, then it'll work? :D
    Basically, can you put a tutorial on how to add things so you can add them to your inventory
    Reply With Quote Edit / Delete Reply Canada Show Events Agree Agree x 1 (list)

  32. Post #32
    Gold Member
    Crap-Head's Avatar
    May 2010
    409 Posts
    Also your css weapons look like they were added correctly.
    I also have this, I added ALL of the CSS Weapons correctly but they still seems to be picked up as normal :( Could you please take a look on that.

  33. Post #33
    jakegadget's Avatar
    June 2009
    167 Posts
    Ok I updated the OP with a tutorial. Just remember that items is for sents, weapons is for sweps, and food is for hungermod foods.

    Edited:

    Also to pick weapons up they must have been spawned through the f4 menu or from a gunlab. Guns from the qmenu will not work.

  34. Post #34
    Master_Xeon's Avatar
    November 2008
    322 Posts
    What's melk?
    Reply With Quote Edit / Delete Reply Denmark Show Events Dumb Dumb x 2 (list)

  35. Post #35
    Vinze's Avatar
    August 2009
    4,042 Posts
    Sweet, we need more scripters like you, instead of the regular, bitter, obviously impotent kind going "hurp durp drp sux lol i r gonnan meak my own kewl skript cuz urs sux lol".
    Reply With Quote Edit / Delete Reply Spain Show Events Agree Agree x 1 (list)

  36. Post #36
    Mortson's Avatar
    July 2008
    1,035 Posts
    Shame I don't have my server anymore. I wanted this so badly when I had it.

  37. Post #37
    Gold Member
    Crap-Head's Avatar
    May 2010
    409 Posts
    Ok I updated the OP with a tutorial. Just remember that items is for sents, weapons is for sweps, and food is for hungermod foods.

    Edited:

    Also to pick weapons up they must have been spawned through the f4 menu or from a gunlab. Guns from the qmenu will not work.
    Could you do an exaple of a CSS weapon from CSS Realistic Weapons please :P

    Thank you ;) (Also please test if it even works with CSS Realistic Weapons)

  38. Post #38
    Vinze's Avatar
    August 2009
    4,042 Posts
    Code:
    Hook 'DrpPlyUse' Failed: ...\lua\autorun\server\drpinv.lua:61: attempt to index global 'items' (a nil value)
    Any idea how to fix this? It refuses ANY item to be added to the inventory.

  39. Post #39
    jakegadget's Avatar
    June 2009
    167 Posts
    Could you do an exaple of a CSS weapon from CSS Realistic Weapons please :P

    Thank you ;) (Also please test if it even works with CSS Realistic Weapons)
    It works with all sweps. If I remember this should add the glock:
    --register your sweps here
    weps = {
    	--[[...]]--
    	ls_sniper = {
    		name = "Silenced Sniper", -- Print name
    		desc = "How did you even get this?" -- description
    	},
    	weapon_real_glock = {
    		name = "Realistic Glock", -- Print name
    		desc = "A civilian weapon." -- description
    	} --commands on all closing brackets except the last one
    }
    

    Code:
    Hook 'DrpPlyUse' Failed: ...\lua\autorun\server\drpinv.lua:61: attempt to index global 'items' (a nil value)
    Any idea how to fix this? It refuses ANY item to be added to the inventory.
    This means you defined one of the items wrong. Look higher up for errors relating to the actual error.

  40. Post #40
    Vinze's Avatar
    August 2009
    4,042 Posts
    It works with all sweps. If I remember this should add the glock:
    --register your sweps here
    weps = {
    --[[...]]--
    ls_sniper = {
    name = "Silenced Sniper", -- Print name
    desc = "How did you even get this?" -- description
    },
    weapon_real_glock = {
    name = "Realistic Glock", -- Print name
    desc = "A civilian weapon." -- description
    } --commands on all closing brackets except the last one
    }



    This means you defined one of the items wrong. Look higher up for errors relating to the actual error.
    Oh, thanks. I'll do that.

    ALSO: Must the SWEPs be in the gamemode folder? Like, darkrp/entities? May seem stupid, but, I only know the very basics of Lua, so it can't hurt asking.