Derp RP Buyers - DarkRP Entity buyers

[release]
What is this?
DerpRP Buyers are npc’s that purchase entities from you in DarkRP. This is very similar to the pawnshop npc in OC. As you sell and buy the buy price changes (see below).

This was created at a request.

How do I use them?
Just pick up a valid entity and touch it to them with the grav gun.

Why…?
This is definitely a niche addon. It is best used with things that produce entities over time, such as this plant. I recommend not using this with any entities purchasable from the f4 menu. That would result in money farming.

Features?
-Definable item database for purchasing
-Invincible “npcs”
-Seprate names and models per “npc”
-Saving and loading on map start
-DarkRP Themed 3D2D labels
-Miniature supply demand on npcs (As you buy from them their buy amount goes down, and increases slowly over time.)

Setup
Look where you want an npc and type in console:



drp_makebuyer <index from buyer table (see below)> <model> <name (shown on label)>


And if all went right you npc is created! Before you can save him, you need to place his label somewhere. Look where you want it and type:



drp_labpos


If you missplace, just run it again until you have it right.

Now that your npc and label are placed, finish up by typing:



drp_savenpcs


Now your npc will spawn on map start! To remove him, just hit him with your remove tool and run the save command again.

No picky, no clicky
[img_thumb]http://s3-llnw-screenshots.wegame.com/10-8556641542873645/8556641542873645.jpg[/img_thumb]
[img_thumb]http://s3-llnw-screenshots.wegame.com/10-5820968202638994/5820968202638994.jpg[/img_thumb]

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

Just open up drpnpcshared.lua and add your item in following the previous entries as an example. Here is an addition of an npc that buys money printers (read warning above):
[lua]
buyers = {
foodbuyer = { --name used in concommand
entclass = “food”, --entity name
buyamt = 10, --base amount to buy for
flux = 1, --how much it changes up/down (0 to disable changing)
max = 15, --if flux =/= 0 then minimun and maximun buy amounts
min = 5, – ^^
nicename = “Chinese Food” – nice name show, shows as “Buying xxx”
},
akbuyer = {
entclass = “spawned_weapon”,
buyamt = 250,
flux = 5,
max = 300,
min = 225,
requiredvars = {weaponclass = “weapon_ak472”}, --ADVANCED: If your entity has extra variables, this will check them (server side)
nicename = “Ak-47’s”
},
melonbuyer = {
entclass = “spawned_food”,
buyamt = 5,
flux = 0, --disable changin of price so we dont need min/max
requiredmodel = “models/props_junk/watermelon01.mdl”, --ADVANCED: only buy entites with the correct model
nicename = “Melons”
},
printerbuyer = {
entclass = “money_printer”,
buyamt = 500,
flux = 25,
max = 800,
min = 200,
nicename = “Money Printers”
}
}
[/lua]

What next?
I would like to make a list of purchasable items and allow them to be sold to a single npc, however I don’t see any non bug fixing updates unless people show an interest in this.

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

Download
v1.0
http://www.garrysmod.org/img/?t=dll&id=101997

[/release]

This is a pretty sweet addon. Too bad not many people know about this addon. I’m sure it would be used on lots of servers! :smiley:

Goddammit… I was thinking of something like this for my shopmod… STOP STEALING MY IDEAS, even if we do work together on stuff :slight_smile:

Awesome!

Haha sorry. I was hoping I wasn’t infringing on your territory too much. I just had the guy that asked for it riding me pretty hard.

Lol I was kidding… It would be hard to make something that could easily work with any inventory though, so I have other things to do first.

Wouldn’t the cost of an item go UP as people buy more of it, as opposed to down?

Inversely, wouldn’t it also slowly move back down over time?

The OP’s hard to understand.

A suggestion: The price for the goods should gradually become lower as the “npc” receives more of the goods.
Other then that,it seems like a nice idea. Added to my server.

i was wondering if i could use this for my gamemode
also i would need to code them as well will give credit (not credit on the server :stuck_out_tongue: )

jake ? can you also make a cardealer npc ?

The npcs dont sell, they buy. hence, as you sell to them, the supply is increasing and demand is decreasing. over time, if people dont sell to them the price goes up. if you let them fester they can buy for alot more, but you risk someone selling to them and lowering the price again.

If you made a full shop system with buying + selling, this would be an amazing add on to dark rp.

Yes, i quite aggree. If you need help coding, just ask me :wink:

If you want selling, look in the addons section for ShopMod, though it doesn’t support NPCs that buy currently.

I have a problem with this the code i used for it was

Cokebuyer = {
entclass = “durgz_cocaine”,
buyamt = 750,
flux = 10,
max = 850,
min = 600,
nicename = “Coke”
}
}

It just doesn’t accept the cocaine for some reason.

Can anyone help

I just realized none of the shops work and I did a clean install I am still tampering with this though

Thanks Cubie, I might use this too =P

So uh, how would i add the akbuyer? im confused can you plz give me an example?

drp_labpos Does not seem to work for me. I tried like 20 times and couldn’t get it to work.

[editline]08:28PM[/editline]

Nevermind I got it to work

dos it works in sandbox…???