-RoCk-Alex Posted March 7, 2012 Share Posted March 7, 2012 (edited) Help needed with this script please:- function chatbox(text, msgtype) local root = getRootElement() local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc["..tag.."] #8B1A1A[HEADADMIN] .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc["..tag.."] #FF0000[ADMIN] " .. name ..":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc["..tag.."] #00FF00[MODERATOR] " .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc["..tag.."] " .. name .. ": " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end elseif (msgtype == 2) then end end addEventHandler("onPlayerChat", root, chatbox) 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 (alpha and (alpha < 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 i want the name and text color to be the default but they become of the color of the ACL tag or if name has a color code then the txt becomes of name color Like:- if name is Player the text becomes :-abcdefg Or:- if player is in admin group ([ADMIN]) and if name is Player then the name and text color changes to [ADMIN] Player : abcdefg Edited March 8, 2012 by Guest Link to comment
Castillo Posted March 7, 2012 Share Posted March 7, 2012 function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..":#FFFFFF".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] " .. name .. ": " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) Link to comment
-RoCk-Alex Posted March 8, 2012 Author Share Posted March 8, 2012 function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..":#FFFFFF".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] " .. name .. ": " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) man the problem is still not fixed see the image the name and text color Link to comment
JR10 Posted March 8, 2012 Share Posted March 8, 2012 The problem is the green text when you're logged out? function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..":#FFFFFF".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] " .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) Else explain better. Link to comment
-RoCk-Alex Posted March 8, 2012 Author Share Posted March 8, 2012 [/color] The problem is the green text when you're logged out? function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..":#FFFFFF".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] " .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) Else explain better. the problem is that the color of name changes from original to the color of tag or the id ex:- if name is simple Alex ( no color ) and tag is [Admin] name color changes to [Admin] Alex Same with text if name is Alex followed with simple text no color like MTA Rocks then the text color changes to Alex : MTA Rocks i want the name and the text color to be exactly same ([Admin]Alex) and (Alex:MTA Rocks) Link to comment
JR10 Posted March 8, 2012 Share Posted March 8, 2012 Huh? Maybe: function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..":".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..":" .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ":" .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FFFFFF" .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) Stop using bold text, my eyes. Link to comment
-RoCk-Alex Posted March 8, 2012 Author Share Posted March 8, 2012 Huh?Maybe: function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..":".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..":" .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ":" .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FFFFFF" .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) Stop using bold text, my eyes. ok maybe this will help you understand my problem better :- Before starting the RESOURCE After starting the RESOURCE SEE THE NAME AND THE TEXT COLOR CHANGED? THAT IS MY PROBLEM NOTE :- RED COLOR IN MY NAME WAS THE TEAM COLOR IN BASEMODE SERVER AND I WANT IT TO BE EXACT Link to comment
Castillo Posted March 8, 2012 Share Posted March 8, 2012 function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..": #FFFFFF".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..": #FFFFFF" .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ": #FFFFFF" .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FFFFFF" .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) Link to comment
-RoCk-Alex Posted March 8, 2012 Author Share Posted March 8, 2012 function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..": #FFFFFF".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..": #FFFFFF" .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ": #FFFFFF" .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FFFFFF" .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) sorry man but i think you didn't understand my problem see my last post and yes this didn't solved it Link to comment
Castillo Posted March 8, 2012 Share Posted March 8, 2012 function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) local hex = RGBToHex(r, g, b) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. hex .."".. name ..": #FFFFFF".. text, root, 255, 255, 255, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] ".. hex .."" .. name ..": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] ".. hex .."" .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FFFFFF".. hex .."" .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) 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 (alpha and (alpha < 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 That seems to work. Link to comment
-RoCk-Alex Posted March 8, 2012 Author Share Posted March 8, 2012 function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) local hex = RGBToHex(r, g, b) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. hex .."".. name ..": #FFFFFF".. text, root, 255, 255, 255, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] ".. hex .."" .. name ..": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] ".. hex .."" .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FFFFFF".. hex .."" .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) 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 (alpha and (alpha < 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 That seems to work. you are great man it works perfect thx 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