Jump to content

DeathMessage Color and Delete Code.


Admigo

Recommended Posts

Heey All,

If you die you see deadmessage in white and with hexcolour if u use it in name.

I want to delete the hex color code and change the color of the name if you use hex color.

So if i am #FFFF00Admigo And i die you see Admigo in yellow in deathmessage.

Here is the code:

local root = getRootElement() 
  
addEventHandler("onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart) 
        local r, g, b = getColorFromString(string.upper(get("color"))) 
        local message 
        if killer then 
            if killer ~= source then 
                local killerType = getElementType(killer) 
                if killerType == "player" then 
                    message = getPlayerName(killer).." killed "..getPlayerName(source).."." 
                elseif killerType == "vehicle" then 
                    message = getPlayerName(getVehicleController(killer)).." killed "..getPlayerName(source).."." 
                    if get("show_vehiclename") then 
                        message = message .. " ("..getVehicleName(killer)..")" 
                    end 
                end 
            else 
                message = getPlayerName(source).." committed suicide." 
            end 
        else 
            message = getPlayerName(source).." died." 
        end 
        if weapon and get("show_weapon") then 
            local weaponName = getWeaponNameFromID(weapon) 
            if weaponName then 
                message = message.." ("..weaponName..")" 
            end 
        end 
        if bodypart and get("show_bodypart") then 
            local bodypartName = getBodyPartName(bodypart) 
            if bodypartName then 
                message = message.." ("..getBodyPartName(bodypart)..")" 
            end 
        end 
        outputChatBox(message, root, r, g, b) 
    end 
) 

Thnks Admigo

Link to comment
local root = getRootElement() 
  
addEventHandler("onPlayerWasted", root, 
    function (ammo, killer, weapon, bodypart) 
        local r, g, b = getColorFromString(string.upper(get("color"))) 
        local message 
        if killer then 
            if killer ~= source then 
                local killerType = getElementType(killer) 
                if killerType == "player" then 
                    message = getPlayerName(killer).." killed "..getPlayerName(source).."." 
                elseif killerType == "vehicle" then 
                    message = getPlayerName(getVehicleController(killer)).." killed "..getPlayerName(source).."." 
                    if get("show_vehiclename") then 
                        message = message .. " ("..getVehicleName(killer)..")" 
                    end 
                end 
            else 
                message = getPlayerName(source).." committed suicide." 
            end 
        else 
            message = getPlayerName(source).." died." 
        end 
        if weapon and get("show_weapon") then 
            local weaponName = getWeaponNameFromID(weapon) 
            if weaponName then 
                message = message.." ("..weaponName..")" 
            end 
        end 
        if bodypart and get("show_bodypart") then 
            local bodypartName = getBodyPartName(bodypart) 
            if bodypartName then 
                message = message.." ("..getBodyPartName(bodypart)..")" 
            end 
        end 
        outputChatBox(message, root, r, g, b,true) 
    end 
) 

Link to comment

Dont work.

Its something in meta i think.

<setting name="*color" value="#ffaa00" /> 
        <setting name="*show_bodypart" value="[true]" /> 
        <setting name="*show_weapon" value="[true]" /> 
        <setting name="*show_vehiclename" value="[true]" /> 

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