Jump to content

[Question]


ZeyadGTX

Recommended Posts

Posted

This Resource Works Perfectly

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("#FF4646(WHISPER) To ".. toColor .. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 255, 255, true) 
                    outputChatBox("#FF4646(WHISPER) From " .. fromColor .. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 255, 255, true) 
            outputServerLog("(WHISPER) From "..getPlayerName(thePlayer).." To ".. getPlayerName(toPlayer)..": " .. pmMessage) 
             
                else 
                    outputChatBox("#FF4646(WHISPER)#FFFFFF Invalid syntax! Usage:#FFFFFF /pm [player name] [message]", thePlayer, 255, 255, 255, true) 
                    return false 
                end 
            else 
                outputChatBox("#0044FF(WHISPER)#FFFFFF You cannot Whisper yourself#FFFFFF!", thePlayer, 255, 255, 255, true) 
                return false 
            end 
        else 
            outputChatBox("#0044FF(WHISPER)#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) 
addCommandHandler("w", 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 

My nick in MTA is Spider

Posted

You're welcome.

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