xXGhostXx Posted November 24, 2018 Share Posted November 24, 2018 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
HDmaster0702 Posted November 24, 2018 Share Posted November 24, 2018 You've haven't put quote marks around the pending at the 4. line. Putting them should fix it. Link to comment
xXGhostXx Posted November 24, 2018 Author Share Posted November 24, 2018 1 minute ago, HDmaster0702 said: You've haven't put quote marks around the pending at the 4. line. Putting them should fix it. Can you give me code ? Link to comment
HDmaster0702 Posted November 24, 2018 Share Posted November 24, 2018 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
Hoffmann Posted November 24, 2018 Share Posted November 24, 2018 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
xXGhostXx Posted November 24, 2018 Author Share Posted November 24, 2018 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
Spc Posted November 26, 2018 Share Posted November 26, 2018 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
Discord Moderators Pirulax Posted November 26, 2018 Discord Moderators Share Posted November 26, 2018 Stop using element data for everything, please. Link to comment
Tony Brand Posted November 27, 2018 Share Posted November 27, 2018 16 hours ago, Pirulax said: Stop using element data for everything, please. do you have better method instead of element data? Link to comment
Moderators Patrick Posted November 27, 2018 Moderators Share Posted November 27, 2018 2 hours ago, Tony Brand said: do you have better method instead of element data? variables, tables. 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