Garry's Mod

Garry's Mod

Firearms Source Weapons For Gmod 13
nzkfc 11 Jan, 2014 @ 9:14pm
DarkRP Spawning in job with guns/ammo
Hi all,

I noticed two issues with this pack when using it in DarkRP:
1. If you tell a job to give a weapon, it spawns on the floor.
2. Guns come with no clipsize set so you don't get ammo right off, this is an issue for Police/SWAT jobs that should be given ammo by default.

Here are solutions to these issues for DarkRP use:

Issue 1 fix:

When telling a job to spawn with a weapon, we use the code "weapons = {"Weapon Code"}," in the jobs.lua file.

For example in this pack, Siminov uses sim_fas_glock20 in his code to identify the gun, however if you use sim_fas_ as the code the gun will spawn at your feet.

You need to use weapon_fas_<gun> instead so the gun is given to the players inventory.

e.g.: "weapons = {"weapon_fas_glock20"},"


(Thanks to Quincidence for this solution: https://steamhost.cn/steamcommunity_com/id/quincidence)

==========================================

Issue 2 fix:

In the job you want the player to spawn with ammo, put this in one of the lines within the jobs.lua code.

PlayerLoadout = function(ply) ply:SetAmmo(120, "tenmmauto") end, // Ammo Spawned With

(This will give the player 120 ammo for the 10mm ammo used in the Glock20.

EXAMPLE JOB:

TEAM_POLICE = DarkRP.createJob("Police Officer", {
color = Color(255, 255, 255, 255),
model = {
"models/player/nypd/cop_01.mdl",
"models/player/nypd/cop_02.mdl",
"models/player/nypd/cop_03.mdl"
},
description = [[As a Police Officer your job is to protect the city.
You report directly to the Police Chief.

You should look for alternative ways to RP this class such as handing
out fines, tickets and warnings rather then always arresting.]],
weapons = {"sim_fas_glock20"},
command = "police", // What command is used to get this job in game e.g. /police (Don't enter a / though as this is prefixed)
max = 8, // Number of jobs allowed in server
salary = 45,
admin = 0, // Is this an admin class? All = 0 | Admins = 1 | Super Admins = 2
vote = false, //Do players need to create a vote to get this job? true for yes, false for no.
hasLicense = true, // Does this job get a gun license for free? true for yes, false for no. It's useful to give the cops gun licenses.
modelScale = 1.0, // How big are the players that have this job?
maxpocket = 20,
candemote = true, //Can people who have this job be demoted?
PlayerLoadout = function(ply) ply:SetAmmo(120, "tenmmauto") end, // Ammo Spawned With
})

Last edited by nzkfc; 11 Jan, 2014 @ 10:30pm