Jump to content

Como chat chat "say" da letra T em chat local


Recommended Posts

Posted
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]

" Se eu te ajudei, deixe sua avaliação, obrigado ! "

Joinha!

 

  • Moderators
Posted
  • Like 1

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

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.

Posted

@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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...