DarkRP job with more health

Is it possible for a specific job/class to spawn with more health or do all classes have to be at 100hp or maybe armor like in half-life? If it’s not possible, is there some sort of alternative such as starting off a job/class with some drug or something that they could consume in order to increase their hp?

I don’t test it, maybe it work[lua]
function GiveMoreHealth( ply )
if ply:Team() == TEAM_COOK then
ply:SetHealth(200)
end
hook.Add(GM:PlayerSpawn(ply), GiveHealthToCook, GiveMoreHealth)[/lua]put this in lua/autorun/server/randomname.lua

I’ve put this in a few places and tried it but no luck. I’m not certain I’m putting this in the right place however. I have no directory lua/autorun/server also.

Then make the folders.

I test it and it dosen’t work :frowning:

Here:



function GiveMoreHealth( ply )
	if ply:Team() == TEAM_COOK then
		ply:SetHealth(200)
	end
end
hook.Add("PlayerSpawn", "GiveHealthToCook", GiveMoreHealth)


The other example was wrong in alot of ways…

I was about to facepalm untill I saw your post :slight_smile:

This always annoys me. If you can’t help, why post?

If the jobs on DarkRP are set to instantly change job - PlayerSpawn doesn’t get called. meta:ChangeTeam() handles it if so.

Meh, I just fixed the other example. I haven’t really looked that much into DarkRP

Still isn’t working. Is meta:ChangeTeam() supposed to go somewhere in this? Also i made the directory lua/autorun/server/class.lua and put this code in the lua. Hope this is right, i’m beyond a mega noob so sorry in advanced for being retarded.

bump

Try this

[lua] hook.Add(“OnPlayerChangedTeam”, “randomnamefff”, function( ply, oldteam, newteam) if newteam == TEAM_COOK then ply:SetHealth(200) end end) [/lua]

facepalm you can set the convar where when people change their job, they respawn ^^

Yes, but he meant if the convar isn’t set to that. In that case cant you just use OnPlayChangedTeam?

It may work. Haven’t looked into DarkRP for a while though.