Loudss Posted January 27, 2020 Posted January 27, 2020 Queria colocar o chat "say" pra ficar como chat local, tipo: quando eu aperto t, eu queria que a mensagem aparecesse como chat local, mas aparece assim: https://prnt.sc/qt9qxt
Angelo Pereira Posted January 27, 2020 Posted January 27, 2020 chatTime = {} lastChatMessage = {} addEventHandler("onPlayerChat", getRootElement(), function(text, msgtype) if (msgtype == 0) then local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local new = "" local iter = 0 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 if chatTime[source] and chatTime[source] + tonumber(1000) > getTickCount() then cancelEvent() outputChatBox("Espere 5 segundos para poder digitar novamente!", source, 255, 0, 0, true) return else chatTime[source] = getTickCount() end lastChatMessage[source] = text cancelEvent() local x, y, z = getElementPosition(source) local colplay = createColSphere (x, y, z, 20) local colisao = getElementsWithinColShape (colplay, "player") destroyElement(colplay) for _, player in ipairs(colisao) do outputChatBox("[CHAT LOCAL] Player: " .. name .." : " .. msg.."", player, 255, 255, 255, true) end end end ) Desse jeito irá ser um CHAT LOCAL. lastChatMessage = {} addEventHandler("onPlayerChat", getRootElement(), function(text, msgtype) if (msgtype == 0) then local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local new = "" local iter = 0 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 if chatTime[source] and chatTime[source] + tonumber(1000) > getTickCount() then cancelEvent() outputChatBox("Espere 5 segundos para poder digitar novamente!", source, 255, 0, 0, true) return else chatTime[source] = getTickCount() end lastChatMessage[source] = text cancelEvent() outputChatBox("[CHAT LOCAL] Player: " .. name .." : " .. msg.."", root, 255, 255, 255, true) end end ) Desse Jeito apenas será a TAG [CHAT LOCAL] Página : MAD Scripting MTA Discord : Ângelo Pereira#4059 " Se eu te ajudei, deixe sua avaliação, obrigado ! "
Loudss Posted January 28, 2020 Author Posted January 28, 2020 Mas onde é pra colocar esse arquivo? '-'
Angelo Pereira Posted January 28, 2020 Posted January 28, 2020 (edited) Lado: Server-side. Edited January 28, 2020 by Angelo Pereira Página : MAD Scripting MTA Discord : Ângelo Pereira#4059 " Se eu te ajudei, deixe sua avaliação, obrigado ! "
Loudss Posted January 28, 2020 Author Posted January 28, 2020 (edited) Não sei onde é esse server-side não, pode me explicar melhor? '-' Edited January 28, 2020 by Loudss
Moderators Lord Henry Posted January 28, 2020 Moderators Posted January 28, 2020 Introdução ao Scripting Recursos 1 Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
DNL291 Posted February 2, 2020 Posted February 2, 2020 @Loudss Perguntas relacionadas a script você faz na seção Programação em Lua. Tópico movido. Please do not PM me with scripting related question nor support, use the forums instead.
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