ZeyadGTX Posted October 23, 2014 Posted October 23, 2014 Hello I made small script which adds [ Admin ] [ Warden ] etc.. but the problem that if you made /start playercolors you can see double messages and i would like players having colors not to be white so i must /start playercolors But i have double messages Playercolors Script local lowerBound,upperBound = unpack(get"color_range") g_Root = getRootElement () g_ResourceRoot = getResourceRootElement ( getThisResource () ) addEventHandler ( "onResourceStart", g_ResourceRoot, function() for i,player in ipairs(getElementsByType"player") do processPlayer ( player ) end end ) function processPlayer ( player ) player = player or source local r, g, b = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, r, g, b) end addEventHandler ( "onPlayerJoin", g_Root, processPlayer ) addEventHandler('onPlayerChat', g_Root, function(msg, type) if type == 0 then cancelEvent() local r, g, b = getPlayerColor(source) local name = getPlayerName(source) local msg = msg:gsub('#%x%x%x%x%x%x', '') outputChatBox( name.. ': #FFFFFF' .. msg, g_Root, r, g, b, true) outputServerLog( "CHAT: " .. name .. ": " .. msg ) end end ) addEventHandler('onPlayerChat', g_Root, function(msg, type) if type == 1 then cancelEvent() local r, g, b = getPlayerColor(source) local name = getPlayerName(source) local msg = msg:gsub('#%x%x%x%x%x%x', '') end end ) getPlayerColor = getPlayerNametagColor getPlayerColour = getPlayerNametagColor My Admin Tag Script addEventHandler ( "onPlayerChat", root, function ( msg, type ) if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Console" ) ) and type == 0 then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) outputChatBox ( "#006400[ Owner ] " .. getPlayerName ( source ) .. ":#FFFFFF " .. msg, getRootElement(), r, g, b, true ) elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Moderator" ) ) and type == 0 then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) outputChatBox ( "#0064FF[ Warden ] " .. getPlayerName ( source ) .." :#FFFFFF " .. msg, getRootElement(), r, g, b, true ) elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "V.I.P" ) ) and type == 0 then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) outputChatBox ( "#000000[ V.I.P ]#FF9600 " .. getPlayerName ( source ) .." :#FFFFFF " .. msg, getRootElement(), r, g, b, true ) elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Everyone" ) ) and type == 0 then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) outputChatBox ( "#00FF00[ Player ] " .. getPlayerName ( source ) .. " :#ffffff " .. msg, getRootElement(), r, g, b, true ) end end )
MTA Team botder Posted October 23, 2014 MTA Team Posted October 23, 2014 Remove both "onPlayerChat" handlers in playercolors and use getPlayerNametagColor in your resource
WASSIm. Posted October 23, 2014 Posted October 23, 2014 just remove lines 20 to 40 on Playercolors script
ZeyadGTX Posted October 23, 2014 Author Posted October 23, 2014 just remove lines 20 to 40 on Playercolors script His color in Chat is White ! i need his name = his nametag color
MTA Team botder Posted October 24, 2014 MTA Team Posted October 24, 2014 And use https://wiki.multitheftauto.com/wiki/get ... metagColor in your onPlayerChat handler...
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