how can i make a simple irc bot?
i try this, but it don't work:
Code:
#include <amxmodx>
#include <sockets>
new socket
public plugin_init()
{
irc_connect()
register_concmd("irc_msg", "msg")
register_concmd("irc_con", "connect_bot")
}
irc_connect()
{
new error = 0
socket = socket_open("irc.******.net", 6667, SOCKET_TCP, error)
if(error > 0)
{
new fail[64]
formatex(fail, 63, "Socket Error: %i", error)
set_fail_state(fail)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public connect_bot(id)
{
new message[255]
formatex(message, 254, "USER bot 0 bot :bot^nNICK bot^nJOIN #chan^n")
socket_send(socket, message, 254)
}
public msg(id)
{
socket_send(socket, "PRIVMSG #chan :welcome message^n", 64)
}
public plugin_end()
{
socket_send(socket, "QUIT :Plugin reset^n", 64)
}