Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is a russian routlette module which may kick a user when he says !roulette
#include <main.h>
#include <Modules.h>
#include <Chan.h>
class CRussianRoulette_Mod : public CModule {
public:
MODCONSTRUCTOR(CRussianRoulette_Mod) {}
virtual ~CRussianRoulette_Mod() {}
EModRet OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage) {
if ((Channel.HasPerm('@') || Channel.HasPerm('!') || Channel.HasPerm('*')) && sMessage.Equals("!roulette")) {
if (rand() % 2) {
PutIRC("KICK " + Channel.GetName() + " " + Nick.GetNick() + " You lose!");
} else {
PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + ": You win!");
}
}
return CONTINUE;
}
};
MODULEDEFS(CRussianRoulette_Mod, "This is a russian routlette module which may kick a user when he says !roulette")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.