Skip to content

Instantly share code, notes, and snippets.

@kylef
Created January 10, 2010 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylef/273514 to your computer and use it in GitHub Desktop.
Save kylef/273514 to your computer and use it in GitHub Desktop.
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