// ---------------------------------------------------- // ClanWar Tool, v2.0 // (C) Chaos, ZLIB license // http://www.opensource.org/licenses/zlib-license.php // ---------------------------------------------------- // Special Thanks: RaZgRiZ for his support in constructing and optimizing many of the 'Miscellaneous Functions'. // Key Bind: bind "M" [ showgui cw ] // ---------- // Defaults: createine = [ if (=s (getalias $arg1) "") [ $arg1 = $arg2 ] ] createine cw_clan1 "TAG-1" createine cw_clan2 "TAG-2" createine cw_mode "CW-mode" createine cw_map "CW-map" createine cw_nonauto 0 // ---------- // Miscellaneous Functions: cw_listtake = [ newlist = ""; loop cwlt $arg2 [ newlist = (concat $newlist (at $arg1 $cwlt)) ] result $newlist ] cw_specall = [ looplist cwsp (listclients 1) [ spectator 1 $cwsp ] ] cw_changeteam = [ if (= (getclientnum) $arg1) [ team $arg2 ] [ setteam $arg1 $arg2 ] ] cw_ismember = [ result (> (strstr (getclientname $arg1) $arg2) -1) ] cw_append = [ $arg1 = (concat (getalias $arg1) $arg2) ] cw_isrepeat = [ result (&& (cw_ismember $arg1 $arg2) (cw_ismember $arg1 $arg3)) ] cw_existsrepeat = [ result (>= (listfind i (listclients 1) [ (cw_isrepeat $i $arg1 $arg2) ])) ] cw_clantotal = [ temp = ""; looplist c (listclients 1) [ if (cw_ismember $c $arg1) [ cw_append temp (? $arg3 (? (isspectator @c) "" @c) @c) ] ] result (? $arg2 (listlen $temp) $temp) ] cw_playerset = [ maxteams = (min (cw_clantotal $arg1 1 0) (cw_clantotal $arg2 1 0)); looplist cwps1 (cw_listtake (cw_clantotal $arg1 0 0) $maxteams) [ sleep 750 [ spectator 0 @cwps1; cw_changeteam @cwps1 "good" ] ]; looplist cwps2 (cw_listtake (cw_clantotal $arg2 0 0) $maxteams) [ sleep 1500 [ spectator 0 @cwps2; cw_changeteam @cwps2 "evil" ] ]; ] cw_manual = [ looplist cwm1 (cw_clantotal $arg1 0 0) [ sleep 750 [ if (getalias (concatword "cw_1cn" @cwm1)) [ spectator 0 @@cwm1; cw_changeteam @@cwm1 "good" ] ] ]; looplist cwm2 (cw_clantotal $arg2 0 0) [ sleep 1500 [ if (getalias (concatword "cw_2cn" @cwm2)) [ spectator 0 @@cwm2; cw_changeteam @@cwm2 "evil" ] ] ]; ] cw_ismodevalid = [ result (m_teammode (indexof $modenames $arg1)) ] cw_privcol = [ cond (isadmin $arg1) [ result "^f6" ] (ismaster $arg1) [ result "^f0" ] [ result "^f7" ] ] cw_cncol = [ cond (isai $arg1) [ result (concatword " ^f5[" $arg1 "]") ] (>= (listfind i (listdel (listclients 1) $arg1) [ (=s (getclientname $arg1) (getclientname $i)) ])) [ result (concatword " ^f5(" $arg1 ")") ] ] cw_start = [ mastermode 2; cw_specall; if (! (m_teammode (getmode))) [ instateam turbine ]; if $cw_nonauto [ cw_manual $cw_clan1 $cw_clan2 ] [ cw_playerset $cw_clan1 $cw_clan2 ]; sleep 3000 [ $cw_mode $cw_map ]; ] // ---------- // GUI Menu: newgui cw [ guistayopen [ guititle "ClanWar Tool" guibar guilist [ guilist [ guilist [ guilist [ guitext "^f2Clan 1" 0 guitext "^f2Clan 2" 0 guibar guitext "^f2Mode" 0 guitext "^f2Map" 0 guibar guitext "^f2Select" 0 ] guibar guilist [ guifield cw_clan1 15 guifield cw_clan2 15 guibar guifield cw_mode 15 [ createine cw_mode "CW-mode" ] guifield cw_map 15 [ createine cw_map "CW-map" ] guibar guibutton (format "%1Auto ^f~/ %2Manual" (? $cw_nonauto "^f4") (? (! $cw_nonauto) "^f4")) [ cw_nonauto = (! $cw_nonauto) ] 0 ] ] guibar guialign 0 [ guibutton (concatword (? (cw_checkgbconds) "^f0" "^f4") "Start ClanWar") [ cw_cwgb ] 0 ] ] guibar guilist [ guitext (format "^f2%1 Members" $cw_clan1) 0 guibar if (cw_clantotal $cw_clan1 1 0) [ looplist i (cw_clantotal $cw_clan1 0 0) [ if $cw_nonauto [ guicheckbox (concatword (cw_privcol $i) (getclientname $i) (cw_cncol $i)) (concatword "cw_1cn" $i) 1 0 [ cw_checkgbcn @i (concatword "cw_2cn" @i) ] ] [ guitext (concatword (? (cw_isrepeat $i $cw_clan1 $cw_clan2) "^f3" (cw_privcol $i)) (getclientname $i) (cw_cncol $i)) 0 ] ] ] [ guialign 0 [ guitext "^f4No Members" 0 ] ] ] guistrut 1 guilist [ guitext (format "^f2%1 Members" $cw_clan2) 0 guibar if (cw_clantotal $cw_clan2 1 0) [ looplist i (cw_clantotal $cw_clan2 0 0) [ if $cw_nonauto [ guicheckbox (concatword (cw_privcol $i) (getclientname $i) (cw_cncol $i)) (concatword "cw_2cn" $i) 1 0 [ cw_checkgbcn @i (concatword "cw_1cn" @i) ] ] [ guitext (concatword (? (cw_isrepeat $i $cw_clan1 $cw_clan2) "^f3" (cw_privcol $i)) (getclientname $i) (cw_cncol $i)) 0 ] ] ] [ guialign 0 [ guitext "^f4No Members" 0 ] ] ] ] guitab "Help" guititle "Script Help" guibar guislider cw_infoid 1 7 guibar guialign 0 [ guibar guitextbox (cw_info $cw_infoid) 40 guibar ] ] ] "ClanWar" // ---------- // GUI Functions: cw_checkgbconds = [ result (&& (cw_ismodevalid $cw_mode) (ismaster (getclientnum)) (cw_clantotal $cw_clan1 1 0) (cw_clantotal $cw_clan2 1 0) (|| (! (cw_existsrepeat $cw_clan1 $cw_clan2)) $cw_nonauto)) ] cw_cwgb = [ case 0 (cw_ismodevalid $cw_mode) [ echo "^f3ERROR:^f~ Invalid mode input." ] (ismaster (getclientnum)) [ echo "^f3ERROR:^f~ You lack sufficient privileges to start a clanwar, claim either master or admin before retrying." ] (&& (cw_clantotal $cw_clan1 1 0) (cw_clantotal $cw_clan2 1 0)) [ echo "^f3ERROR:^f~ At least one of the inputed clans is empty." ] (|| (! (cw_existsrepeat $cw_clan1 $cw_clan2)) $cw_nonauto) [ echo "^f3ERROR:^f~ There is at least one client that is a member of both clans, retry using manual selection." ] [ echo "^f7Starting ClanWar..."; cleargui; cw_start ] ] cw_checkgbcn = [ if (&& (getalias (concatword "cw_1cn" $arg1)) (getalias (concatword "cw_2cn" $arg1))) [ $arg2 = 0 ] ] cw_info = [ case $arg1 1 [ result "If Auto-Select is on, the script will automatically deploy the largest possible teams such that the game will remain balanced, the order in which players are placed into the game depends on their client number." ] 2 [ result "If Auto-Select is off, you will have the ability to choose the players that will be placed into the game upon starting a clanwar." ] 3 [ result "Be sure to have the correct mode abbreviation before starting a clanwar; for example Efficiency CTF would simply be inputed as 'efficctf'." ] 4 [ result "Note that after starting a clanwar, 'Clan1' will always be on team 'good' and 'Clan2' on team 'evil'. Also, make sure that there are no clients that are members of both clans (highlighted red) prior to starting a clanwar; if there are, you can switch to manual selection." ] 5 [ result "You will receive an error message if you attempt to start a clanwar without either master or admin privileges. You will also receive one if at least one of the clans is empty or if there is a client that is a member of both clans." ] 6 [ result "If all of the necessary conditions are satisfied, the 'Start ClanWar' button will appear green; it will appear gray otherwise." ] 7 [ result "ClanWar Tool, v1.7^n^(C) Chaos, ZLIB license^n^http://www.opensource.org/licenses/zlib-license.php" ] ] cw_infoid = 1 // ----------