amap.cfg (2153B)
1 //Advanced Map Manager by Beha 2 //Under CC0 1.0 License <https://creativecommons.org/publicdomain/zero/1.0/> 3 4 //Reset the map lists and preserve other variables 5 amap._versioncfgpreserve = [ 6 servermaster 7 sv_botmalenames sv_botfemalenames 8 sv_botmalevanities sv_botfemalevanities 9 ] 10 looplist i $amap._versioncfgpreserve [ 11 local name 12 name = (format "amap._versioncfgpreserve_%1" $i) 13 alias $name $$i 14 ] 15 exec config/version.cfg 16 looplist i $amap._versioncfgpreserve [ 17 local name 18 name = (format "amap._versioncfgpreserve_%1" $i) 19 $i $$name 20 ] 21 22 //Variables checked 23 //amap.<x> 24 //Other special variables are: disallow, general 25 amap._vars = "main capture defend king bomber hold race duel multi gladiator small medium large" 26 27 //Modes covered under amap.general 28 amap._generalmodes = "main capture defend bomber" 29 30 amap.small = (concat $amap.duel $amap.small) 31 amap.main = (concat $amap.duel $amap.main) 32 looplist i $amap._generalmodes [ 33 local name 34 name = (format "amap.%1" $i) 35 $name = (concat $$name $amap.general) 36 ] 37 38 //Create allowmaps from all other variables. 39 amap.allow = "" 40 looplist i $amap._vars [ 41 amap.allow = (concat $amap.allow $(format "amap.%1" $i)) 42 ] 43 44 //Loop through amap.<x>, assigning to the appropriate sv_ variable while ignoring duplicates. 45 amap._doset = [ 46 local name 47 local svname 48 name = (format "amap.%1" $arg1) 49 svname = (format "sv_%1maps" $arg1) 50 looplist i (getalias $name) [ 51 local val 52 val = $i 53 looplist j $$svname [ 54 if (=s $i $j) [ 55 val = "" 56 ] 57 ] 58 if (!=s $val "") [ 59 $svname (concat $$svname $val) 60 ] 61 ] 62 ] 63 64 //Assign amap variables to server, remove any disallowed maps. 65 looplist i (concat "allow" $amap._vars) [ 66 local svname 67 local tmp 68 amap._doset $i 69 svname = (format "sv_%1maps" $i) 70 tmp = "" 71 looplist j $$svname [ 72 local good 73 good = 1 74 looplist k $amap.disallow [ 75 if (=s $j $k) [ 76 good = 0 77 ] 78 ] 79 if (= $good 1) [ 80 tmp = (concat $tmp $j) 81 ] 82 ] 83 $svname $tmp 84 ]