-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathroulette.cpp
More file actions
38 lines (30 loc) · 1.03 KB
/
roulette.cpp
File metadata and controls
38 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Fun game of roulette.
// Must be OP for this to work.
#include <znc/Chan.h>
#include <znc/IRCNetwork.h>
#include <znc/Modules.h>
using std::vector;
class Croulette : public CModule {
public:
MODCONSTRUCTOR(Croulette) {}
virtual ~Croulette() {}
virtual EModRet OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage) override {
if ((sMessage.Token(0).StripControls() == "!roulette") && (Channel.HasPerm(CChan::Op))) {
// Channel might be -n. Block outside users from playing.
if (Channel.FindNick(Nick.GetNick()) == nullptr) {
return HALT;
}
int x = rand() % 6 + 1;
if (x == 4) {
PutIRC("KICK " + Channel.GetName() + " " + Nick.GetNick() + " :*BANG*");
} else {
PutIRC("PRIVMSG " + Channel.GetName() + " :" + Nick.GetNick() + " *CLICK*");
}
}
return CONTINUE;
}
};
template <>
void TModInfo<Croulette>(CModInfo& Info) {
}
NETWORKMODULEDEFS(Croulette, "Russian Roulette.")