DarkRP Jobs Code Question

Hello, on our server let’s pretend we have a job called Juggernaut and we want players to spawn with 250 hp, 150 armor, and 50% movement speed. Does anyone know the code to set maxplayerhealth and player armor and player movement speed on job change/respawn? I know it’s possible, many servers have it, it’s just that I don’t know how. The job code is perfectly fine if you were wondering…I just need to know what to add to the end of it for these effect.

Oh yeah, I’ve seen threads like this in the past when I looked this up so I apologize, however those code does not work, so here I am.

SetMaxHealth() and GetMaxHealth() try google?

Yeah, already tried google. Attempted like 10+ different scripts, none of them work now. It used to work for DarkRP in Gmod 12 though from when I lasted checked.

Where are you putting the code

I always put the code right below the job code, as many of the other posts suggested. There was one post that suggested a different place to put it but never specified a place. I didn’t want to post in that thread as it’s long dead and it would’ve been probably a futile bump.

Okay, I figured out how to give the armor, but I don’t know how to do all 3 at once.

Here’s the code at the end of the job

PlayerLoadout = function( ply ) return ply:SetArmor( 25 ) end,

That sets their armor to 25 upon job change/respawn. I know how to do it for health and all that jazz, except I can’t figure out how to do all of them at the same time. I think I’m going full retard right here.

PlayerLoadout = function( ply ) return ply:SetArmor( 150 ) ply:SetHealth( 250 ) ply:SetRunSpeed( GM.Config.walkspeed * 1.5 )

Probably wrong, probably will be corrected. Give it a shot though

Hmmm, didn’t work. A gut feeling tells me it’s a problem with the GM.Config.walkspeed * 1.5

change GM to GAMEMODE and try?

I tried PlayerLoadout = function( ply ) return ply:SetArmor( 150 ) ply:SetHealth( 250 ) end,

That didn’t work, is there something that’s missing between the armor and health code?

remove “return”

PlayerLoadout = function( ply ) ply:SetArmor( 150 ) ply:SetHealth( 250 ) end,

So basically like that?

Why not just test it yourself instead of asking?

Sorry, small margin for error when there’s a full server and everyone gets kicked for lua errors if something happens to go wrong.

Everything works without the return, except when I do the ply:SetRunSpeed( GM.Config.walkspeed * 1.5 ) the sprint speed changes, but not the regular run speed…like holding W.


Ever heard of sv_kickerrornum 0 Anyway you’re literally begging people to do something that is the first thing you learn when learning GLua. tl;dr you won’t try use Google, you want them 2 do everything 4 you and you’re dumb enough to not even read the code that people posted and for sure thinked if it doesn’t work I just post it doesnt work and they fix. I know I am rude but there are multiple posts like this everyday and its annoying.