Jump to content

PM


Recommended Posts

Posted

Hello all, i have this pm system and i want use

getPlayerNametagColor 

here is the code:

function privateMessage(thePlayer,commandName,sendToName,...) 
    local pmWords = { ... } 
    local pmMessage = table.concat( pmWords, " " ) 
    if sendToName then 
        if (getPlayerFromParticalName (sendToName)) then 
        toPlayer = (getPlayerFromParticalName (sendToName)) 
            if not (toPlayer == thePlayer) then 
                if not (pmMessage == "") then 
                    outputChatBox("#0096ff[PM] to #ff0000" .. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 255, 255, true) 
                    outputChatBox("#0096ff[PM] from #ff0000" .. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 255, 255, true) 
                else 
                    outputChatBox("#0044FF[PM]#FFFFFF Invalid syntax! Usage:#FFFFFF /pm [player name] [message]", thePlayer, 255, 255, 255, true) 
                    return false 
                end 
            else 
                outputChatBox("#0044FF[PM]#FFFFFF You cannot PM yourself#FFFFFF!", thePlayer, 255, 255, 255, true) 
                return false 
            end 
        else 
            outputChatBox("#0044FF[PM]#FFFFFF Player not found! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) 
            return false 
        end 
    else 
        outputChatBox("#0044FF[PM]#FFFFFF Invalid syntax! Usage:#FFFFFF /pm [partical player name] [message]", thePlayer, 255, 255, 255, true) 
        return false 
    end 
end 
addCommandHandler("pm", privateMessage) 
  
  
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 
  
  

that's the backup, i hope somebody help me.

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.

Posted

What do you want to add?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

getPlayerNametagColor

I tried it but when i pm some one its how like that,

[PM] to 0:

or

[PM] to nil

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.

Posted

Sorry this took so long, I am at school and I don't have much free time to do this:

function privateMessage(thePlayer,commandName,sendToName,...) 
    local pmWords = { ... } 
    local pmMessage = table.concat( pmWords, " " ) 
    if sendToName then 
        if (getPlayerFromParticalName (sendToName)) then 
            local toPlayer = (getPlayerFromParticalName (sendToName)) 
            local toPlayerTeam = getPlayerTeam(toPlayer) 
            if toPlayerTeam then 
                local toRed, toGreen, toBlue = getTeamColor(toPlayerTeam) 
                toColor = string.format("#%02X%02X%02X", toRed, toGreen, toBlue) 
            else 
                toColor = '#ffffff' 
            end 
  
            local fromPlayerTeam = getPlayerTeam(thePlayer) 
            if fromPlayerTeam then 
                local fromRed, fromGreen, fromBlue = getTeamColor(fromPlayerTeam) 
                fromColor = string.format("#%02X%02X%02X", fromRed, fromGreen, fromBlue) 
            else 
                fromColor = '#ffffff' 
            end 
            if not (toPlayer == thePlayer) then 
                if not (pmMessage == "") then 
                    outputChatBox("#0096ff[PM] to ".. toColor .. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 255, 255, true) 
                    outputChatBox("#0096ff[PM] from " .. fromColor .. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 255, 255, true) 
                else 
                    outputChatBox("#0044FF[PM]#FFFFFF Invalid syntax! Usage:#FFFFFF /pm [player name] [message]", thePlayer, 255, 255, 255, true) 
                    return false 
                end 
            else 
                outputChatBox("#0044FF[PM]#FFFFFF You cannot PM yourself#FFFFFF!", thePlayer, 255, 255, 255, true) 
                return false 
            end 
        else 
            outputChatBox("#0044FF[PM]#FFFFFF Player not found! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) 
            return false 
        end 
    else 
        outputChatBox("#0044FF[PM]#FFFFFF Invalid syntax! Usage:#FFFFFF /pm [partical player name] [message]", thePlayer, 255, 255, 255, true) 
        return false 
    end 
end 
addCommandHandler("pm", privateMessage) 
  
  
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 

Posted

Np ;) and gonna try.

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