Advertisement
RaZgRiZ

tourney.cfg

Oct 25th, 2014
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.16 KB | None | 0 0
  1. // Originally derived from cwdelay.cfg
  2. defaultvalue "tourney_enabled" 1
  3.  
  4. // default 5 seconds delay
  5. defaultvalue "tourney_delay" 5
  6.  
  7. tourney_players = []
  8.  
  9. // have some free client filters! :)
  10. getmaster     = [listfilter i $arg1 [ismaster    $i]]
  11. getadmin      = [listfilter i $arg1 [isadmin     $i]]
  12. getspectator  = [listfilter i $arg1 [isspectator $i]]
  13. getignored    = [listfilter i $arg1 [isignored   $i]]
  14. getbots       = [listfilter i $arg1 [isai        $i]]
  15.  
  16. get!master    = [listfilter i $arg1 [! (ismaster    $i)]]
  17. get!admin     = [listfilter i $arg1 [! (isadmin     $i)]]
  18. get!spectator = [listfilter i $arg1 [! (isspectator $i)]]
  19. get!ignored   = [listfilter i $arg1 [! (isignored   $i)]]
  20. get!bots      = [listfilter i $arg1 [! (isai        $i)]]
  21.  
  22.  
  23.  
  24. tourney_countdown = [
  25.     say "^f1The countdown shall begin shortly, prepare thyself!"
  26.     asleep 3000 [
  27.         say "^f1Tourney" (? $arg1 "resuming" "starting") "in:"
  28.         asleep (* @tourney_delay 1000) [
  29.             say "^f0GO!"
  30.             pause 0
  31.         ]
  32.         loop i @tourney_delay [
  33.             asleep (* $i 1000) [
  34.                 local s ; s = (- @@@tourney_delay @i)
  35.                 say (format "^t^f1:: ^f6%1 ^f1 second%2.." $s (? (!= $s 1) "s"))
  36.             ]
  37.         ]
  38.     ]
  39. ]
  40.  
  41. // check if mastermode 2 enabled and server in team mode
  42. addhandler onmapstart [
  43.     if (&& $tourney_enabled [m_teammode $getmode] [> $getmastermode 1]) [
  44.         pause 1
  45.         tourney_players = (get!spectator (listclients 1))
  46.         tourney_countdown 1
  47.     ]
  48. ]
  49.  
  50. // Pause game if a player disconnects
  51. addhandler ondisconnect [
  52.     if $tourney_enabled [
  53.         if (>= (listfind= $tourney_players $arg1) 0) [
  54.             pause 1
  55.         ]
  56.     ]
  57. ]
  58.  
  59. // Start tourney_countdown to resume
  60. addhandler onresume [
  61.     if (&& $tourney_enabled [m_teammode $getmode] [> $getmastermode 1]) [
  62.         tourney_players = (get!spectator (listclients 1))
  63.         tourney_countdown 0
  64.     ]
  65. ]
  66.  
  67. registercommand "tourney" [
  68.     if (> $numargs 1) [ tourney_enabled = $arg2 ]
  69.     pm $arg1 (format "^f1Tourney module is ^f7%1abled" (? $tourney_enabled "en" "dis" ))
  70. ] 2 "|b" "tourney [1|0] ^f1Enable tourney module"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement