Sephiroth
http://sephiroth.scifi-action.de/board/

SlapMania - funny slaping game ;)
http://sephiroth.scifi-action.de/board/viewtopic.php?f=4&t=22
Seite 1 von 1

Autor:  Sephiroth [ 18. März 2008 00:16 ]
Betreff des Beitrags:  SlapMania - funny slaping game ;)

;;; SLAPMANIA!!! :D


;; SETUP
;; Change this values (but don't remove 'return' )
alias -l slapchan { return #SlapMania }
alias -l mymainnick { return SlapManiac }
alias -l myalternativenick { return $+(^,$mymainnick,^) }
alias -l myfullname { return Come and slap around with friends at $slapchan }
alias -l myident { return slap.those }
alias -l myemail { return slap.those@stupid.users.quakenet.org }
alias -l myqauthpass { return $null }
alias -l myqauthnick { return $null }
alias -l mytopic { return Welcome and Happy slapping! - If you don't know how to slap in the right way look at this page: 12www.slapmania.tk }

;; Script starts here please modify it only if you know what you really do ;)
on *:ping:{
  if ($nick($slapchan,$p1).idle > 60) {
    m $p1 you idle now for $duration($nick($slapchan,$p1).idle) in $duration($calc(300 - $nick($slapchan,$p1).idle)) the game will be reseted!
    .timerresetgame 1 $calc(300 - $nick($slapchan,$p1).idle) reset idle from $p1
  }
  if ($nick($slapchan,$p2).idle > 60) {
    m $p2 you idle now for $duration($nick($slapchan,$p2).idle) in $duration($calc(300 - $nick($slapchan,$p2).idle)) the game will be reseted!
    .timerresetgame 1 $calc(300 - $nick($slapchan,$p2).idle) reset idle from $p2
  }
}

alias -l w { if (!$window(@SlapMania)) { window -ebok0z @SlapMania } }
alias ls { w | if ($line(@SlapMania,$line(@SlapMania,0)) != -) { echo @SlapMania - } }
alias e { w | echo @SlapMania * $1- }
alias h {
  if ($isid) { return $hget($1) }
  else { if ($hget($1,0)) { hfree $1 } | hmake $1 }
}
alias -l _mode {
  return $iif($prop == null,$gettok($chan($iif($1,$1,$chan)).mode,1,32),$chan($iif($1,$1,$chan)).mode)
}
alias me {
  me $iif(c isincs $_mode($active).null && $chr(3) isin $1-,$strip($1-,c),$1-)
}
alias say {
  say $iif(c isincs $_mode($active).null && $chr(3) isin $1-,$strip($1-,c),$1-)
}
alias msg {
  msg $$1 $iif(c isincs $_mode($1).null && $chr(3) isin $$2-,$strip($2-,c),$2-)
}
alias describe {
  describe $$1 $iif(c isincs $_mode($1).null && $chr(3) isin $$2-,$strip($2-,c),$2-)
}
alias hlist {
  var %x = $hget(0)
  while (%x) {
    echo $color(info) -ag Table: $hget(%x) ( $+ $hget(%x,0).item $+ )
    if ($hget(%x,0).item) {
      var %y = $ifmatch
      while (%y) {
        echo $color(info) -ag $str( $+ $chr(32),6) $iif(%y != 1,|-,`-) $hget(%x,%y).item ( $+ $hget(%x,%y).data $+ )
        dec %y
      }
    }
    dec %x
  }
  echo $color(info) -ag * End of /hlist
}
alias hit {
  var %hit = $1-,%i,%q = $len($1-),%f = %q
  while (%q) { %i = $iif(%i,%i +) $asc($mid(%hit,%q,1)) | dec %q }
  %i = %i / %f
  %i = %i * $+(0.,$r(7,9),$r(0,9))
  if ($r(1,7) == 7) { %i = %i * 3 | %i = $int(%i) ***Critical Hit*** }
  else { %i = $int(%i) }
  if (($r(1,10) == 10) && (!$gettok(%i,2,32))) { %i = 0 ***miss*** }
  if (($r(1,25) == 25) && (!$gettok(%i,2,32))) { %i = 666 ***ultimative Hit*** }
  return %i
}
alias health { return $iif($round($calc($1 * 100 / $2),1),$ifmatch,0) }
alias health2 { return $bar($iif($round($calc($1 * 20 / $2),0) > 0,$ifmatch,0),20) }
alias bar {
  if $1 == 0 && $2 == 0 || $1 > $2 { return * ERROR * }
  elseif $1 isnum && $2 isnum && $1 <= $2 { return  $+ $iif($3 && $3 isnum,$3,$iif($3 == 0,0,14)) $+ [ $+  $+ $iif($4 && $4 isnum,$4,$iif($4 == 0,0,9)) $+  $+ $str($chr(124),$1) $+  $+  $+ $iif($5 && $5 isnum,$5,$iif($5 == 0,0,4)) $+ $str($chr(124),$calc($iif($2 && $2 isnum,$2,10) - $$1)) $+  $+ $iif($3 && $3 isnum,$3,$iif($3 == 0,0,14)) $+ ] $iif($prop == stat,$int($1) $+ : $+ $iif($int($2),$int($2),10)) $iif($prop == perc,$int($calc($1 / $iif($2,$2,10) * 100)) $chr(37))) $iif($prop == all,$int($1) $+ : $+ $iif($int($2),$int($2),10) - $int($calc($1 / $iif($2,$2,10) * 100)) $chr(37))) }
  elseif $1 isnum && $1 < 11 && !$2 { return  $+ $iif($3 && $3 isnum,$3,$iif($3 == 0,0,14)) $+ [ $+  $+ $iif($4 && $4 isnum,$4,$iif($4 == 0,0,9)) $+  $+ $str($chr(124),$1) $+  $+  $+ $iif($5 && $5 isnum,$5,$iif($5 == 0,0,4)) $+ $str($chr(124),$calc($iif($2 && $2 isnum,$2,10) - $$1)) $+  $+ $iif($3 && $3 isnum,$3,$iif($3 == 0,0,14)) $+ ] $iif($prop == stat,$int($1) $+ : $+ $iif($int($2),$int($2),10)) $iif($prop == perc,$int($calc($1 / $iif($2,$2,10) * 100)) $chr(37))) $iif($prop == all,$int($1) $+ : $+ $iif($int($2),$int($2),10) - $int($calc($1 / $iif($2,$2,10) * 100)) $chr(37))) }
  else { return * ERROR * }
}
alias reset {
  m Reseting current game $+ $iif($1,$chr(32) $+ requested by $1-) $+ . $p1 ( $+ $iif($p1(hp) < 0,0,$p1(hp)) $+ / $+ $p1(health) $+ HP) vs $p2 ( $+ $iif($p2(hp) < 0,0,$p2(hp)) $+ / $+ $p2(health) $+ HP)
  if ($health($p1(hp),$p1(health)) > $health($p2(hp),$p2(health))) { m $p1 has won this Round. $iif($health($p1(hp),$p1(health)) == 100,With a Perfect!) }
  elseif ($health($p2(hp),$p2(health)) > $health($p1(hp),$p1(health))) { m $p2 has won this Round. $iif($health($p2(hp),$p2(health)) == 100,With a Perfect!) }
  else { m We have a draw. No one has won this round. }
  if ($status == connected) { mode $slapchan -mvv $p1 $p2 }
  hadd -m ignore nicks $p1 $p2
  hfree player1 | h player1
  hfree player2 | h player2
  hfree game | h game
  .timerresetgame off
  .timerspamprot off
}
alias setgame {
  mode $slapchan +mvv $p1 $p2
  hadd player1 hp $hp($p1)
  hadd player2 hp $hp($p2)
  hadd player1 health $p1(hp)
  hadd player2 health $p2(hp)
  start
}
alias hp {
  var %hp = $1-,%i,%q = $len($1-),%f = %q
  while (%q) { %i = $iif(%i,%i +) $asc($mid(%hp,%q,1)) | dec %q }
  %i = %i / %f
  %i = %i * 5
  return $int(%i)
}
alias start {
  hadd game active $true
  hadd game cp $iif($r(0,1),$p1,$p2)
  m Game Starts.
  m And the one who has the first turn is: $game(cp)
  m $game(cp) prepare of your enemy $iif($game(cp) == $p1,$p2,$p1)
}
alias norm {
  var %x = 32,%y = 255,%w = $1,%char = . : _ - $chr(35) ' * + ~ ! " § $ % & / ( ) = ? ` ´ $chr(123) $chr(124) $chr(125),%c = ""
  while (%x < %y) {
    inc %x | %c = $chr(%x)
    if (%c !isalnum && !$istok(%char,%c,32)) { %w = $remove(%w,$chr(%x)) }
  }
  return $strip(%w)
}
on *:disconnect:{
  reset
}
alias p1 { var %x = $hget(player1,$iif($1,$1,name)) | return $iif(%x,%x,0) }
alias p2 { var %x = $hget(player2,$iif($1,$1,name)) | return $iif(%x,%x,0) }
alias game { var %x = $hget(game,$iif($1,$1,active)) | return $iif(%x,%x,0) }
alias m {
  if ($status == connected) {
    msg $slapchan $logo $$1-
    if ($1- == Game starts.) { ls }
    e $1-
  }
}
alias logo { return -12S7lap12M7ania- }
alias mmode {
  var %i = $nick($1,0),%x,%n
  while (%i) {
    %n = $nick($1,%i)
    if (%n == $me) { dec %i | %n = $nick($1,%i) }
    if (%n $iif($2 == +,!) $+ $replace($3,o,isop,h,ishop,v,isvoice) $1) {
      %x = $addtok(%x,%n,32)
      if ($numtok(%x,32) == $modespl) {
        mode $1-2 $+ $str($3,$modespl) %x
        %x = ""
      }
    }
    dec %i
  }
  if (%x) {
    mode $1-2 $+ $str($3,$numtok(%x,32)) %x
  }
}
on *:quit:{
  if ($nick == $p1) { hadd player1 hp 0 | m $p1 has left us. Starting a new round. | reset }
  if ($nick == $p2) { hadd player2 hp 0 | m $p2 has left us. Starting a new round. | reset }
  if ($nick ison $slapchan) .timerlimit 1 10 mode #alcatraz +l $!calc($nick(#alcatraz,0) + % $+ limit)
  if $nick == SlapMania { nick $nick }
}
on *:nick:{
  if (# == $slapchan) {
    if ($nick == $p1) { hadd player1 hp 0 | hadd player1 name $newnick | m $p1 has left us. Starting a new round. | reset }
    if ($nick == $p2) { hadd player2 hp 0 | hadd player2 name $newnick | m $p2 has left us. Starting a new round. | reset }
    .timerlimit 1 10 mode # +l $!calc($nick( $+ # $+ ,0) + % $+ limit)
  }
}
on *:kick:#:{
  if (# == $slapchan) {
    if ($knick == $p1) { hadd player1 hp 0 | hadd player1 name $knick | m $p1 has left us. Starting a new round. | reset }
    if ($knick == $p2) { hadd player2 hp 0 | hadd player2 name $knick | m $p2 has left us. Starting a new round. | reset }
    .timerlimit 1 10 mode # +l $!calc($nick( $+ # $+ ,0) + % $+ limit)
  }
}
on *:part:#alcatraz:{
  if (# == $slapchan) {
    if ($p1 == $nick) { hadd player1 hp 0 | m Player 1 left use. Starting a new round. | reset }
    if ($p2 == $nick) { hadd player2 hp 0 | m Player 2 left use. Starting a new round. | reset }
    .timerlimit 1 10 mode # +l $!calc($nick( $+ # $+ ,0) + % $+ limit)
  }
}
on @*:text:!health:#:{
  if ($istok($p1 $p2,$nick,32) && # == $slapchan) {
    if ($nick == $p1) { m $p1 you have currently $p1(hp) $+ / $+ $p1(health) $+ HP $health2($p1(hp),$p1(health)) }
    if ($nick == $p2) { m $p2 you have currently $p2(hp) $+ / $+ $p2(health) $+ HP $health2($p2(hp),$p2(health)) }
  }
}
raw 396:*:{ join $slapchan }
on *:start:{
  var %x = $findfile($mircdir,motfv3.dll,1,set %onthefly $1-)
  if (!%x) e Please add "motfv3.dll" to your SlapMania Directory (www.mircscripts.org)
  if (%onthefly) var %x = $dll($+(",%onthefly,"),motfv,Load)
  .nick $mymainnick
  .anick $myalternativenick
  .fullname $myfullname
  .identd on $myident
  .emailaddr $myemail
  h player1
  h player2
  h game
  hadd game gamenumber 0
  h gameoptions
  ls
}
on *:connect:{
  if (%onthefly) var %x = $dll($+(",%onthefly,"),motfv,Sync)
  unset %onthefly
  if ($myqauthnick && $myqauthpass) {
    raw -q privmsg Q@CServe.QuakeNet.org :auth $myqauthnick $myqauthpass
  }
  else { join $slapchan }
}
ctcp ^*:MOTFV:*:{ sendreply VERSION $nick $chan | haltdef }
ctcp ^*:FINGER:*:{ sendreply FINGER $nick $chan | haltdef }
ctcp ^*:PING:*:{ sendreply PING $nick $chan $2- | haltdef }
ctcp ^*:TIME:*:{ sendreply TIME $nick $chan | haltdef }
alias -l sendreply {
  echo $color(CTCP) $iif($3 !isnum,-t $3,$iif($cid == $activecid,-at,-st)) $+([,$2 $+ $iif($3,: $+ #) $1 $+ ]) $iif($timer(ctcpflood $+ $address),(Ignored))
  if (!$timer(ctcpflood $+ $address)) {
    if ($1 == PING) { !.ctcpreply $2 PING $gettok($3-,-1,32) }
    if ($1 == VERSION) { !.ctcpreply $2 VERSION 12www.slapmania.tk - SlapMania v0.96 (beta) © by Sephiroth (12Sephiroth@leech-world.de) }
    .timerctcpflood $+ $address 1 20 $!null
  }
}
on @*:action:slaps*:#:{
  if ($3-6 == around a bit with && # == $slapchan) {
    var %x = $hit($$norm($7-))
    var %damage = $gettok(%x,1,32)
    var %hit = $gettok(%x,2-,32)
    if (($nick == $p1) && ($2 == $p2) && (%x) && ($game) && ($game(cp) == $p1) && (!$timer(spamprot))) {
      .timerresetgame off
      m $p1 slapped $p2 with ' $+ $7- $+ ' and makes a damage of %damage $iif(%hit,so $p1 makes a %hit on $p2)
      hdec player2 hp $remove(%damage,HP)
      m $p2 has now $iif($p2(hp) > 0,$p2(hp),0) Health Points. $health2($iif($p2(hp) > 0,$p2(hp),0),$p2(health))
      hadd game cp $p2
      .timerspamprot 1 5 m $p2 your turn.
      if ($p2(hp) isnum 100-400) && ($r(1,10) == 10) {
        var %x = $iif($r(0,1),100,$iif($r(0,1),150,250))
        hinc player2 hp %x
        if ($p2(hp) > $p2(health)) { hadd player2 hp $p2(health) }
        m $p2 gets healed by me with a $iif(%x == 100,low,$iif(%x == 150,medium,high)) Potion ( $+ %x HP). $p2 has now $p2(hp) $+ HP $health2($p2(hp),$p2(health))
      }
      if ($p2(hp) <= 0) && ($r(1,10) == 10) { hadd player2 hp $hp($p2) | m $p2 gets healed by me with a phoenix dawn. $p2 rises up from the death like phoenix from the ash. $p2 has now full $hp($p2) $+ HP $health2($p2(hp),$p2(health)) }
      elseif ($p2(hp) <= 0) { m $p2 is dead! $p1 is the Winner of this Round! | reset }
    }
    if (($nick == $p2) && ($2 == $p1) && (%x) && ($game) && ($game(cp) == $p2) && (!$timer(spamprot))) {
      .timerresetgame off
      m $p2 slapped $p1 with ' $+ $7- $+ ' and makes a damage of %damage $iif(%hit,so $p2 makes a %hit on $p1)
      hdec player1 hp $remove(%damage,HP)
      m $p1 has now $iif($p1(hp) > 0,$p1(hp),0) Health Points. $health2($iif($p1(hp) > 0,$p1(hp),0),$p1(health))
      hadd game cp $p1
      .timerspamprot 1 5 m $p1 your turn.
      if ($p1(hp) isnum 100-400) && ($r(1,10) == 10) {
        var %x = $iif($r(0,1),100,$iif($r(0,1),150,250))
        hinc player1 hp %x
        if ($p1(hp) > $p1(health)) { hadd player1 hp $p1(health) }
        m $p1 gets healed by me with a $iif(%x == 100,low,$iif(%x == 150,medium,high)) Potion ( $+ %x HP). $p1 has now $p1(hp) $+ HP $health2($iif($p1(hp) > 0,$p1(hp),0),$p1(health))
      }
      if ($p1(hp) <= 0) && ($r(1,10) == 10) { hadd player1 hp $hp($p1) | m $p1 gets healed by me with a phoenix dawn. $p1 rises up from the death like phoenix from the ash. $p1 has now full $hp($p1) $+ HP $health2($iif($p1(hp) > 0,$p1(hp),0),$p1(health)) }
      elseif ($p1(hp) <= 0) { m $p1 is dead! $p2 is the Winner of this Round! | reset }
    }
  }
}
on @*:text:!dvall:#:{ if (# == $slapchan) { mmode # - v } }
on @*:text:!vall:#:{ if (# == $slapchan) { mmode # + v } }
on @*:text:!reset:#:{ if (# == $slapchan) { reset $nick } }
on @*:text:!freeignore:#:{ if (# == $slapchan) { if ($hget(Ignore)) { hfree Ignore } | ls | m Ignore list has been cleared | ls } }
on @*:text:i will slap them:#:{
  if (# == $slapchan) {
    if ($hget(player1,name) !ison #) { hdel player1 name }
    if (!$hget(player1,name)) && (!$istok($hget(ignore,nicks),$nick,32)) {
      hadd player1 name $nick
      m $nick $+ : You are now Player 1 with $hp($p1) Health Points
    }
    elseif (!$hget(player2,name)) && ($nick != $p1) && (!$istok($hget(ignore,nicks),$nick,32)) {
      hadd player2 name $nick
      m $nick $+ : You are now Player 2 with $hp($p2) Health Points
      setgame
    }
    else { .notice $nick Both slots are full,you were a player at the round before or you are currently added as a Player. }
  }
}
on @*:op:#:{
  if ($opnick == $me && # == $slapchan) {
    if ($mytopic) {
      raw -q topic # :
      topic # $mytopic
    }
    mode # -m
  }
}

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/