Author Topic: Max hp healing Code needed!  (Read 4647 times)

0 Members and 1 Guest are viewing this topic.

Offline aussie0411

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Max hp healing Code needed!
« on: May 21, 2016, 09:10:11 AM »
Basically I am helping somebody on a star wars rp server and they need to know how to get the medkit to heal to the health the job is set at. For example, a jedi with 500 health that drops to 400 can't be healed back up to 500 but only up to 100 if he is lower than 100. Anything higher than 100 he can't be healed. How do I change that to the hp the job is set at?

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Max hp healing Code needed!
« Reply #1 on: May 21, 2016, 09:19:47 AM »
Instead of just using Entity:SetHealth(number hp), you will want to also use Entity:SetMaxHealth(number maxhp) in your job's info, or set max health in the config file however you're told to.
bw81@ulysses-forums ~ % whoami
Homepage

Offline aussie0411

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Max hp healing Code needed!
« Reply #2 on: May 21, 2016, 09:58:26 AM »
Instead of just using Entity:SetHealth(number hp), you will want to also use Entity:SetMaxHealth(number maxhp) in your job's info, or set max health in the config file however you're told to.

Can you change it for me?

AddExtraTeam("Doom Commander", {
    color = Color(63, 127, 79, 255),
    model = {"models/player/asgclonewars/commander_doom/commander_doom.mdl"},
    description = [[Doom CO]],
    weapons = {"weapon_752_t21", "weapon_752_dc15a", "weapon_752_dc17dual"},
    command = "doomco",
    max = 1,
    salary = 400,
    admin = 0,
   PlayerSpawn = function(ply) GAMEMODE:SetPlayerSpeed(ply, GAMEMODE.Config.walkspeed * 1, GAMEMODE.Config.runspeed * 1) ply:SetHealth("500") ply:SetGravity(1) return CLIENT end,
    PlayerDeath = function(ply) GAMEMODE:SetPlayerSpeed(ply, GAMEMODE.Config.walkspeed * 1, GAMEMODE.Config.runspeed * 1) return CLIENT end,
    vote = false,
    hasLicense = false,
category = "Doom",
})

is the default job, can you add in the hp thing or instruct me on how to do so?

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given