Jump to content

Zeus Scripter

Members
  • Posts

    5
  • Joined

  • Last visited

About Zeus Scripter

  • Birthday 01/01/1870

Details

  • Gang
    F O X
  • Location
    Brasil
  • Occupation
    Scripter
  • Interests
    MTA:BR Codes

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Zeus Scripter's Achievements

Vic

Vic (3/54)

0

Reputation

  1. Deixa eu ver se eu entendi, eu tenho que por esse código em baixo do meu certo ? ficando assim : local lastChatMessage = {} function ChatSystem ( text, msgType) local name = _getPlayerName( source ) local text = string.gsub( text,'#%x%x%x%x%x%x', " ") if ( msgType == 1 ) then return cancelEvent(true) end if ( msgType == 0 ) then cancelEvent(true) if chatTime[source] and chatTime[source] + tonumber(150) > getTickCount() then return outputChatBox("Please dont spam.",source,255,0,0) else chatTime[source] = getTickCount() end if lastChatMessage[source] and lastChatMessage[source] == text then return outputChatBox("You can't repeat that message so soon.",source,255,0,0,true) else lastChatMessage[source] = text end cancelEvent(true) local x,y,z = getElementPosition(source) for i,player in pairs(getElementsByType("player")) do local px,py,pz = getElementPosition(player) local distance = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if distance < 100 then outputChatBox(name.."#FFFFFF: "..text,player,255,255,255,true) end end end end addEventHandler("onPlayerChat",root,ChatSystem) function _getPlayerName(player) local playerTeam = getPlayerTeam(player) if (playerTeam) then local r,g,b = getTeamColor(playerTeam) local color = RGBToHex(r,g,b) playerName = color..getPlayerName(player) else playerName = "#FFFFFF"..getPlayerName(player) end return playerName end function RGBToHex(red,green,blue) return string.format("#%.2X%.2X%.2X",red,green,blue) end local lastChatMessage = {} function ChatSystem ( text, msgType) local name = _getPlayerName( source ) local text = string.gsub( text,'#%x%x%x%x%x%x', " ") if ( msgType == 1 ) then return cancelEvent(true) end if ( msgType == 0 ) then cancelEvent(true) if chatTime[source] and chatTime[source] + tonumber(150) > getTickCount() then return outputChatBox("Please dont spam.",source,255,0,0) else chatTime[source] = getTickCount() end if lastChatMessage[source] and lastChatMessage[source] == text then return outputChatBox("You can't repeat that message so soon.",source,255,0,0,true) else lastChatMessage[source] = text end cancelEvent(true) local x,y,z = getElementPosition(source) for i,player in pairs(getElementsByType("player")) do local px,py,pz = getElementPosition(player) local distance = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if distance < 100 then outputChatBox(name.."#FFFFFF: "..text,player,255,255,255,true) end end end end addEventHandler("onPlayerChat",root,ChatSystem) function _getPlayerName(player) local playerTeam = getPlayerTeam(player) if (playerTeam) then local r,g,b = getTeamColor(playerTeam) local color = RGBToHex(r,g,b) playerName = color..getPlayerName(player) else playerName = "#FFFFFF"..getPlayerName(player) end return playerName end function RGBToHex(red,green,blue) return string.format("#%.2X%.2X%.2X",red,green,blue) end
  2. Aí sim em cara irei testar aqui manito. ~Dês de já agradeço pelo suporte prestado será de extrema ajuda! @Gw8! Vixi mano, mais nesse chat qual seria a tecla pro chat ? queria por no "T"
  3. Boa tarde, caros usuários da F.MTA! Então pessoal, estou com um problema pra adicionar a função de comandos ao usar o chat local, eu gostaria de saber se algum programador poderia me explicar o que adicionar ou modificar? esse é o código / script: chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"t","down","chatbox","LocalChat") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"t","down","chatbox","LocalChat") end end) 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 onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) local r,g,b = getTeamColor(getPlayerTeam(player)) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("#00ff00[ Local ] #ffffff"..nick..": #FFFFFF"..msg,v,r,g,b,true) end end end addCommandHandler("LocalChat",onChat) Quem puder me ajudar agradeço dês de já. Att: ~ Zeus.
×
×
  • Create New...