2 DarkRP Questions: Playermodels, Gun Dealer limit.

Hi all,
I’ve ran into a problem in my DarkRP server.
There is something strange going on in the server,
after the Job max player limit is coded “3” there still remains a higher limit. “5” I believe it is.
The Class/Job is correct as it is a default, however in-game, the limit to the Gun Dealer class is 5.

TEAM_GUN = AddExtraTeam(“Gun Dealer”, Color(255, 140, 0, 255), “models/player/monk.mdl”, [[A gun dealer is the only person who can sell guns to other
people.
However, make sure you aren’t caught selling guns that are illegal to
the public.
/Buyshipment <name> to Buy a weapon shipment
/Buygunlab to Buy a gunlab that spawns P228 pistols]], {}, “gundealer”, 3, 45, 0, false, false)

I would like to set the limit to 3.
Is there some sort of in-game admin setting im missing or something?

Also,
I’ve got custom player models loaded into my server,
However I do not believe that the models are being downloaded to the clients joining.
Anyone know what a fix for this might be?

Thanks for reading!

For the first one, I think there is a command in-game to set the amount of people that can be the job. For the second one, get FastDL.

Find the function meta:ChangeTeam

Then add this code to it.

[lua]
local max_ammt = {}
max_ammt[TEAM_GUN] = 3

for a,b in pairs(max_ammt) do
if t == a then
local rp_CAmmt = 0
for k,v in pairs(player.GetAll()) do
if v:Team() == a then
rp_CAmmt = tonumber(rp_CAmmt) + 1
end
end

end

end
[/lua]

That will limit the gundealers to 3.

To make the players download you’re models you need to use resource.AddFile

Or just use rp_maxgundealers 3 in your console…

Sweet, thank you guys for the help!
All worked out smoothly, I added the code provided by zzaacckk for secruity, and used the rp_maxgundealers 3 from drake.
Im currently working on using fast dl and am doing research now on how to resource.addfile.
I cannot do Fastdl because I do not own a website yet. This is a trial month for the server, if all goes well by the end of this month I will open a website and use the hell out of fastdl haha.

EDIT:
I have found how to resource.AddFile, however I can not find which file I add these codes to. Would anyone know off of the top of their head?

Any serverside lua file, create a .lua file in garrysmod/lua/autorun/server and put it all in there.

Alright, so ive created my own .lua file and am going to put it in autorun/server once i finish up with it.
I am stuck right now and am confused as to which part I put my folder i would like to have downloaded to my clients joining.

Would somebody be so kind as to show me where i put my file directory i would like to have downloaded?
BTW: this is the folder i would like to have downloaded:
models\mw2guy

[lua]function AddDir(dir) // recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("…/"…dir…"/*")
for _, fdir in pairs(list) do
if fdir != “.svn” then // don’t spam people with useless .svn folders
AddDir(dir…"/"…fdir)
end
end

for k,v in pairs(file.Find("../"..dir.."/*")) do
	resource.AddFile(dir.."/"..v)
end

end

AddDir(“models/yourmodels”)[/lua]

Use [lua] tags please.

I’m sorry, here it is.

[lua]function AddDir(dir) // recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("…/"…dir…"/*")
for _, fdir in pairs(list) do
if fdir != “.svn” then // don’t spam people with useless .svn folders
AddDir(dir…"/"…fdir)
end
end

for k,v in pairs(file.Find("../"..dir.."/*")) do
	resource.AddFile(dir.."/"..v)
end

end

AddDir(“models/yourmodels”)[/lua]

Again,
The folder i would like to have the clients download is:
models\mw2guy.

And thank you for taking the time to help my dumb ass out :confused:

[lua]
function AddDir(dir) // recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("…/"…dir…"/*")
for _, fdir in pairs(list) do
if fdir != “.svn” then // don’t spam people with useless .svn folders
AddDir(dir…"/"…fdir)
end
end

for k,v in pairs(file.Find("../"..dir.."/*")) do
    resource.AddFile(dir.."/"..v)
end

end

AddDir(“models/mw2guy”)
[/lua]

Why are you calling AddDir when it’s not declared? (line 5)

It’ll run itself, trust me I’ve used a similar script and it works.