OrrutoSCR Posted December 19, 2019 Share Posted December 19, 2019 (edited) function removeHex(s) if type(s) == "string" then while(string.find(s, "#%x%x%x%x%x%x")) do s = string.gsub(s, "#%x%x%x%x%x%x","") end end return s end addEventHandler('onPlayerChangeNick', root, function(old, new) local noHex = removeHex(new) if noHex ~= new then cancelEvent() end end) addEventHandler('onPlayerJoin', root, function() local pName = getPlayerName(source) local newNick = removeHex(pName) if newNick ~= pName then setPlayerName(source, newNick) end end) Essas funções eu usei para bloquear os codigos de cores Hex do nome dos players no chat, Só que eu não tou conseguindo bloquear as cores das binds dos players e tirar aquele monte de letra colorida horrível do chat usando essas mesma função, alguem pode me ajudar ? Edited December 19, 2019 by OrrutoSCR Link to comment
beast99 Posted December 19, 2019 Share Posted December 19, 2019 Cara, posta o código do chat, não tem como te ajudar sem o codigo completo.. 1 Link to comment
Tommy. Posted December 19, 2019 Share Posted December 19, 2019 function removeHex(s) if type(s) == "string" then while(string.find(s, "#%x%x%x%x%x%x")) do s = string.gsub(s, "#%x%x%x%x%x%x","") end end return s end addEventHandler('onPlayerChangeNick', root, function(old, new) local noHex = removeHex(new) if noHex ~= new then cancelEvent() end end) addEventHandler('onPlayerJoin', root, function() local pName = getPlayerName(source) local newNick = removeHex(pName) if newNick ~= pName then setPlayerName(source, newNick) end end) addEventHandler("onPlayerChat", root, function(message, messageType) if message and messageType == 0 then cancelEvent() outputChatBox(removeHex(getPlayerName(source))..": #FFFFFF"..removeHex(message), root, 255, 255, 255, true ) end end) EDIT: Não testei 1 Link to comment
OrrutoSCR Posted December 19, 2019 Author Share Posted December 19, 2019 15 minutes ago, Tommy. said: function removeHex(s) if type(s) == "string" then while(string.find(s, "#%x%x%x%x%x%x")) do s = string.gsub(s, "#%x%x%x%x%x%x","") end end return s end addEventHandler('onPlayerChangeNick', root, function(old, new) local noHex = removeHex(new) if noHex ~= new then cancelEvent() end end) addEventHandler('onPlayerJoin', root, function() local pName = getPlayerName(source) local newNick = removeHex(pName) if newNick ~= pName then setPlayerName(source, newNick) end end) addEventHandler("onPlayerChat", root, function(message, messageType) if message and messageType == 0 then cancelEvent() outputChatBox(removeHex(getPlayerName(source))..": #FFFFFF"..removeHex(message), root, 255, 255, 255, true ) end end) EDIT: Não testei Testei aqui, não deu certo n tbm 56 minutes ago, MesaDowN said: Cara, posta o código do chat, não tem como te ajudar sem o codigo completo.. -- Config do Chat Local function removeHex(s) if type(s) == "string" then while(string.find(s, "#%x%x%x%x%x%x")) do s = string.gsub(s, "#%x%x%x%x%x%x","") end end return s end addEventHandler('onPlayerChangeNick', root, function(old, new) local noHex = removeHex(new) if noHex ~= new then cancelEvent() end end) addEventHandler('onPlayerJoin', root, function() local pName = getPlayerName(source) local newNick = removeHex(pName) if newNick ~= pName then setPlayerName(source, newNick) end end) addEventHandler("onPlayerChat", root, function(message, messageType) if message and messageType == 0 then cancelEvent() outputChatBox(removeHex..(getPlayerName(source))..": #FFFFFF"..removeHex..(message), root, 255, 255, 255, true ) end end) addEventHandler("onPlayerChat", root, function(tresc, msgtype) if (msgtype == 0) then cancelEvent() local x,y,z = getElementPosition(source) for key, gracze in ipairs(getElementsByType("player")) do local x2,y2,z2 = getElementPosition(gracze) if getElementData (source, "ChatLocal:Delay", true) then outputChatBox ( MensagemFalandoRapidoDemaisLocal, source, 255, 255, 255, true ) return end if ( getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 ) < DistanciaDoChatLocal ) then local int = getElementInterior ( source ) local dim = getElementDimension ( source ) local int2 = getElementInterior ( gracze ) local dim2 = getElementDimension ( gracze ) if ( int == int2 and dim == dim2 ) then conta = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Console" ) ) then outputChatBox("* #FF7F00("..hours..":"..minutes..":"..second..") #FF7F00- #ffffff"..getPlayerName(source).. "("..getElementData(source, "ID")..")#FF7F00 - #FF7F00 "..tresc, gracze, 255, 255, 255, true) esse ai é o meu chat Link to comment
Tommy. Posted December 19, 2019 Share Posted December 19, 2019 Tenta isso: outputChatBox("* #FF7F00("..hours..":"..minutes..":"..second..") #FF7F00- #ffffff"..getPlayerName(source).. "("..getElementData(source, "ID")..")#FF7F00 - #FF7F00 "..removeHex(tresc), gracze, 255, 255, 255, true) 1 Link to comment
OrrutoSCR Posted December 19, 2019 Author Share Posted December 19, 2019 6 minutes ago, Tommy. said: Tenta isso: outputChatBox("* #FF7F00("..hours..":"..minutes..":"..second..") #FF7F00- #ffffff"..getPlayerName(source).. "("..getElementData(source, "ID")..")#FF7F00 - #FF7F00 "..removeHex(tresc), gracze, 255, 255, 255, true) Nicee! Deu certooo, se eu colocar..removehex tbm no global e anonimo ele funciona tbm ? Link to comment
Tommy. Posted December 19, 2019 Share Posted December 19, 2019 Just now, OrrutoSCR said: Nicee! Deu certooo, se eu colocar..removehex tbm no global e anonimo ele funciona tbm ? Funciona, da um `Thanks` nas minhas respostas, kk 1 Link to comment
OrrutoSCR Posted December 19, 2019 Author Share Posted December 19, 2019 Just now, Tommy. said: Funciona, da um `Thanks` nas minhas respostas, kk Já dei rs, vlw mano pela ajuda 1 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