Hello! Why the /me not working properly? I tried to solve but i can't :/. The problem is when the player type just /me the script doesn't react to that. And if i type after the /me many spaces the msg is sent.
Here's the code:
function sendMessage( message,messageType)
if messageType == 1 then -- /me
cancelEvent()
sendMe(source,message)
end
end
addEventHandler ( "onPlayerChat", root,sendMessage)
function sendMe(source,...)
local check = ...
local msg = table.concat({...}, " ")
if not check then
outputChatBox("#77ba50Usage:#FFFFFF /me [text]",source,255,0,0,true)
else
local name = string.gsub(getPlayerName(source),"_"," ")
pX,pY,pZ = getElementPosition(source)
local zone = createColSphere(pX,pY,pZ,range)
for _, thePlayer in ipairs(getElementsWithinColShape(zone,"player")) do
outputChatBox(colorME.."*** "..name.." "..msg,thePlayer,255,0,0,true)
end
destroyElement(zone)
end
outputChatBox(string.len(msg),source)
end