Jump to content

Private message bug


-Doc-

Recommended Posts

Posted

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 
  
  

My scripting skills

 


76561198189590622.pngAddFriend.png

Posted

I see no error in getPlayerNametagColor function. It will only get errors if the script is set as client-side.

Try to debug that code by using outputChatBox/outputDebugString.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
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?

A unique GangWar gamemode waiting for you!
Click here for more information.

560x95_FFFFFF_FF9900_000000_000000.png

Posted

Yes working but nametag color uhh...It doesnt show player nametag color when i send it its showing mine.

My scripting skills

 


76561198189590622.pngAddFriend.png

Posted

Only thing you use this forum for is to get all your resources fixed

You don't even bother to learn anything about scripting.

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted
Only thing you use this forum for is to get all your resources fixed

You don't even bother to learn anything about scripting.

Agreed

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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