Kaio Bruno Silveira Posted November 11, 2020 Share Posted November 11, 2020 Mano, eu queria saber como coloco para aparecer algumas TAGs especificas no chat rp, como a do facebook e o chat local Link to comment
Moderators Patrick Posted November 12, 2020 Moderators Share Posted November 12, 2020 Wrong language and section, moved to Portuguese scripting. Link to comment
Boechat Posted November 12, 2020 Share Posted November 12, 2020 Isso você tem que mexer direto no mod de chat, caso não tenha um mod para tal função, veja se esse te atende: https://www.mtabrasil.com.br/2019/11/chat-rp-descompilado.html Link to comment
Kaio Bruno Silveira Posted November 12, 2020 Author Share Posted November 12, 2020 (edited) chat_range = 100 chatTime = {} elementID = "ID" lastChatMessage = {} function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChatLocal(text, type) local new = "" local iter = 0 local msg = string.gsub(text, "_", "") for word in msg:gmatch("%S+") do iter = iter + 1 if iter == 1 and word:len() > 0 then word = word:gsub("%a", string.upper, 1) end new = new..word.." " end if new ~= "" then msg = new end text = msg if not hasObjectPermissionTo(source, "function.kickPlayer") then if chatTime[source] and chatTime[source] + tonumber(5000) > getTickCount() then cancelEvent() outputChatBox("Espere 5 segundo para poder digitar novamente!", source, 255, 0, 0) return else chatTime[source] = getTickCount() end end lastChatMessage[source] = text cancelEvent(true) local px,py,pz = getElementPosition(source) local nick = string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") local id = getElementData(source, elementID) or "n.a" for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("᠉ #1E90FF BNR - #ffa500[ ChatLocal ] - #FFFFFF"..nick.." #1E90FF ["..id.."]#00ff00 - #ffa500"..msg, v, 200, 200, 200,true) end end end addEventHandler("onPlayerChat", root, onChatLocal) function MensagemTwitter(source, cmd, ...) local MessagemT = table.concat ( { ... }, " " ) local name = string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") local id = getElementData(source, elementID) or "n.a" for _,v in ipairs(getElementsByType("player")) do outputChatBox("᠉ #1E90FF BNR - #1E90FF[ Facebook ] - #ffffff"..name.." #1E90FF["..id.."]#00BFFF - #1E90FF"..MessagemT,v, 255, 255, 255, true) end end addCommandHandler("Facebook", MensagemTwitter) addCommandHandler( "DeepWeb", function ( source, cmd, ... ) local message2 = #{...} > 0 and table.concat({...}," ") or nil if message2 then for _, p in ipairs (getElementsByType("player")) do if hasObjectPermissionTo(p, "command.mute", true) then local name = string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") local id = getElementData(source, elementID) or "n.a" outputChatBox("᠉ #1E90FF BNR - #696969[ DeepWeb ] - #ffffff"..name.." ["..id.."]#696969 - #696969"..message2, p, 255, 255, 255, true) else outputChatBox("᠉ #696969 DeepWeb - #696969"..message2, p, 255, 255, 255, true) end end else end end) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "y", "down", "chatbox", "Facebook") end) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"y", "down", "chatbox", "Facebook") end end) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "u", "down", "chatbox", "DeepWeb") end) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"u", "down", "chatbox", "DeepWeb") end end) Edited November 12, 2020 by Kaio Bruno Silveira Eu so queria que aparecesse no facebook e no chatlocal as TAG: ''Presidente'' ''Vice Presidente'' ''Deputado Federal'' ''Deputado Estudal'' ''Prefeito'' ''Vereador'' Link to comment
Boechat Posted November 13, 2020 Share Posted November 13, 2020 Da proxima vez que for inserir um código no site use essa ferramenta: Link to comment
Boechat Posted November 13, 2020 Share Posted November 13, 2020 Veja se vai funcinar assim: Spoiler Lembre-se de usar o setPlayerNametagText para setar a tag e setPlayerNametagColor pra definir a cor. chat_range = 100 chatTime = {} elementID = "ID" lastChatMessage = {} function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChatLocal(text, type) local new = "" local iter = 0 local msg = string.gsub(text, "_", "") for word in msg:gmatch("%S+") do iter = iter + 1 if iter == 1 and word:len() > 0 then word = word:gsub("%a", string.upper, 1) end new = new..word.." " end if new ~= "" then msg = new end text = msg if not hasObjectPermissionTo(source, "function.kickPlayer") then if chatTime[source] and chatTime[source] + tonumber(5000) > getTickCount() then cancelEvent() outputChatBox("Espere 5 segundo para poder digitar novamente!", source, 255, 0, 0) return else chatTime[source] = getTickCount() end end lastChatMessage[source] = text cancelEvent(true) local px,py,pz = getElementPosition(source) local nick = string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") local id = getElementData(source, elementID) or "n.a" for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("᠉ #1E90FF BNR - #ffa500[ ChatLocal ] "..tag (source).." - #FFFFFF"..nick.." #1E90FF ["..id.."]#00ff00 - #ffa500"..msg, v, 200, 200, 200,true) end end end addEventHandler("onPlayerChat", root, onChatLocal) function MensagemTwitter(source, cmd, ...) local MessagemT = table.concat ( { ... }, " " ) local name = string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") local id = getElementData(source, elementID) or "n.a" for _,v in ipairs(getElementsByType("player")) do outputChatBox("᠉ #1E90FF BNR - #1E90FF[ Facebook ] "..tag (source).." - #ffffff"..name.." #1E90FF["..id.."]#00BFFF - #1E90FF"..MessagemT,v, 255, 255, 255, true) end end addCommandHandler("Facebook", MensagemTwitter) addCommandHandler( "DeepWeb", function ( source, cmd, ... ) local message2 = #{...} > 0 and table.concat({...}," ") or nil if message2 then for _, p in ipairs (getElementsByType("player")) do if hasObjectPermissionTo(p, "command.mute", true) then local name = string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") local id = getElementData(source, elementID) or "n.a" outputChatBox("᠉ #1E90FF BNR - #696969[ DeepWeb ] -"..tag (source).." #ffffff"..name.." ["..id.."]#696969 - #696969"..message2, p, 255, 255, 255, true) else outputChatBox("᠉ #696969 DeepWeb - #696969"..message2, p, 255, 255, 255, true) end end else end end) function tag (player) if isElement(player) and getElementType ('player') then local r, g, b = getPlayerNametagColor (player) local tag = getPlayerNametagText (player) local color = RGBToHex (r, g, b) return color..tag end end 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 addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "y", "down", "chatbox", "Facebook") end) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"y", "down", "chatbox", "Facebook") end end) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "u", "down", "chatbox", "DeepWeb") end) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"u", "down", "chatbox", "DeepWeb") end end) Link to comment
Kaio Bruno Silveira Posted November 17, 2020 Author Share Posted November 17, 2020 A onde coloco setPlayerNametagText e a cor setPlayerNametagColor (sou novo em script) Link to comment
Kaio Bruno Silveira Posted November 18, 2020 Author Share Posted November 18, 2020 tipo eu quero pra apenas algumas tag especifica Link to comment
Boechat Posted November 18, 2020 Share Posted November 18, 2020 14 hours ago, Kaio Bruno Silveira said: A onde coloco setPlayerNametagText e a cor setPlayerNametagColor (sou novo em script) Depende da sua necessidade Você quer colocar tag de SAMU? Coloca setPlayerNametagText quando o player pegar a skin de SAMU Quer colocar tag de admin? Coloca setPlayerNametagText quando o admin logar 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