• DarkRP: Putting shipments/weapons into categories in the condensed format
    7 replies, posted
I want to put my weapons and other shipments into categories, but the issue is, my shipments.lua uses the condensed format instead of the expanded one, so it looks like this; [code]DarkRP.createShipment("AK-47 Barrels Pack", "models/Items/BoxSRounds.mdl", "cw_attpack_ak74_barrels", 2500, 10, true, 250, false, {TEAM_BLACK})[/code] The regular format looks like this; [code] DarkRP.createShipment("Example shipment", { model = "models/weapons/w_pist_fiveseven.mdl", -- The model of the item that hovers above the shipment entity = "weapon_fiveseven2", -- the entity that comes out of the shipment price = 100, -- the price of one shipment amount = 10, -- how many of the item go in one purchased shipment separate = true, -- whether the item is sold separately (usually used for guns) pricesep = 100, -- the price of a separately sold item noship = false, -- whether this item has a shipment allowed = {TEAM_GUN, TEAM_MEDIC}, -- OPTIONAL, which teams are allowed to buy this shipment/separate gun shipmodel = "models/items/item_item_crate.mdl", -- OPTIONAL, the model of the shipment (this crate is the default) customCheck = function(ply) return ply:Frags() < 10 end, -- OPTIONAL, extra conditions before people can purchase the shipment or separate item CustomCheckFailMsg = function(ply, shipment) return ply:Frags() >= 10 and "You killed too many people" end, -- Can be a simple string as well weight = 15, -- OPTIONAL, the weight of the shipment. The default is the weight of the shipment spareammo = 10, -- OPTIONAL, Add ammo to the default amount of ammo for every weapon clip1 = 10, -- OPTIONAL, The amount of bullets in the primary clip by default clip2 = 10, -- OPTIONAL, The amount of bullets in the secondary clip by default buttonColor = Color(255, 255, 255, 255), -- Optional: The color of the button in the F4 menu, label = "Super pistol", -- Optional: the text on the button in the F4 menu category = "Other", -- The name of the category it is in. Note: the category must be created! sortOrder = 100, -- The position of this thing in its category. Lower number means higher up. })[/code] The main issue here is, I can't just add the category I want it in past the assigned job in quotes; it doesn't work. To do it, I'd assume I'd need to fill in all of the other fields past "allowed", which obviously won't work for me. So my question is this; how, in the condensed format, can I categorize my shipments/weapons?
Have you tried looking into darkrp code for solution?
I'm not really sure what I'd be looking for, since I'd assume it'd be a formatting thing. I'm not really experienced in lua.
[QUOTE=WitheredPyre;47981678]I'm not really sure what I'd be looking for, since I'd assume it'd be a formatting thing. I'm not really experienced in lua.[/QUOTE] Why don't you use the other format then?
[QUOTE=Netheous;47981690]Why don't you use the other format then?[/QUOTE] Because this is the format that I have [i]everything[/i] in, bar the categories themselves, and it'd take an obscenely long time to convert every single one to the new format.
[QUOTE=WitheredPyre;47981702]Because this is the format that I have [i]everything[/i] in, bar the categories themselves, and it'd take an obscenely long time to convert every single one to the new format.[/QUOTE] You don't have to put all the arguments I think. And if so, you can make a table of weapons, then run a for loop that'll put it into tables with data itself. [editline]16th June 2015[/editline] For example: [lua]local weapons = { "one", "two", "three" } for _, wep in pairs ( weapons ) do darkrp.putCrappyTable( { weapon = wep, other = false, category = lel, } end[/lua] There are plenty of solutions
[QUOTE=Netheous;47981729]You don't have to put all the arguments I think. And if so, you can make a table of weapons, then run a for loop that'll put it into tables with data itself.[/QUOTE] I've tried simply putting the category I want it in after the job, formatting it like this; [code]DarkRP.createShipment("AK-47 Barrels Pack", "models/Items/BoxSRounds.mdl", "cw_attpack_ak74_barrels", 2500, 10, true, 250, false, {TEAM_BLACK}, "Attachments")[/code] All that did was break the file and it wouldn't load. Pushing me towards doing the second part myself won't result in anything meaningful. I have no viable lua experience myself, and I won't get anywhere with advice in this thread regarding that unless for whatever reason you or someone else actually feels like doing it. EDIT: Saw your edit. I'll give that solution a try, I suppose. What's the correct place to put that code, and would that work fine since these are shipments, not weapons?
[QUOTE=WitheredPyre;47981750]I've tried simply putting the category I want it in after the job, formatting it like this; [code]DarkRP.createShipment("AK-47 Barrels Pack", "models/Items/BoxSRounds.mdl", "cw_attpack_ak74_barrels", 2500, 10, true, 250, false, {TEAM_BLACK}, "Attachments")[/code] All that did was break the file and it wouldn't load. Pushing me towards doing the second part myself won't result in anything meaningful. I have no viable lua experience myself, and I won't get anywhere with advice in this thread regarding that unless for whatever reason you or someone else actually feels like doing it. EDIT: Saw your edit. I'll give that solution a try, I suppose. What's the correct place to put that code, and would that work fine since these are shipments, not weapons?[/QUOTE] Yeah it was just an example..
Sorry, you need to Log In to post a reply to this thread.