Jump to content

[HELP] Heal system


xXGhostXx

Recommended Posts

Hi everyone .

What is problem ?

I want doctor use /heal and send request to player, player use /aheal and accept heal and set element health to 100 but if not request say "You have no pending request."

Please fix it !

function darmanKardan (thePlayer, command, player)
	local taraf = getPlayerFromName(player)
	if player then
		setElementData(taraf,"healrequest", pending)
		outputChatBox("#00ff00The doctor is willing to heal you. Do you accept?", taraf, 255, 255, 255, true)
	else
		outputChatBox("#ff0000Syntax: /heal <Name>", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("heal", darmanKardan)

function acceptHeal (thePlayer, command)
	local requestStatus = getElementData(thePlayer, "healrequest")
	if (requestStatus = "pending") then
		setElementData(player,"healrequest", unpending)
		setElementHealth(player, 100)
		outputChatBox("#00ff00You have been healed by the doctor.", thePlayer, 255, 255, 255, true)
	else
		outputChatBox("#ff0000[Error]: #ffffffYou have no pending request.", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("aheal", acceptHeal)

 

Link to comment
function darmanKardan (thePlayer, command, player)
	local taraf = getPlayerFromName(player)
	if player then
		setElementData(taraf,"healrequest", "pending")
		outputChatBox("#00ff00The doctor is willing to heal you. Do you accept?", taraf, 255, 255, 255, true)
	else
		outputChatBox("#ff0000Syntax: /heal <Name>", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("heal", darmanKardan)

function acceptHeal (thePlayer, command)
	local requestStatus = getElementData(thePlayer, "healrequest")
	if (requestStatus = "pending") then
		setElementData(player,"healrequest", "unpending")
		setElementHealth(player, 100)
		outputChatBox("#00ff00You have been healed by the doctor.", thePlayer, 255, 255, 255, true)
	else
		outputChatBox("#ff0000[Error]: #ffffffYou have no pending request.", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("aheal", acceptHeal)

 

Yes, here you go.

 

Link to comment
function darmanKardan (thePlayer, command, player)
	local taraf = getPlayerFromName(player)
	if player then
		setElementData(taraf,"healrequest", pending)
		outputChatBox("#00ff00The doctor is willing to heal you. Do you accept?", taraf, 255, 255, 255, true)
	else
		outputChatBox("#ff0000Syntax: /heal <Name>", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("heal", darmanKardan)

function acceptHeal (thePlayer, command)
	local requestStatus = getElementData(thePlayer, "healrequest")
	if (requestStatus == "pending") then
		setElementData(player,"healrequest", unpending)
		setElementHealth(player, 100)
		outputChatBox("#00ff00You have been healed by the doctor.", thePlayer, 255, 255, 255, true)
	else
		outputChatBox("#ff0000[Error]: #ffffffYou have no pending request.", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("aheal", acceptHeal)

The equality operator == is missing in line 14. This code should work

Link to comment
2 minutes ago, NeverUnbeatable said:

function darmanKardan (thePlayer, command, player)
	local taraf = getPlayerFromName(player)
	if player then
		setElementData(taraf,"healrequest", pending)
		outputChatBox("#00ff00The doctor is willing to heal you. Do you accept?", taraf, 255, 255, 255, true)
	else
		outputChatBox("#ff0000Syntax: /heal <Name>", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("heal", darmanKardan)

function acceptHeal (thePlayer, command)
	local requestStatus = getElementData(thePlayer, "healrequest")
	if (requestStatus == "pending") then
		setElementData(player,"healrequest", unpending)
		setElementHealth(player, 100)
		outputChatBox("#00ff00You have been healed by the doctor.", thePlayer, 255, 255, 255, true)
	else
		outputChatBox("#ff0000[Error]: #ffffffYou have no pending request.", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("aheal", acceptHeal)

The equality operator == is missing in line 14. This code should work

Fixed, but doctor is send request for me but i cant accept request

Link to comment
function darmanKardan (thePlayer, command, player)
	if player then
    	local taraf = getPlayerFromName(player)
		setElementData(taraf,"healrequest", "pending")
		outputChatBox("#00ff00The doctor is willing to heal you. Do you accept?", taraf, 255, 255, 255, true)
	else
		outputChatBox("#ff0000Syntax: /heal <Name>", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("heal", darmanKardan)

function acceptHeal (thePlayer, command)
	local requestStatus = getElementData(thePlayer, "healrequest")
	if (requestStatus == "pending") then
		setElementData(player,"healrequest", "unpending")
		setElementHealth(player, 100)
		outputChatBox("#00ff00You have been healed by the doctor.", thePlayer, 255, 255, 255, true)
	else
		outputChatBox("#ff0000[Error]: #ffffffYou have no pending request.", thePlayer, 255, 255, 255, true)
	end
end
addCommandHandler("aheal", acceptHeal)

Try it.

Link to comment

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