Jump to content

What's wrong


Recommended Posts

Posted
p = createPickup ( 2017.4038085938,-1431.1442871094,13.543635368347, 0, 1000, 5000) 
function pp ( player ) 
setElementHealth ( player, 1000) 
end 
addEventHandler ("onPickupHit", p, pp) 

PS: I also tried without the ( player) in function.

Posted

I already knew that it was on the code, so if it doesn't appear on the game, then it means you've filled wrong values at createPickup.

Posted

I didn't. Check:

p = createPickup ( 2017.4038085938,-1431.1442871094,13.543635368347, 0, 1000, 5000) 

It's the X,Y,Z, the Type (health), amount (1000HP), respawntime (5s = 5000ms), and I didn't put ammo (it's not a weapon .)

Posted
Now it works :D

hey can u say me what to do for do that if the player has 100HP He doesn't get health? because he has FUll HP

  
  
if( getElementHealth ( player ) < 1000 ) then 
  
 --give HP 
end  
  
  

  • Moderators
Posted
@ 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) 

Posted
@ 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?

  • Moderators
Posted

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,,,

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