Tutorial: spawning entities/making them available for purchase in DarkRP F4 menu.

[TABLE=“class: grid, width: 796, align: center”]

Hiya, as I’ve been posting add-ons for mainly DarkRP based servers: the question has risen on how to spawn entities or use them within DarkRP. I figured it would be easiest to make a tutorial in a thread. Simply so I only have to link towards it, rather than scorge entire books into a tiny readme file. I hope you don’t mind. I couldn’t find a better category to post it in.

Admin way

:clubs: Spawn through console.
[SUB]Spawn an entity using your console. Make sure you are logged in to RCON or in the server as a superadmin.
[/SUB]
[SUB]Perform the following command:[/SUB]
[SUB]*ent_create name
*rcon ent_create name
ulx ent name
Example: ent_create telephone_booth
[/SUB]
:clubs: Auto-spawner code.
[SUB]This code will spawn your entities automatically when the map is loaded. This way you only have to set them in position once. The tutorial is written by KillerLUA and available on the maurits.tv wiki. This will require some LUA skills.
[/SUB]
[SUB]Read it here[/SUB]

Role-play way

:spades: Add it to F4 menu.
[SUB]Go to the DarkRP core gamemode folder found here: *garrysmod\gamemodes\DarkRP\gamemode
*
Add the following:

[/SUB]

AddEntity("TITLE IN SHOP MENU", { //title as shown when hovering on F4 menu.
ent = "entityname", //name of the entity as found in your entities/entities folder in the DarkRP gamemode.
model = "models/props/cs_office/computer.mdl", //model of the entity
price = 500, //costs to purchase it
max = 1, //max spawning entity (example max 2 printers)
cmd = "/buyentityname", //chat command to purchase entity
allowed = TEAM_JOB //job belonging to the entity, example: TEAM_BANKER
})

That should do the job! Good luck!

[/TABLE]