GamerDeMTA Posted July 12, 2013 Posted July 12, 2013 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.
bandi94 Posted July 12, 2013 Posted July 12, 2013 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 :
GamerDeMTA Posted July 12, 2013 Author Posted July 12, 2013 It says error at addEventHandler, element 2, got boolean
Castillo Posted July 12, 2013 Posted July 12, 2013 Is the pickup created? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
GamerDeMTA Posted July 12, 2013 Author Posted July 12, 2013 It's in the code but not in the map of MTA
Castillo Posted July 12, 2013 Posted July 12, 2013 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. Education is the most powerful weapon which you can use to change the world.
GamerDeMTA Posted July 12, 2013 Author Posted July 12, 2013 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 .)
Castillo Posted July 12, 2013 Posted July 12, 2013 Add this after pickup creation: outputChatBox ( tostring ( p ) ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
GamerDeMTA Posted July 12, 2013 Author Posted July 12, 2013 Now it works 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
iMr.3a[Z]eF Posted July 12, 2013 Posted July 12, 2013 getElementHealth do it yourself To Visit Us Press Here: mtasa://5.9.206.180:22002
bandi94 Posted July 12, 2013 Posted July 12, 2013 Now it works 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 :
Moderators IIYAMA Posted July 12, 2013 Moderators Posted July 12, 2013 @ bandi94player 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 Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
iMr.3a[Z]eF Posted July 12, 2013 Posted July 12, 2013 @ bandi94player 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
Moderators IIYAMA Posted July 12, 2013 Moderators Posted July 12, 2013 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 Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now