GamerDeMTA Posted July 12, 2013 Share 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. Link to comment
bandi94 Posted July 12, 2013 Share Posted July 12, 2013 it look's fine you added it , server side right. look in /debugscript 3 see if there is a error ? Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 It says error at addEventHandler, element 2, got boolean Link to comment
GamerDeMTA Posted July 12, 2013 Author Share Posted July 12, 2013 It's in the code but not in the map of MTA Link to comment
Castillo Posted July 12, 2013 Share 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. Link to comment
GamerDeMTA Posted July 12, 2013 Author Share 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 .) Link to comment
Castillo Posted July 12, 2013 Share Posted July 12, 2013 Add this after pickup creation: outputChatBox ( tostring ( p ) ) Link to comment
GamerDeMTA Posted July 12, 2013 Author Share 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 Link to comment
iMr.3a[Z]eF Posted July 12, 2013 Share Posted July 12, 2013 getElementHealth do it yourself Link to comment
bandi94 Posted July 12, 2013 Share 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 Link to comment
Moderators IIYAMA Posted July 12, 2013 Moderators Share 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) Link to comment
iMr.3a[Z]eF Posted July 12, 2013 Share 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? Link to comment
Moderators IIYAMA Posted July 12, 2013 Moderators Share 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,,, Link to comment
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