Author Topic: Problems with health/healing  (Read 3430 times)

0 Members and 1 Guest are viewing this topic.

Offline DarkNessProvides

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Problems with health/healing
« on: April 24, 2016, 05:39:57 PM »
Me and a friend are making a Star WarsRP server and we are making it so health
is  above 100 but we only do that  for certain roles we are able to set the health of the player when they first switch to the job  but one major issue we are receiving is not  being able to heal the player above 100 health.

Code: [Select]
TEAM_41TROOPER = DarkRP.createJob("41st Trooper", {
color = Color(153, 255, 255, 255),
model = {"models/wpclonetrooper2.mdl"},
description = [[The basic trooper of the 41st Regiment]],
command = "41t",
weapons = {"climb_swep2","weapon_752_dc15a"},
max = 0,
salary = 10,
admin = 0,
vote = false,
hasLicense = false,
customCheck = function(ply) return PlychangeAllowed(ply,"41st Trooper") end,
customCheckFailMsg = "You are not whitelisted for this job!",
category = "41st",
        PlayerLoadout = function(ply) ply:SetMaxHealth(150) end,
        PlayerLoadout = function(ply) ply:SetHealth(150) end
})

That code sets the health when they switch to the job but  we can't heal any higher than 100.

What I am asking is  that someone  tells me how  to set  the  health of each job so we can heal them back up to a set health amount with the  darkrp utility med kit.

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Problems with health/healing
« Reply #1 on: April 25, 2016, 01:09:55 AM »
You are overriding the PlayerLoadout property by assigning it to a function twice. It will only run the function that it was last assigned. This can be fixed by setting both health and max. health in a single function. :)

Offline DankNessProvides

  • Newbie
  • *
  • Posts: 26
  • Karma: -3
Re: Problems with health/healing
« Reply #2 on: April 25, 2016, 10:01:07 AM »
You are overriding the PlayerLoadout property by assigning it to a function twice. It will only run the function that it was last assigned. This can be fixed by setting both health and max. health in a single function. :)

Can you give me an example as we tried using the and tag but didn't like that. :D

An Error Has Occurred!

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