stock ircbot_connect(server[], port, nickname[], username[], realname[]);
stock ircbot_reconnect(botid);
stock ircbot_say(botid, receiver[], message[]);
stock ircbot_action(botid, receiver[], message[]);
stock ircbot_kick(botid, channel[], user[], reason[]);
stock ircbot_notice(botid, receiver[], message[]);
stock is_bot_connected(botid);
stock ircbot_join(botid, channel[]);
stock ircbot_part(botid, channel[], message[]);
stock ircbot_quit(botid, message[]);
stock ircbot_setmode(botid, channel[], mode[]);
stock ircbot_raw(botid, raw_cmd[]);
forward onBotConnect(botid);
forward onBotDisconnect(botid);
forward onCTCPRequest(botid, user[], request_msg[], user_ident[]);
forward onChannelMessage(botid, user[], channel[], message[], user_ident[]);
forward onIRCCommand(botid, user[], channel[], command[], user_ident[]);
forward onPrivateMessage(botid, user[], message[], user_ident[]);
forward onChannelJoin(botid, user[], channel[], user_ident[]);
forward onChannelPart(botid, user[], channel[], part_msg[], user_ident[]);
forward onBotNotice(botid, source[], message[], user_ident);
forward onUserQuit(botid, user[], leaving_msg[], user_ident[]);
forward onNicknameChange(botid, user[], new_name[], user_ident[]);
forward onChannelKick(botid, user[], victim[], channel[], reason[], user_ident[]);
forward onBotInvite(botid, user[], channel[], user_ident[]);
forward onRawCommand(botid, raw_code, raw_data[]);
forward onChannelMode(botid, user[], channel[], mode[], option[], user_ident[]);
forward onTopicChange(botid, user[], channel[], topic[], user_ident[]);
// simple IRC echo bot
#include <a_samp>
#include <irc_bot>
#define BOT_NICK "TestBot"
#define BOT_USERNAME "TestBot"
#define BOT_REALNAME "Test van Bot"
#define ECHO_CHANNEL "#echo_chan"
new Bot;
public OnFilterScriptInit()
{
Bot = ircbot_connect("foco.us.irc.tl", 6667, BOT_NICK, BOT_USERNAME, BOT_REALNAME); // lets connect to FoCo Net
return 1;
}
public onBotConnect(botid)
{
ircbot_join(botid, ECHO_CHANNEL);
}
public OnPlayerText(playerid, text[])
{
if(is_bot_connected(Bot)) {
new sMessage[256], sName[MAX_PLAYER_NAME];
GetPlayerName(playerid, sName, MAX_PLAYER_NAME);
format(sMessage, sizeof sMessage, "4%s: 1%s", sName, text);
ircbot_say(Bot, ECHO_CHANNEL, sMessage);
}
return 1;
}
public onIRCCommand(botid, user[], channel[], command[], user_ident[])
{
if(!strcmp(command, "!test", true)) {
ircbot_say(botid, MAIN_CHANNEL, "hi");
return 1;
}
@Niko_boy I don't think you understand what sockets are
http://en.wikipedia.org/wiki/Network_socket |
10 months bump
I'm creating a IRC filterscript with sockets plugin, but I still didn't figure out how to create a "IRC_GetUserChannelMode" function, from the official IRC plugin. Any help would be much appreciated! |
[05:45:37] Filterscripts [05:45:37] --------------- [05:45:37] Loading filterscript 'irc_script.amx'... [05:45:37] Starting irc_script... [05:45:37] [debug] Server crashed while executing irc_script.amx [05:45:37] [debug] AMX backtrace: [05:45:37] [debug] #0 native socket_connect () [b776f440] from socket.so [05:45:37] [debug] #1 000004cc in ircbot_connect (server[]=@0x000017c8 "foco.us.irc.tl", port=6667, nickname[]=@0x00001804 "iTestBot", username[]=@0x00001828 "iTestBot", realname[]=@0x0000184c "iTest van Bot") at E:\Programas\l\MWR 294 0.3er4\pawno\include\irc_bot.inc:49 [05:45:37] [debug] #2 00003658 in public OnFilterScriptInit () at E:\Programas\l\MWR 294 0.3er4\filterscripts\irc_script.pwn:14 [05:45:37] [debug] System backtrace: [05:45:37] [debug] #0 b746535b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so [05:45:37] [debug] #1 b745e389 in _ZN11crashdetect20PrintSystemBacktraceEPv () from plugins/crashdetect.so [05:45:37] [debug] #2 b74608ed in _ZN11crashdetect11OnExceptionEPv () from plugins/crashdetect.so [05:45:37] [debug] #3 b7464e68 in ?? () from plugins/crashdetect.so [05:45:37] [debug] #4 b777a600 in ?? () [05:45:37] [debug] #5 b7770083 in _ZN7CSocket14connect_socketEiPci () from plugins/socket.so [05:45:37] [debug] #6 b776f4a0 in _Z16n_connect_socketP6tagAMXPi () from plugins/socket.so [05:45:37] [debug] #7 08093c94 in ?? () from ./samp_test [05:45:37] [debug] #8 b7460ea7 in _ZN11crashdetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so [05:45:37] [debug] #9 b746341e in ?? () from plugins/crashdetect.so [05:45:37] [debug] #10 b746706e in amx_Exec () from plugins/crashdetect.so [05:45:37] [debug] #11 b7460dab in _ZN11crashdetect9DoAmxExecEPii () from plugins/crashdetect.so [05:45:37] [debug] #12 b7463457 in ?? () from plugins/crashdetect.so [05:45:37] [debug] #13 080a9726 in ?? () from ./samp_test [05:45:37] [debug] #14 080b2821 in ?? () from ./samp_test [05:45:37] [debug] #15 080b2b2a in ?? () from ./samp_test [05:45:37] [debug] #16 080b1407 in ?? () from ./samp_test [05:45:37] [debug] #17 b7497ce6 in __libc_start_main () from /lib/libc.so.6 [05:45:37] [debug] #18 0804b521 in ?? () from ./samp_test
Function 'is_bot_connected' -> ircbot_isconnected Added IRC_ prefix to all callbacks Changed the global enum to irc* to remove conflicts with gamemodes Added 'key' parameter to ircbot_join -> (ircbot_join(botid, channel[], key[])) Fixed all 'socket_send' functions missing len arguments