Advertisement
Guest User

tournament.cfg

a guest
Oct 25th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. // Originally derived from cwdelay.cfg
  2. defaultvalue "tournament_enabled" 1
  3.  
  4. // default 5 seconds delay
  5. defaultvalue "match_delay" 5
  6.  
  7. players = []
  8.  
  9. countdown = [
  10. say ( format "^f1Game will be %1 in ^f6%2 ^f1seconds, prepare yourself!" (? $arg1 "resumed" "started") ($match_delay))
  11.  
  12. asleep (* $match_delay 1000) [
  13. say ( format "^f0GO!" )
  14. pause 0
  15. ]
  16.  
  17. loop i (- $match_delay 1) [
  18. asleep (* (+ $i 1) 1000 ) [ say ( format "^f1%1 in ^f6%2 ^f1seconds..." (? $arg1 "Resuming" "Starting") (- @match_delay (+ @i 1) ) ) ]
  19. ]
  20. ]
  21.  
  22. // check if mastermode 2 enabled and server in team mode
  23. match_start = [
  24. if (&& (= $tournament_enabled 1) (isteammode) (>= (getmastermode) 2)) [
  25. pause 1
  26. players = ( loopconcat cn $players [ $cn ] )
  27. (countdown 0)
  28.  
  29. echo $players
  30. ]
  31. ]
  32.  
  33. // Pause game if a player disconnects
  34. match_pause = [
  35. if (&& (= $tournament_enabled 1) (= (isinlist $arg1 $players) 0)) = [
  36. pause 1
  37.  
  38. //Find CN and remove it
  39. i = (indexof $players $arg1)
  40. players = (listdel $players (at $players $i))
  41. ]
  42. ]
  43.  
  44. // Start countdown to resume
  45. match_resume = [
  46. if (&& (= $tournament_enabled 1) (isteammode) (>= (getmastermode) 2) (= $arg1 1)) [
  47. players = ( loopconcat cn $players [ $cn ] )
  48. (countdown 0)
  49. ]
  50. ]
  51.  
  52. cmd_tournament = [
  53. if (!=s $arg2 "") [
  54. tournament_enabled = $arg2
  55. ]
  56. pm $arg1 (format "^f1Tournament module is ^f7%1" (? $tournament_enabled "enabled" "disabled" ))
  57. ]
  58.  
  59. addhandler onmapstart match_start
  60. addhandler ondisconnect match_pause
  61. addhandler onresume match_resume
  62. registercommand "tournament" cmd_tournament 2 "|b" "tournament [1|0] ^f1Enable tournament module"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement