Dimos7 Posted October 13, 2014 Author Share Posted October 13, 2014 function RGBToHex(red,green, blue, alpha) if ((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alhpa and (alhpa < 0 or alpha > 255 ))) then return nil end if (alpha) then return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha) else return string.format("#%.2X%.2X%.2X", red, green, blue) end end addEventHandler("onPlayerLogin", getRootElement(), function() bindKey(source, "x", "down", "genal","chatbox", "global") end) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do if isGuestAccount(getPlayerAccount(player)) then outputChatBox("You must be login to speak in chat!", player, 255, 0, 0) else bindKey(player, "x", "down", "genal", "chatbox", "global") end end end) function onChat(player, ...) local name = getPlayerName(player) local message = table.concat({...}," ") local r,g,b = getTeamColor(getPlayerTeam(player)) or 255, 255, 255 outputChatBox(RGBToHex(r,g,b)..""..name..":".."#FFFFFF"..message, player) end addCommandHandler("genal", onChat) now apperars #FFFFFF name : #FFFFFF genal chatbox http://imgur.com/mT8JDXH Link to comment
DNL291 Posted October 13, 2014 Share Posted October 13, 2014 Try this: addEventHandler("onPlayerLogin", getRootElement(), function() bindKey(source, "x", "down", "genal","chatbox", "global") end) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do if isGuestAccount(getPlayerAccount(player)) then outputChatBox("You must be login to speak in chat!", player, 255, 0, 0) else bindKey(player, "x", "down", "genal", "chatbox", "global") end end end) function onChat(player, ...) local name = getPlayerName(player) local team = getPlayerTeam(player) local message = table.concat({...}," ") local r, g, b if team then r, g, b = getTeamColor(team) end if not r then r, g, b = getPlayerNametagColor(player) end local hexColor = string.format("#%.2X%.2X%.2X", r, g, b) outputChatBox(hexColor..name..": #FFFFFF"..message, player, 220, 220, 220, true) end addCommandHandler("genal", onChat) Link to comment
Dimos7 Posted October 13, 2014 Author Share Posted October 13, 2014 addEventHandler("onPlayerLogin", getRootElement(), function() bindKey(source, "x", "down","chatbox", "global") end) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do if isGuestAccount(getPlayerAccount(player)) then outputChatBox("You must be login to speak in chat!", player, 255, 0, 0) else bindKey(player, "x", "down", "chatbox", "global") end end end) function onChat(player, ...) local name = getPlayerName(player) local message = table.concat({...}," ") local team = getPlayerTeam(player) local r,g,b if team then r,g,b = getTeamColor(team) end if not r then r,g,b = getPlayerNametagColor(player) end local hexColor = string.format("#%.2X%.2X%.2X", r, g, b) outputChatBox(hexColor..""..name..":".."#FFFFFF"..message, player, 220, 220, 220, true) end addCommandHandler("global", onChat) http://imgur.com/UJnVleB can tell me how to remove the global from chat? Link to comment
DNL291 Posted October 13, 2014 Share Posted October 13, 2014 function onChat(player, _, ...) local name = getPlayerName(player) local message = table.concat({...}," ") local team = getPlayerTeam(player) local r,g,b if team then r,g,b = getTeamColor(team) end if not r then r,g,b = getPlayerNametagColor(player) end local hexColor = string.format("#%.2X%.2X%.2X", r, g, b) outputChatBox(hexColor..""..name..":".."#FFFFFF"..message, player, 220, 220, 220, true) 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