Vc pode me mandar certinho por favor? não sou muito experiente em .lua sou apenas iniciante !
Se puder mandar o codigo certinho pra mim ficarei agradecido TMJ!
Codigo:
chat_range=50
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("#838B83[ #FF0000Chat Local #838B83] "..nick..": #ffffff"..msg,v,r,g,b,true)
end
end
end
addCommandHandler("LocalChat",onChat)