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