Elimination Game for mIRC

By Vegito on Nov 13, 2016

Someone has to type !eliminator to start the game

Other people have 20 seconds to join the game by typing !join
If no other user joins in those 20 seconds, you will play against the computer.

alias -l eliminationGame {
  var %totalPlayers = $hget(eliminator, 0).item
  var %playerEliminated = $hget(eliminator, $r(1, %totalPlayers)).data
  hdel eliminator %playerEliminated
  msg $1 04 $+ %playerEliminated  12has has been eliminated!
  if ($hget(eliminator, 0).item == 1) {
    var %survivor = $hget(eliminator, 1).data
    msg $1 04 $+ %survivor 12is the only survivor and therefore has won the game of elimination!
    unsetEliminationGame
    set -z %eliminationCooldown 60
  }
}

alias -l eliminationNPCJoin {
  if (!%i) set %i 1
  if (%i < 6) {
    if (!%npcList) set %npcList Vladimir Putin,Barack Obama,Donald J. Trump,Pope Francis,Kim Jong-un,Hillary Clinton
    var %randomNPC = $r(1, $numtok(%npcList, 44))
    var %npc = $gettok(%npcList, %randomNPC, 44)
    %npcList = $deltok(%npcList, %randomNPC, 44)
    .timer 1 3 eliminationJoin $1 1 %npc 
    inc %i 
  }
  else eliminationStart $1
}

alias -l eliminationStart {
  if ($hget(eliminator, 0).item == 1) {
    msg $1 12Since no one joined the game, the NPCs will join.
    eliminationNPCJoin $1
  }
  else {
    var %totalPlayers = $hget(eliminator, 0).item
    msg $1 12Elimination game has been started, people will start getting eliminated after every 5 seconds!
    .timer $calc(%totalPlayers - 1) 5 eliminationGame $1
  }
}

alias -l eliminationJoin {
  if (!$hget(eliminator, $2)) {
    if ($timer(EliminationStart)) {
      hadd eliminator $2 $2
      var %totalPlayers = $hget(eliminator, 0).item
      msg $1 04 $+ $2 12has joined the game! 04 $+ %totalPlayers 12player(s) joined! You've 04 $+ $timer(EliminationStart).secs 12seconds left to join!
    }
    if ($3) {
      hadd eliminator $3 $3-
      msg $1 12NPC 04 $+ $3- 12has joined the game!
      eliminationNPCJoin $1
    } 
  }
}

alias -l unsetEliminationGame {
  if ($hget(eliminator)) hfree eliminator 
  unset %npcList %i
} 

on *:TEXT:!eliminator:#: {
  if (%eliminationCooldown) notice $nick 12The game is currently in cooldown, the game can be started after 04 $+ $duration($v1) $+ 12.
  else {
    if (!$hget(eliminator)) {
      msg # 04 $+ $nick 12has started a game of elimination type 04!join 12to join the game, you've 0420 seconds 12to join.
      if (!$hget(eliminator)) hmake eliminator 
      .timerEliminationStart -o 1 20 eliminationStart #
      eliminationJoin # $nick
    }
    else notice $nick 12there is already a game of elimination going on!  
  }
}

on *:TEXT:!join:#: {
  eliminationJoin # $nick
}

Comments

Sign in to comment.
cptpan   -  Feb 02, 2018

This doesn't do shit?

 Respond  
Degausser   -  Nov 13, 2016

Nice job :P

 Respond  
Clark2016   -  Nov 13, 2016

it would be better if you add a flood protection to the game. Example: The game can only be played once in 1 min.
Like that thing

Vegito  -  Nov 13, 2016

What do you mean? Right now you can only play one instance of the game at a time, as the script isn't built to run multiple instances.

Clark2016  -  Nov 14, 2016

Ik, but I am just telling that if one user constantly plays the game one after the another five times in a row in one minute. Then it might spam the chat.

Vegito  -  Nov 14, 2016

Done! Added a cooldown timer of 60 seconds to the game.

Clark2016  -  Nov 14, 2016

Thanks :) And awesome game!

ST3LiST  -  Dec 05, 2016

Awesome script mate, thanks for it.
The NPC is the best Part.

CrazyDriver  -  Nov 11, 2018

which part do you edit to allow more than 4 NPC's to join without breaking the script? as I've added a few more names and would like 5 or 6 NPCs to join.

Thanks for any help.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.