Thanks for helping and for your quick answer!
I've tried that but the bot is still crashing when I type !baa in channel.
The code:
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#define MODULE_NAME "xpto"
#define MAKING_XPTO
#include "src/mod/module.h"
#include "../irc.mod/irc.h"
#include "../server.mod/server.h"
#undef global
static Function *global = NULL;
static Function *irc_funcs = NULL;
static Function *server_funcs = NULL;
static int xpto_expmem() {
return(0);
}
static int pub_sheep (char* nick, char* host, char* handle, char* chan, char* text) {
dprintf(DP_SERVER, "privmsg %s :ooo yes you sexy sheep, baa for me!\r\n", chan);
dprintf(DP_SERVER, "privmsg %s :%cACTION sniffs your sweet tail%c\r\n", 1, 1);
putlog(LOG_CMDS, "*", "#%s@%s# baaaaaa (params: '%s')", nick, chan, text);
return(0);
}
static void xpto_report (int idx, int details) {
dprintf(idx, "YOU ARE COOL FOR USING SHEEP.MOD! Yes you are. Pat yourself on the back!");
}
static cmd_t xpto_pub[] = {
{"!baa", "", pub_sheep, NULL},
{0, 0, 0, 0}
};
static char *xpto_close()
{
rem_builtins(H_pub, xpto_pub);
module_undepend("xpto");
return(NULL);
}
EXPORT_SCOPE char *xpto_start();
static Function xpto_table[] = {
(Function) xpto_start,
(Function) xpto_close,
(Function) xpto_expmem,
(Function) xpto_report,
};
char *xpto_start(Function *global_funcs) {
global = global_funcs;
module_register(MODULE_NAME, xpto_table, 0, 9);
if(!(irc_funcs = module_depend(MODULE_NAME, "irc", 1, 0)))
return "You need the irc module to use the xpto module.";
if (!(server_funcs = module_depend(MODULE_NAME, "server", 1, 0)))
return "You need the server module to use the xpto module.";
if (!module_depend(MODULE_NAME, "eggdrop", 106, 0)) {
module_undepend(MODULE_NAME);
return "This module requires eggdrop1.4.0 or later";
}
add_builtins(H_pub, xpto_pub);
putlog(LOG_MISC, "*", "xpto.mod loaded.");
return NULL;
}
So.. I think the code is like you said
Have you got some sugestions?
thanks
pedro