Jump to content

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


Recommended Posts

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

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