Jump to content

Private message bug


-Doc-

Recommended Posts

Hi. I edited this code and its showing bad argument @ getPlayerNametagColor

function privateMessage(thePlayer,commandName,sendToName,...) 
    local pmWords = { ... } 
    local pmMessage = table.concat( pmWords, " " ) 
    local red, green, blue = getPlayerNametagColor ( thePlayer ) 
        local hex = RGBToHex ( red, green, blue ) 
    if sendToName then 
        if (getPlayerFromParticalName (sendToName)) then 
        toPlayer = (getPlayerFromParticalName (sendToName)) 
            if not (toPlayer == thePlayer) then 
                if not (pmMessage == "") then 
                    outputChatBox("#FFFFFF[PM] Message to "..hex.."" .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, thePlayer, 255, 255, 255, true) 
                    outputChatBox("#FFFFFF[PM] Message from "..hex.."" .. getPlayerName(thePlayer) .. "#FFFFFF: " .. pmMessage, toPlayer, 255, 255, 255, true) 
                else 
                    outputChatBox("#FFFFFF[PM]Use:#ff9900 /pm [part of name] [message]", thePlayer, 255, 255, 255, true) 
                    return false 
                end 
            else 
                outputChatBox("#FFFFFF[PM]#00ccff You cannot PM yourself #ff9900!", thePlayer, 255, 255, 255, true) 
                return false 
            end 
        else 
            outputChatBox("#FFFFFF[PM]#00ccff Player not found! #FFFF00[#ff9900"..sendToName.."#FFFF00]", thePlayer, 255, 255, 255, true) 
            return false 
        end 
    else 
        outputChatBox("#FFFFFF[PM]Use:#ff9900 /pm [part of name] [message]", thePlayer, 255, 255, 255, true) 
        return false 
    end 
end 
addCommandHandler("pm", privateMessage) 
  
  
  
function RGBToHex(red, green, blue) 
    if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255)) then 
        return nil 
    end 
    return string.format("#%.2X%.2X%.2X", red, green, blue) 
end 
  
  
  
function getPlayerFromParticalName(thePlayerName) 
    local thePlayer = getPlayerFromName(thePlayerName) 
    if thePlayer then 
        return thePlayer 
    end 
    for _,thePlayer in ipairs(getElementsByType("player")) do 
        if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then 
            return thePlayer 
        end 
    end 
return false 
end 
  
  

Link to comment
Omg. Im asking for help not for not for...
it will return that obviously since you are typing the command in the server console.

You're too stupid to be helped and it's not the first time. He gave you the anwer which you need what do you want more?

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