Cool RC game I made.
PHP Code:
// Add to your Control-NPC
function onRCChat() {
if (params[0] in {"rr", "russianroulette"}) {
rr_game();
return;
}
}
function rr_game() {
if (this.bullets == 0) {
this.bullets = 6;
this.bullet = int(random(0,6));
sendtorc("A new revolver has been loaded by " @ player.account @ ". /npc russianroulette to play.");
} else {
if (player.account == this.lastshot) {
sendtorc("Wait for someone else to pull the trigger " @ player.account @ ".");
return;
} else {
this.lastshot = player.account;
}
this.bullets--;
if (this.bullets == this.bullet) {
sendtorc(format("/disconnect %s \"bang\"", player.account));
this.bullets = 0;
} else {
sendtorc("Click! You are safe " @ player.account);
}
if (this.bullets == 1) {
this.bullets = 6;
this.bullet = int(random(0,6));
sendtorc("The revolver cylinder has been spun.");
}
}
}