Created
January 10, 2010 13:19
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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