Galactix Posted July 9, 2018 Share Posted July 9, 2018 (edited) Hello, my script is giving out the error "Expected element, got nil" but I tried everything and cannot manage to fix it function findPlayer( namepart ) local player = getPlayerFromName( namepart ) if player then return player end for _,player in pairs( getElementsByType 'player' ) do if string.find( string.gsub( getPlayerName( player ):lower( ),"#%x%x%x%x%x%x", "" ), namepart:lower( ), 1, true ) then return player end end return false end addCommandHandler( 'heal', function( source,_,player ) local find = findPlayer( player ) if find then setElementData(find, "healStatus", true) outputChatBox("The doctor is willing to heal you. Do you accept?", find) else outputChatBox("Player not found!", source, 255, 0, 0) end end) function acceptHeal() local requestStatus = getElementData(player, "healStatus") if requestStatus == true then setElementData(player, "healStatus" , false) -- delete it! setElementHealth(player, 100) outputChatBox("You have been healed by the doctor.", player) else outputChatBox("You have no pending request.", player) end end addCommandHandler("aheal", acceptHeal) Edited July 9, 2018 by Galactix Link to comment
myonlake Posted July 9, 2018 Share Posted July 9, 2018 Your acceptHeal function is missing the player argument. Add it in the parentheses. 2 Link to comment
Galactix Posted July 9, 2018 Author Share Posted July 9, 2018 I already solved that differently but thanks anyways. 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