MRThinker Posted July 9, 2018 Share Posted July 9, 2018 hi guys how to make a system for request Heal to other players ? like : acl group medic use /heal <playername> and player use /aheal and the health set to 100 ! outputChatBox for player is The doctor is going to give you HEAL. do you accept? use / aheal outputChaBox for medic is Your Request Send. Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 (edited) Please avoid making multiple threads for the same problem to get more visibility, it’s disrespectful for the other users that need help as much as you do. I will give you the script soon. Edited July 9, 2018 by Galactix Link to comment
Moderators IIYAMA Posted July 9, 2018 Moderators Share Posted July 9, 2018 @MRThinker Please do not post these requests in this section. See section rules: Thank you very much and have a nice day. Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 (edited) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end addCommandHandler( 'heal', function( source,_,player ) local find = getPlayerFromPartialName( player ) if find then setElementData(player,"healrequest", pending) outputChatBox("The doctor is willing to heal you. Do you accept?", player) else outputChatBox("Player not found!", source, 255, 0, 0) end end) function acceptHeal() local requestStatus = getElementData(source, "healrequest") if (requestStatus = "pending") then setElementData(player,"healrequest", unpending) setElementHealth(player, 100) outputChatBox("You have been healed by the doctor.", source) else outputChatBox("You have no pending request.") end end addCommandHandler("aheal", acceptHeal) @MRThinker Edited July 9, 2018 by Galactix Link to comment
Moderators IIYAMA Posted July 9, 2018 Moderators Share Posted July 9, 2018 @Galactix Please do requested code in a private message. Else people might think it is normal to request code in this section. I really appreciate your affords for the community! Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 Just now, IIYAMA said: @Galactix Please do requested code in a private message. Else people might think it is normal to request code in this section. I really appreciate your affords for the community! Sorry, I will make sure to do so in the future! 1 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