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

it look's fine you added it , server side right. look in /debugscript 3 see if there is a error ?

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted

Is the pickup created?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Add this after pickup creation:

outputChatBox ( tostring ( p ) ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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  
  
  

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

  • 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) 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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?

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

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

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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