Jump to content

What's wrong


Recommended Posts

  • Moderators
@ bandi94

player max health is 200, based on pedstat.

A sample of increasing hp with a hp limit.

local healthUpdate = 10 
local maxHealth = 100 
  
addCommandHandler("testhealth", 
function(player) 
  
local currentHealth = getElementHealth(player) 
local newHealth = currentHealth+healthUpdate 
if newHealth < maxHealth then 
   setElementHealth (player,newHealth) 
elseif currentHealth ~= maxHealth then -- data transfer saver. 
   setElementHealth (player,maxHealth) 
end 
  
end) 

Link to comment
@ bandi94

player max health is 200, based on pedstat.

A sample of increasing hp with a hp limit.

local healthUpdate = 10 
local maxHealth = 100 
  
addCommandHandler("testhealth", 
function(player) 
  
local currentHealth = getElementHealth(player) 
local newHealth = currentHealth+healthUpdate 
if newHealth < maxHealth then 
   setElementHealth (player,newHealth) 
elseif currentHealth ~= maxHealth then -- data transfer saver. 
   setElementHealth (player,maxHealth) 
end 
  
end) 

what is the "player" type?

Link to comment
  • Moderators

what is the "player" type?

The element type of this class is "player".  

As you said: "player", you should know that.

The one that writes down the command, it is server side.

If I may did something wrong, say it clearly,,,

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...