Jump to content

getPlayerNametagColor


Recommended Posts

Hello, can somebody help me i want use getPlayerNametagColor for those scripts

function giveSomeoneMoney(player, cmd, target, amount) 
    if target then 
        if amount then 
            local money = getPlayerMoney(player) 
            local targetplayer = getPlayerFromParticalName(target) 
            amount = tonumber(amount) 
            if targetplayer then 
                if money >= amount then 
                    givePlayerMoney(targetplayer, amount) 
                    takePlayerMoney(player, amount) 
                    outputChatBox("#FF0000"..getPlayerName(player).."#0096FF gaved #00FF00$"..amount.."#0096FF to #FF9600"..getPlayerName(targetplayer), getRootElement(), 0, 81, 255, true) 
                else 
                    outputChatBox("You don't have enought money!", player, 255, 0, 0) 
                end 
            else 
                outputChatBox("Error: Player not found", player, 255, 0, 0) 
            end 
        else 
            outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) 
        end 
    else  
        outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) 
    end 
end 
addCommandHandler("givemoney", giveSomeoneMoney) 
  
  
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 
  
  

And this

addEventHandler("onPlayerChat", root, 
function(msg, msgType) 
    if msgType == 1 then 
        cancelEvent() 
        outputChatBox("* #FFFFFF"..getPlayerName(source).."#0064FF "..msg, root, 255, 0, 0, true) 
    end 
end) 

Thanks for helping.

Link to comment
addEventHandler ( "onPlayerChat", root, 
    function ( msg, msgType ) 
        if ( msgType == 1 ) then 
            cancelEvent ( ) 
            local r, g, b = getPlayerNametagColor ( source ) 
            outputChatBox ( "* #FFFFFF".. getPlayerName ( source ) .."#0064FF ".. msg, root, r, g, b, true ) 
        end 
    end 
) 

Is this what you need?

Link to comment

Yes, and for this too

function giveSomeoneMoney(player, cmd, target, amount) 
    if target then 
        if amount then 
            local money = getPlayerMoney(player) 
            local targetplayer = getPlayerFromParticalName(target) 
            amount = tonumber(amount) 
            if targetplayer then 
                if money >= amount then 
                    givePlayerMoney(targetplayer, amount) 
                    takePlayerMoney(player, amount) 
                    outputChatBox("#FF0000"..getPlayerName(player).."#0096FF gaved #00FF00$"..amount.."#0096FF to #FF9600"..getPlayerName(targetplayer), getRootElement(), 0, 81, 255, true) 
                else 
                    outputChatBox("You don't have enought money!", player, 255, 0, 0) 
                end 
            else 
                outputChatBox("Error: Player not found", player, 255, 0, 0) 
            end 
        else 
            outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) 
        end 
    else 
        outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) 
    end 
end 
addCommandHandler("givemoney", giveSomeoneMoney) 
  
  
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

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