VTX Posted July 25, 2014 Share Posted July 25, 2014 Hey guys! This is a part of a spectator script I have: setTimer(function() local specList = {} for k,v in ipairs(getElementsByType("player")) do local target = getCameraTarget(v) if target and (target ~= v) then if not specList[target] then specList[target] = {} end specList[target][#specList[target]+1] = getPlayerName(v) end end How can I add the team color to the player's name? Link to comment
TAPL Posted July 25, 2014 Share Posted July 25, 2014 Something like this? setTimer(function() local specList = {} for k,v in ipairs(getElementsByType("player")) do local target = getCameraTarget(v) if target and (target ~= v) then if not specList[target] then specList[target] = {} end local team = getPlayerTeam(v) if team then local r, g, b = getTeamColor(team) specList[target][#specList[target]+1] = string.format("#%.2X%.2X%.2X", r, g, b)..getPlayerName(v) else specList[target][#specList[target]+1] = string.format("#%.2X%.2X%.2X", 255, 255, 255)..getPlayerName(v) end end end Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now