Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- minetest.register_on_joinplayer(function(player)
- player:set_hp(20)
- player:set_attribute("a:hp",100)
- end)
- minetest.register_on_player_hpchange(function(player, hp_change)
- if hp_change < 0 then
- local gethp = tonumber(player:get_attribute("a:hp"))
- local newhp = gethp + hp_change
- minetest.chat_send_all(newhp)
- player:set_attribute("a:hp",newhp)
- if newhp <= 0 then
- player:set_attribute("a:hp",100)
- return -20
- end
- end
- if hp_change ~= 20 then
- return 0
- else
- return 20
- end
- end, true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement