Put this in japlus/lua/cl/chatbot/plugin.lua local chatbot = RegisterPlugin( "ChatBot", "1.0" )
local function SplitChatMessage( msg )
local splitMsg = JPUtil.explode( string.format( "%c", 0x19 ), msg )
local len = #splitMsg
if len == 2 then -- for regular messages, only one escape character
local name = string.sub( splitMsg[1], 1, string.len(splitMsg[1])-2 ) -- strip the ^7 at the end
local message = string.sub( splitMsg[2], 3 ) -- strip the ': ' before each message
return name, message
elseif len == 4 then -- for JA+ admin messages...
local name = string.sub( splitMsg[2], 2, string.len(splitMsg[2])-2 ) -- strip the '(' at the start and ^7 at the end
local message = string.sub( splitMsg[4], 4 ) -- strip the ': ^3' at the start
return name, message
end
end
AddListener( "JPLUA_EVENT_CHATMSGRECV", function( msg )
local sender, message = SplitChatMessage( msg )
local ply = GetPlayer( sender )
if ply and ply:IsBot() then
-- ... do something with 'message'
local reply = 'some response'
SendServerCommand( 'say ' .. reply )
end
return msg
end )and go from there =]