Need help with lua code menu

Shout-Out

User Tag List

Results 1 to 1 of 1
  1. #1
    rbkz's Avatar Member
    Reputation
    1
    Join Date
    Feb 2018
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with lua code

    Hello there,

    I need help with scripting in lua, I would like to add color into PlayerFrame aswell same as TargetFrame and FocusFrame.

    In the codes below I have added Class colors in hp bars + Class colors behind names, I want to add color into PlayerFrame also.

    Following is the original code:

    local function colour(statusbar, unit)
    local _, class, c
    if UnitIsPlayer(unit) and UnitIsConnected(unit) and unit == statusbar.unit and UnitClass(unit) then
    _, class = UnitClass(unit)
    c = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
    statusbar:SetStatusBarColor(c.r, c.g, c.b)
    PlayerFrameHealthBar:SetStatusBarColor(0,1,0)
    end
    end

    hooksecurefunc("UnitFrameHealthBar_Update", colour)
    hooksecurefunc("HealthBar_OnValueChanged", function(self)
    colour(self, self.unit)
    end)

    local frame = CreateFrame("FRAME")
    frame:RegisterEvent("GROUP_ROSTER_UPDATE")
    frame:RegisterEvent("PLAYER_TARGET_CHANGED")
    frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
    frame:RegisterEvent("UNIT_FACTION")

    local function eventHandler(self, event, ...)
    if UnitIsPlayer("target") then
    c = RAID_CLASS_COLORS[select(2, UnitClass("target"))]
    TargetFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
    end
    if UnitIsPlayer("focus") then
    c = RAID_CLASS_COLORS[select(2, UnitClass("focus"))]
    FocusFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
    end
    end

    frame:SetScript("OnEvent", eventHandler)

    for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground}) do
    BarTextures:SetTexture("Interface\\TargetingFrame\ \UI-StatusBar")
    end


    Following is the code I tried to re-make by adding PlayerFrame without any success either:

    local function colour(statusbar, unit)
    local _, class, c
    if UnitIsPlayer(unit) and UnitIsConnected(unit) and unit == statusbar.unit and UnitClass(unit) then
    _, class = UnitClass(unit)
    c = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
    statusbar:SetStatusBarColor(c.r, c.g, c.b)
    PlayerFrameHealthBar:SetStatusBarColor(0,1,0)
    end
    end

    hooksecurefunc("UnitFrameHealthBar_Update", colour)
    hooksecurefunc("HealthBar_OnValueChanged", function(self)
    colour(self, self.unit)
    end)

    local frame = CreateFrame("FRAME")
    frame:RegisterEvent("GROUP_ROSTER_UPDATE")
    frame:RegisterEvent("PLAYER_TARGET_CHANGED")
    frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
    frame:RegisterEvent("UNIT_FACTION")

    local function eventHandler(self, event, ...)
    if UnitIsPlayer("target") then
    c = RAID_CLASS_COLORS[select(2, UnitClass("target"))]
    TargetFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
    end
    if UnitIsPlayer("focus") then
    c = RAID_CLASS_COLORS[select(2, UnitClass("focus"))]
    FocusFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
    end
    if UnitIsPlayer("player") then
    c = RAID_CLASS_COLORS[select(2, UnitClass("focus"))]
    PlayerFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
    end
    end

    frame:SetScript("OnEvent", eventHandler)

    for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground, PlayerFrameNameBackground}) do
    BarTextures:SetTexture("Interface\\TargetingFrame\ \UI-StatusBar")
    end

    Need help with lua code

Similar Threads

  1. Need help with Lua script
    By Pieterkii in forum WoW EMU Questions & Requests
    Replies: 7
    Last Post: 03-04-2010, 07:07 AM
  2. Need help with LUA Boss please!
    By itsonebay in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 02-23-2010, 11:23 AM
  3. Need help with LUA Hearthstone 3.1.1
    By andreasv18_2005 in forum WoW EMU Questions & Requests
    Replies: 8
    Last Post: 05-16-2009, 08:13 AM
  4. Need help with LUA
    By marcelo_20xx in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 11-29-2008, 11:22 AM
  5. Need help with LUA
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 18
    Last Post: 02-28-2008, 12:54 PM
All times are GMT -5. The time now is 07:16 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search