Skeleton RP Gamemode - Learn Bad Habits for Free!

We’ll i’ve been working on a RP gamemode for a while now on and off just for fun and wasn’t planning on releasing anything until i’m done as i work full time as a brickies labourer and i get about 4-5 hours done on it a week, but i figure at the moment it’s a pretty decent skeleton/base to start learning from so if you want to develop off of this please just promise me you’ll put my name in the smallprint.

Eventually, i’m going to have it integrated with customizable weaponry for the arms dealers but bullets will be a whole different story ( very scarce, expensive and hard to find )

Don’t expect to host this and have a good time with people straight away as there’s barely any weapons build in bar a deagle and at the moment you can’t even spawn any weapons/items properly, so yeah, there’s still a LOT to be done.

You can however swap between all 3 jobs/classes instantly by holding c or pressing f3 to get the mouse cursor up and right clicking on a nearby wall or the floor
Doors also work the same way and if you add 2 or more doors to the same Door group when you buy one you get them all.
You can also currently only make doors exclusive to police, but once I’m done with the core of that whole system i intend to make the whole thing Vgui based.

The current HuD and menus are just quick mockups so i can see visually what’s going on behind the game, there’s other weird things you’ll deal with if you do play it like my debug prints but they’re easy to remove.

Any constructive criticism / suggestions to make anything more efficient or easier is/are welcome.

I plan to keep working on this as much as i can and when it gets to a state that i believe is name worthy, then I’ll post a proper release in the gamemode section with all the aspirations of what i want it to be and a name…


EDIT 1/15/2014 1:26 AM - Fuck I hope edits don’t bump.

Discontinued due to entire community being full of 8 year olds and people with too much spare time, better more experienced people than me working on the same kind of thing and I thought I should conform to the facepunch norm of discontinuing shitty projects after publishing them prematurely ( Rust ).
Good day.

I was going to thank you, untill you called me an anus.

Line 1: build.lua:

// anus

__ OT:

Nice release OP, I like the hud.

Judging from the image, the HUD looks identical to DarkDM. Is this intentional or did you copy the code for it?

I’m actually currently working on changing that at the moment

Trying to figure out some way to make a health and armour ring around the crosshair but i’m not having much luck. ( hint Suggestions hint )
Should also mention armour works, will be purchasable and reduces damage taken significantly until it’s all gone.
Headshots will always be instant kills, and you’ll drop all the money in your wallet when you die for your assailant to pick up once the bank and banker are done.
To avoid RDMing i’m thinking ‘Virtual PTSD’ or some bs along them lines that prevents the player from actually firing anything and makes em flip out if they kill too many people (2-3) as well as the whole bullet scavenge ( or is that a stupid idea ? )


Try looking on Workshop for some of the many HUDs and take ideas from them.

Or just do what I did for my personal gamemode and make a FrankenHUD from 7 HUDs.

No offence, but your spacing is atrocious. There are still some print()'s which makes the whole thing seem still WIP and not polished.

I was more thinking of just Derma’ing the shit out of it :stuck_out_tongue: But i will have a look around and see how people have made stuff look pretty. Thanks for the suggestion :slight_smile:

Also it is WIP and I have bad habits, but spacing is purely cosmetics for the coder and has nothing to do with actual functionality thus i leave it till last if I do miss it/make it look terrible.

Can’t believe that people are posting threads like “where/how to learn lua” but then they start bitching after someone gives them free code to learn from.

Yes I know, nobody is bitching yet but I am guessing someone will.

Currently getting my dedi up and running so i can get this up on a multiplayer server and start testing, I.P Address is but be warned i’m Australian and most of you are bound to get terrible ping :smiley:

Once i get a couple of bugs out the way ill put a cleaner version up

Edit: Just realised steam has changed over to steamcmd stuff, servers gonna be up as soon as the downloads done which being in Western Aus with our shitty internet will be a while.
Enjoy this for what it is.

The player model sets itself to that grey freeman model.

Yeah, i still haven’t chosen player models yet and i’m gonna add a command to toggle whether or not they’re forced by the server.

Also going to make it so jobs are all locked when you first join the game bar some like; chef, medic, Receptionist, etc and you have to make money by peddling small goods that you can buy or find and just spending time in the game and earning your pay cheque. That way people can’t just join the game, become a cop and start blasting people. Of course the classes with a higher chance to promote/take part in RDMing will be the most expensive and time consuming to unlock, unless the server owner/admin deems you trustworthy.

To fix the model thing yourself in the meantime just change these things or remove them.

-- init.lua


-- Player.lua

function SetJob(ply, cmd, args)

	local job = string.lower(args[1])

	if ply.Info['JobChange'] == nil then ply.Info['JobChange'] = CurTime() - 20 end

	if ply.Info['JobChange'] <= CurTime() or ply.Info['JobChange'] == nil or ply:IsAdmin() then

		for k, v in pairs(Jobs) do
			if job == string.lower(tostring(k)) then

				local job2 = string.gsub(k, "_", " ") // This is because we have jobs like Mob_Boss. Simply replaces all underscores with spaces
				ply.Info['Job'] = job2
				ply.Info['Salary'] = v['Salary']
				ply.Info['Model'] = v['Model'] // <<<< Add this
				ply.Info['JobChange'] = tonumber(CurTime()+30)
				ply:SetModel(ply.Info['Model'])  // <<<<<<<<<< And this
		local tiem = math.ceil(CurTime() - ply.Info['JobChange'])
		ply:ChatPrint('You must wait another ' .. -tiem .. ' seconds to do that')

-- Shared.lua

Jobs = {}
Jobs['Police'] = {}

local Police = Jobs['Police']
Police['Salary'] = 90
Police['Weapons'] = {"weapon_physgun", "gmod_tool", 'gmod_camera', 'cstm_pistol_deagle', 'stunstick', 'door_ram'}
Police['Model'] = "path/to/model/model.mdl"

Why tiem?
Looks like you’re in a hurry

You could implement something similar to DarkDM where it gives classes a set group of models to pick from.

If you do add model selections, please make sure you can select body/skin groups as that helps add more variety with fewer models; as far as I am aware that is/was something DarkDM was lacking.

If you add me on Steam I’d be willing to help you out in any way I could.

Another thing I would suggest is making each of the player classes as their own Lua file; that way we don’t end up with one giant-ass list of tables and code blocks.