DarkRP Jobs Code Question

Post Reply
Snackk
New to forums
New to forums
Posts: 7
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Mon Nov 05, 2012 6:04 pm

DarkRP Jobs Code Question

Post by Snackk »

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.
User avatar
Vanderburg
Former staff
Former staff
Posts: 1253
Joined: Sat Nov 13, 2010 7:27 am
Location: Dallas, TX

Re: DarkRP Jobs Code Question

Post by Vanderburg »

Do you have your players respawn when they change their jobs? My DarkRP knowledge is limited, but it looks like you can do something like this:

Code: Select all

PlayerSpawn = function(ply) ply:SetArmor(150) end,
and

Code: Select all

PlayerSpawn = function(ply) ply:SetHealth(250) end,
These would go into where the job itself is configured.



Speed requires a separate hook, it looks like.

Code: Select all

hook.Add("UpdatePlayerSpeed", "DarkRP_JobSpeed", function(ply)
    if ply:Team() == TEAM_JUGG then
        GAMEMODE:SetPlayerSpeed(ply, GAMEMODE.Config.walkspeed * .5, GAMEMODE.Config.runspeed * .5)
        return true
    end
end)
This can go into the DarkRP modification addon as something like sv_speed.lua to automatically be run.


My knowledge on this topic is being stretched, so I don't know if the health and armor have to be combined into a single statement.
Post Reply