Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Vote kicking | szmol96 | Mutator | 8.7 |
#pragma name "Votekick"
const int timeout = 30; //Time limit in seconds
int counter = 0;
bool votingActive = false;
uint playerToKick = 0;
string reasonForKicking = "";
int votes = 0;
int activePlayers() {
uint number = 0;
for(uint i = 0; i < 32; i++) {
if (jjPlayers[i].isActive) number++;
}
return number;
}
void onMain() {
if (jjIsServer && votingActive) {
if (votes > activePlayers() / 2) {
jjChat("/kick " + playerToKick + " " + reasonForKicking);
votingActive = false;
playerToKick = 0;
reasonForKicking = "";
votes = 0;
counter = 0;
}
if (counter == timeout * 70) {
jjConsole("Kick voting for " + join(jjPlayers[playerToKick- 1].name.split("|"), "") + " timed out.", true);
playerToKick = 0;
reasonForKicking = "";
votes = 0;
votingActive = false;
counter = 0;
}
counter++;
}
}
void onChat(int clientID, string &in stringReceived, CHAT::Type chatType) {
array<string> results;
if (jjIsServer) {
if (jjRegexIsValid(stringReceived) && jjRegexMatch(stringReceived, "!votekick\\s+(\\d+)\\s+(.+?)\\s*", results, true) && !votingActive) {
if (jjPlayers[parseInt(results[1]) - 1].isActive) {
jjConsole(join(jjPlayers[clientID].name.split("|"), "") + " started a kick voting against " + join(jjPlayers[parseInt(results[1]) - 1].name.split("|"), ""), true);
jjConsole("Reason: " + results[2], true);
playerToKick = parseInt(results[1]);
reasonForKicking = results[2];
votingActive = true;
}
}
if (votingActive && stringReceived == "!y") {
votes++;
jjConsole(join(jjPlayers[clientID].name.split("|"), "") + " voted yes.", true);
}
}
}
Jazz2Online © 1999-INFINITY (Site Credits). We have a Privacy Policy. Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats.
Eat your lima beans, Johnny.