Loudss Posted January 27, 2020 Share 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 Link to comment
Angelo Pereira Posted January 27, 2020 Share 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] Link to comment
Loudss Posted January 28, 2020 Author Share Posted January 28, 2020 Mas onde é pra colocar esse arquivo? '-' Link to comment
Angelo Pereira Posted January 28, 2020 Share Posted January 28, 2020 (edited) Lado: Server-side. Edited January 28, 2020 by Angelo Pereira Link to comment
Loudss Posted January 28, 2020 Author Share Posted January 28, 2020 (edited) Não sei onde é esse server-side não, pode me explicar melhor? '-' Edited January 28, 2020 by Loudss Link to comment
Other Languages Moderators Lord Henry Posted January 28, 2020 Other Languages Moderators Share Posted January 28, 2020 Introdução ao Scripting Recursos 1 Link to comment
DNL291 Posted February 2, 2020 Share Posted February 2, 2020 @Loudss Perguntas relacionadas a script você faz na seção Programação em Lua. Tópico movido. 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