1. 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.

Darkrp maxHealth question

Discussion in 'DarkRP Modding Questions & Help' started by TommyBoiy, Oct 11, 2017.

  1. TommyBoiy

    TommyBoiy New Member

    is there a way to add setMaxHealth for all jobs without having to add setMaxHealth to each individual job?
  2. Afireal

    Afireal New Member

    I don't recommend it. Add setMaxHealth to each individual job
  3. Sir Klutch

    Sir Klutch Active Member

    Well, first of all... It's SetMaxHealth not setMaxHealth. Secondly, what are you wanting? Do you want all jobs to have the same max health? If so, your best bet, in my opinion, would be to loop through the jobs table using RPExtraTeams.

    Shit, RPExtraTeams returns the team not the player. Also, no idea what I was thinking. Don't need to use a loop... Just do something like;
    Code (Lua):

    Last edited: Oct 11, 2017
    TommyBoiy likes this.
  4. TommyBoiy

    TommyBoiy New Member

    Thank you and just one more question, where would the best place to put this hook? like what file? autorun?
  5. Sir Klutch

    Sir Klutch Active Member

    TommyBoiy likes this.
  6. TommyBoiy

    TommyBoiy New Member

    So I made a .lua located lua/autorun/server and added the hook but when I try to use a medkit health doesn't go above 100hp, any idea? sorry im newb
  7. Sir Klutch

    Sir Klutch Active Member

    Doesn't DarkRP already have a configuration for max health??
  8. TommyBoiy

    TommyBoiy New Member

    SO basically what I'm trying to achieve is the player spawns with 100 health but can use a medkit to get to 300 health instead of just spawning with 300 health but I find this code located at D:\gmoddrp - Copy\garrysmod\gamemodes\darkrp\gamemode\modules\base\sv_util.lua

    self:SetMaxHealth(playerClass.MaxHealth >= 0 and playerClass.MaxHealth or (tonumber(GAMEMODE.Config.startinghealth) or 100))
    if applyHealth then
    self:SetHealth(playerClass.StartHealth >= 0 and playerClass.StartHealth or (tonumber(GAMEMODE.Config.startinghealth) or 100))

    I dont understand it tho
    Last edited: Oct 11, 2017

Share This Page