MenTos

Если жизни игрока меньше 10, то сделать их 100.

Recommended Posts

Привет всем! Не знаю как правильно написать скрипт :(

Нужно сделать так, чтобы делалось 100 хп, если хп меньше 10.

Буду рад помощи :)

Share this post


Link to post
local playerHealth = getElementHealth ( localPlayer )
function health ( root )
	if (playerHealth  = 10 ) then
      setElementHealth(root,100)
    end
end

-- set a timer so the function is called after 1 second
setTimer ( health, 1000, 1)

Didnt test.

Share this post


Link to post
local playerHealth = getElementHealth ( localPlayer )
function health ( root )
	if (playerHealth  == 10 ) then
      setElementHealth(root,100)
    end
end

-- set a timer so the function is called after 1 second
setTimer ( health, 1000, 1)

as the upper comment :) 

u forget == in third code

  • Thanks 1

Share this post


Link to post
addEventHandler("onPlayerDamage", root,
function()
	if getElementHealth(source) < 10 then
		setElementHealth(source, 100)
	end
end)

 

Share this post


Link to post

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.