Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Originally derived from cwdelay.cfg
- defaultvalue "tournament_enabled" 1
- // default 5 seconds delay
- defaultvalue "match_delay" 5
- players = []
- countdown = [
- say ( format "^f1Game will be %1 in ^f6%2 ^f1seconds, prepare yourself!" (? $arg1 "resumed" "started") ($match_delay))
- asleep (* $match_delay 1000) [
- say ( format "^f0GO!" )
- pause 0
- ]
- loop i (- $match_delay 1) [
- asleep (* (+ $i 1) 1000 ) [ say ( format "^f1%1 in ^f6%2 ^f1seconds..." (? $arg1 "Resuming" "Starting") (- @match_delay (+ @i 1) ) ) ]
- ]
- ]
- // check if mastermode 2 enabled and server in team mode
- match_start = [
- if (&& (= $tournament_enabled 1) (isteammode) (>= (getmastermode) 2)) [
- pause 1
- players = ( loopconcat cn $players [ $cn ] )
- (countdown 0)
- echo $players
- ]
- ]
- // Pause game if a player disconnects
- match_pause = [
- if (&& (= $tournament_enabled 1) (= (isinlist $arg1 $players) 0)) = [
- pause 1
- //Find CN and remove it
- i = (indexof $players $arg1)
- players = (listdel $players (at $players $i))
- ]
- ]
- // Start countdown to resume
- match_resume = [
- if (&& (= $tournament_enabled 1) (isteammode) (>= (getmastermode) 2) (= $arg1 1)) [
- players = ( loopconcat cn $players [ $cn ] )
- (countdown 0)
- ]
- ]
- cmd_tournament = [
- if (!=s $arg2 "") [
- tournament_enabled = $arg2
- ]
- pm $arg1 (format "^f1Tournament module is ^f7%1" (? $tournament_enabled "enabled" "disabled" ))
- ]
- addhandler onmapstart match_start
- addhandler ondisconnect match_pause
- addhandler onresume match_resume
- registercommand "tournament" cmd_tournament 2 "|b" "tournament [1|0] ^f1Enable tournament module"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement