1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Job health and speed

Discussion in 'Player General Chat' started by [Zombro] NoahTheWhiteHead, Apr 8, 2014.

  1. I've made a zombie job and there jib is to kill people with a knife and the zombie hunters needs to kill them.
    I want the zombies to have more speed and 200 health. I've seen a lot of codes to it but I don't know we're to out the single code in the init.lua file. Can someone copy there whole init.lua file and paste it here so I can see we're exactly it needs to be for it not to crash ?

    - Noah
  2. Dgc2002

    Dgc2002 Member

    You're not likely to have people hand you their code and walk you through the process of implementing it. It would be in your best interest to learn LUA and more about GMod servers before attempting to open one. Theres plenty of resources out there on how to do all of this.
  3. FiG-Scorn

    FiG-Scorn New Member

    I'll give you this one.

    Edit your zombie job, and add this to it:

    Code (Text):
    PlayerSpawn = function(ply) ply:SetHealth(200) GAMEMODE:SetPlayerSpeed(ply, GAMEMODE.Config.walkspeed * 2, GAMEMODE.Config.runspeed * 2) end,
    PlayerDeath = function(ply) GAMEMODE:SetPlayerSpeed(ply, GAMEMODE.Config.walkspeed, GAMEMODE.Config.runspeed) end
    Note: For this code to be effective, you must ensure that players respawn when they change teams.

    The end result of this code will give the zombies double speed and 200 health.

    To modify their speeds, every time i've done * 2, change the 2 to whatever number you want. 1 is normal speed, 0.5 is half speed, and 2 is double speed.
    Dark VinylScratch 2 likes this.
  4. FiG-Scorn

    FiG-Scorn New Member

    You must be doing something wrong.

    I've used that code before on another job of my own, called Sewer demon.

    Code (Text):
    TEAM_DEMON = AddExtraTeam("Sewer Demon", {
        color = Color(255, 0, 0, 255),
        model = {
        description = [[You are the demon that lurks in the sewers.
        You wait for unsuspecting fools, and you
        ravage them with your crowbar.]],
        weapons = {"weapon_crowbar"},
        command = "lakedemon",
        max = 7,
        salary = 20,
        admin = 0,
        vote = true,
        hasLicense = false,
        PlayerSpawn = function(ply) GAMEMODE:SetPlayerSpeed(ply, GAMEMODE.Config.walkspeed * 2, GAMEMODE.Config.runspeed * 2) ply:SetHealth("250") ply:SetGravity(1) return CLIENT end,
        PlayerDeath = function(ply) GAMEMODE:SetPlayerSpeed(ply, GAMEMODE.Config.walkspeed * 1, GAMEMODE.Config.runspeed * 1) return CLIENT end,
    You most likely forgot to ensure there was a comma at the end of each line.
    Tabman and Dark VinylScratch 2 like this.
  5. FiG-Scorn

    FiG-Scorn New Member

    BTW those return CLIENT parts are unnecessary. The function doesn't need to return a value. I just did it because I was drunk when I wrote this 9 months ago.

    Still works today.
    Zignd and Dark VinylScratch 2 like this.
  6. used the code for a class of mine +like
  7. Tabman

    Tabman New Member

    Ahh, thanks!
  8. ℓ carus✤

    ℓ carus✤ New Member

    can you put the code of just the setting health part
  9. Pab14567

    Pab14567 Well-Known Member

    Code (Lua):

    PlayerLoadout = function( ply ) return
         ply:SetHealth(100) -- Edit the number to whatever hp you want it to be
         ply:SetArmor(100) -- edit the number for armor
         ply:SetRunSpeed(300) -- edit number for runspeed difference
        ply:SetWalkSpeed(150) -- edit to change walk speed
    --- Double Post Merged, Jul 30, 2016 ---
  10. [RN]Crazy

    [RN]Crazy New Member

    Maybe someone here can help me. I've got my jobs for my server all set up properly however, whenever I switch to a job, my health resets to 100 regardless of how much health the job is supposed to have. Both the health and Max health values are set properly. It is very frustrating
  11. [God] Hoptilic

    [God] Hoptilic New Member


Share This Page