1// CubeScript placed in this file is automatically executed on each startup. 2 3persistidents 0 4 5const MODES [tdm coop dm surv ts ctf pf btdm bdm lss osok tosok bosok htf tktf ktf tpf tlss bpf blss bts btosok] 6const MODEALIASES [map lms vip sendmap] 7 8// "editent" command: 9// This command collects all the attributes of the nearest entity, and then 10// prompts that into a handy command that allows you to edit that entities 11// attributes easily. 12// Note: The editent command can NOT define rotation/yaw inside the command! 13// However, the current yaw of the player will define the rotation/yaw when 14// using the command! 15const editent [ 16 if $editing [ 17 if (strcmp (getenttype) mapmodel) [ saycommand "/entset" (getenttype) (getentattr 1) (getentattr 2) (getentattr 3) ] [ 18 if (> (findlist [light sound clip plclip] (getenttype)) -1) [ 19 saycommand "/entset" (getenttype) (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3) 20 ] [ 21 saycommand "/entset" (getenttype) (getentattr ((> (findlist [playerstart ctf-flag] (getenttype)) -1))) 22 ] 23 ] 24 ] 25] 26 27// "convertclips" command: 28// This command automatically changes the a "clip" to a "plclip" entity or vice-versa. 29const convertclips [ 30 if $editing [ 31 if (strcmp (getenttype) clip) [ entset plclip (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3) ] [ 32 if (strcmp (getenttype) plclip) [ entset clip (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3) ] [ 33 echo No changes made. This entity isn't a clip or a plclip.; echo Try using the /closestenttype command to find a specific entity. 34 ] 35 ] 36 ] 37] 38 39// "gibsgore" command: 40// This command controls gib Speed/Number/TTL all in one variable. 41const gibsgore [ 42 if (= $arg1 4) [ // Unrealistic 43 gib 1; gibspeed 40; gibnum 100; gibttl 2500 // Turn TTL down to minimise lag... 44 __gibsgore = 4 45 ] [ 46 if (= $arg1 3) [ // Messy 47 gib 1; gibspeed 15; gibnum 65; gibttl 10000 48 __gibsgore = 3 49 ] [ 50 if (= $arg1 2) [ // Good 51 gib 1; gibspeed 30; gibnum 75; gibttl 5000 52 __gibsgore = 2 53 ] [ 54 if (= $arg1 1) [ // Normal 55 gib 1; gibspeed 30; gibnum 6; gibttl 5000 56 __gibsgore = 1 57 ] [ 58 if (= $arg1 0) [ // Off 59 gib 0 60 __gibsgore = 0 61 ] 62 ] 63 ] 64 ] 65 ] 66] 67 68// "fullscreenscript" command: 69// This command allows swapping of fullscreen mode to be bound to a key. 70const fullscreenscript [ fullscreen (! $fullscreen) ] 71const editmapmsg [ saycommand (concat "/mapmsg" (addpunct (getmapmsg))) ] 72const return [ result $arg1 ] 73const run [ exec (concatword config/ $arg1 .cfg) ] 74 75// Auto-completions 76const mapcomplete [complete $arg1 "packages/maps/official packages/maps" cgz] 77loop i (listlen (concat $MODES $MODEALIASES)) [ mapcomplete (at (concat $MODES $MODEALIASES) $i) ] 78complete demo demos dmo 79const entcomplete [ listcomplete $arg1 [light playerstart pistol ammobox grenades health armour akimbo mapmodel ladder ctf-flag sound clip plclip helmet] ] 80entcomplete newent; entcomplete clearents; entcomplete closestenttype 81 82// TODO:FIXME change all occurrence of SPECT(ator) to GHOST 83listcomplete team [CLA RVSF CLA-SPECT RVSF-SPECT SPECTATOR] 84 85// Game mode descriptions... 86gamemodedesc 0 [Team Deathmatch: Shred the enemy team to pieces!] 87gamemodedesc 1 [Co-operative edit: Edit maps with others online!] 88gamemodedesc 2 [Deathmatch: Destroy anything that moves! Everyone for themselves!] 89gamemodedesc 3 [Survivor: Conserve you precious life, destroy the enemy's. Once all your enemies are dead, the round restarts.] 90gamemodedesc 4 [Team Survivor: Conserve you precious life, destroy the enemy team. Once all your enemies are dead, the round restarts.] 91gamemodedesc 5 [Capture the Flag: Steal the enemy teams flag and bring it to your home base. Don't let your own flag get stolen.] 92gamemodedesc 6 [Pistol Frenzy: Can you make your enemy eat lead with the most simplest of weapons?] 93gamemodedesc 7 [Bot Team Deathmatch: Find the enemy A.I. and destroy them!] 94gamemodedesc 8 [Bot Deathmatch: It's every man and A.I. for themselves! Dismantle those bots! ] 95gamemodedesc 9 [Last Swiss Standing: Knive and bomb the enemy!] 96gamemodedesc 10 [One Shot, One Kill: You and your opponents start with 1hp, a sniper rifle, a knife and no pickups. Survive with your sniper, or humiliate with your swiss steel.] 97gamemodedesc 11 [Team One Shot, One Kill: Your team starts with 1hp, a sniper rifle, a knife and no pickups. Survive with your sniper, or humiliate with your swiss steel.] 98gamemodedesc 12 [Bot One-Shot, One Kill: You and the bots start with 1hp, a sniper rifle, a knife and no pickups. Survive with your sniper, or humiliate with your swiss steel.] 99gamemodedesc 13 [Hunt the Flag: Find the enemy flag, frag the flag bearer and collect the flag to score. Protect your own team flag. If the flag bearer collects the enemy flag, they gain a 1 point bonus.] 100gamemodedesc 14 [Team Keep the Flag: There is only one flag. Get the flag and keep it. You score one point every 15 seconds. If your teammate has the flag, protect him. If the flag bearer collects the enemy flag, they gain a 1 point bonus.] 101gamemodedesc 15 [Keep the Flag: Get the flag and keep it. You score one point every 15 seconds. Everybody else will want to destroy you!] 102gamemodedesc 16 [Team Pistol Frenzy: Can you make your enemy team eat lead with the most simplest of weapons?] 103gamemodedesc 17 [Team Last Swiss Standing: Knive and bomb the enemy team!] 104gamemodedesc 18 [Bot Pistol Frenzy: Can you make the enemy A.I. eat lead with the most simplest of weapons?] 105gamemodedesc 19 [Bot Last Swiss Standing: Knive and bomb the enemy A.I!] 106 107const resetbinds [ run resetbinds; echo (c 3)All binds have been reset to default values! ] 108 109const changeteam [ if (< (player1 team) 4) [ team (at [RVSF CLA RVSF-SPECT CLA-SPECT] (player1 team)) ] ] 110 111const WEAPONS [KNIFE PISTOL CARBINE SHOTGUN SMG SNIPER AR CPISTOL GRENADES AKIMBO] 112const NUM_WEAPONS (listlen $WEAPONS) 113const NUM_MODES (listlen $MODES) 114const PUNCTUATION "QUOTES BRACKETS PARENTHESIS _$_ QUOTE PERCENT" 115const MAX_CLIENTS 16 116const MAX_BOT_MATCH_LENGTH 60 117const MAX_ARGS 24 118const ENT_NUM_ATTRS 4 119 120loop g (listlen $PUNCTUATION) [ const (at $PUNCTUATION $g) $g ] 121// echo (addpunct "hello world" $PARENTHESIS) - output: (hello world) 122// echo (addpunct "hello world" $BRACKETS) - output: [hello world] 123 124loop d $NUM_WEAPONS [ const (at $WEAPONS $d) $d ] 125 126loop r $NUM_MODES [ const (at $MODES $r) (format [votemap %1 %2 %3] $r "$arg1" "$arg2") ] 127 128const modenum [ result (findlist $MODES $arg1) ] 129 130// Mode/map-setting aliases. 131const votemap [ mode $arg1; map $arg2 $arg3 ] 132 133const lms [ surv $arg1 $arg2 ] 134const vip [ htf $arg1 $arg2 ] 135 136// Helper aliases for (c) - easy color insertion. (e.g. echo (red)Hello (blue)world! (white)My fov today is: (orange) $fov) 137loop k 10 [ const (at [green blue yellow red gray white dbrown dred purple orange] $k) (format [if (= $arg1 -1) [ result %1 ] [ result %2 ]] $k (addpunct (concat c $k) 2)) ] 138// echo (blue -1) - returns 1 139// echo (purple -1) - returns 8 140 141const add2alias [ 142 if (strcmp [] (getalias $arg1)) [ $arg1 = $arg2 ] [ 143 $arg1 = (concat (concatword (getalias $arg1) [;]) $arg2) 144 ] 145] 146const addOnLoadOnce [ add2alias mapstartonce $arg1 ] 147const addOnLoadAlways [ add2alias mapstartalways $arg1 ] 148const addOnQuit [ add2alias onQuit $arg1 ] 149const check2init [ if (! (checkalias $arg1)) [ $arg1 = $arg2 ] ] // only overwrites an alias if it doesn't exist 150const check2initlist [ loop cll (listlen $arg1) [ check2init (at $arg1 $cll) $arg2 ] ] // check2inits multiple aliases 151const forceinit [ loop fil (listlen $arg1) [ (at $arg1 $fil) = $arg2 ] ] // forcibly overwrites multiple aliases 152const checkinit [ if (! (checkalias $arg1)) [ $arg1 = "" ]; if (> $numargs 1) [ if (! (strstr (getalias $arg1) $arg2)) [ add2alias $arg1 $arg2 ] ] ] // ensures the initialization of an alias, optionally ensures the alias contains string $arg2 153const aliasinit [ loop ail (listlen $arg1) [ checkinit (at $arg1 $ail) $arg2 ] ] // checkinits multiple aliases 154const add2list [ if (strcmp [] (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat (getalias $arg1) $arg2) ] ] // works exactly like concat, use as a shortcut to: alias = (concat $alias "some string") 155const add2bind [ if (! (strstr (keybind $arg1) $arg2)) [ bind $arg1 (format [%1; %2] (keybind $arg1) $arg2) ] ] // works exactly like add2alias except for used with keybinds 156 157// Weapon switching/action utilities. 158const hasprimary [ result (= (curweapon) (currentprimary)) ] 159const primary [ weapon (currentprimary) ] 160const ptoggle [ if (hasprimary) $arg1 primary ] // Toggle between primary/specified weapon 161const secondary [ weapon $PISTOL ] 162const sndtoggle [ ptoggle secondary ] 163const melee [ weapon $KNIFE ] 164const knftoggle [ ptoggle melee ] 165const grenades [ weapon $GRENADES ] 166const gndtoggle [ ptoggle grenades ] 167 168const altaction [ (concatword altaction_ (curweapon)) ] 169 170const checkmag [ result (|| (magcontent $arg1) (magreserve $arg1)) ] 171const checkrange [ result (&& (>=f $arg1 $arg2) (<=f $arg1 $arg3)) ] 172 173const quicknadethrow_old [ 174 if (> (magcontent $GRENADES) 0) [ 175 if (!= (curweapon) $CPISTOL) grenades 176 attack 177 ] 178 // onrelease [ sleep 1 [ if (= (curweapon) $CPISTOL) [ weapon (prevweapon) ] ] ] 179] 180 181loop i $NUM_WEAPONS [ (concatword altaction_ $i) = quicknadethrow ] // Quick nade throw is default 182// Use format to define altaction_N aliases from now on, makes for less edits in the future if weapon IDs change. - Bukz 183// (format altaction_%1 $KNIFE) = [ if (checkmag (currentprimary)) primary [ if (|| (checkmag $PISTOL) (checkmag $AKIMBO)) secondary [ if (checkmag $GRENADES) grenades ] ] ] // Knife // uncomment to switch to primary/secondary/grenades with MOUSE2 depending on ammo content for each. 184(format altaction_%1 $SNIPER) = [ setscope 1; onrelease [ setscope 0 ] ] // Sniper 185// (format altaction_%1 $CPISTOL) = [ setburst 1; onrelease [ setburst 0 ] ] // Combat pistol // TODO uncomment when this becomes a priority/testing, for now lets save an unused alias - Bukz 186// (format altaction_%1 $GRENADES) = attack // Grenade // with this comment, you throw the nade and the nade is unselected : Brahma 187 188oldsens = $sensitivity 189 190const zoom [ 191 if (= $arg1 1) [ 192 if (! (=f $sensitivity (scopesens))) [ 193 oldsens = $sensitivity 194 // avoid error if using 0.001 as sensitivity 195 newsens = (scopesens) 196 if (> (*f 1 1000) $newsens) [ if (< 1000 $newsens) [ sensitivity (scopesens) ] ] 197 setscope 1 198 ] 199 ] [ sensitivity $oldsens; setscope 0 ] 200] 201 202delta_game_0 = [ if (= $arg1 1) [ shiftweapon 1 ] [ shiftweapon -1 ] ] // Cycle through weapons 203delta_game_1 = [ if (checkrange (+ $gamma $arg1) 30 300) [ gamma (+ $gamma $arg1) ] ] // Tweak gamma 204delta_game_2 = [ if (checkrange (+ $fov $arg1) 75 120) [ fov (+ $fov $arg1) ] ] // Tweak fov 205delta_spect_0 = [ changefollowplayer $arg1 ] 206 207// Map editing using the mousewheel... 208modifier = 0 209const domodifier [ modifier = $arg1; onrelease [ modifier = 0 ] ] 210 211const universaldelta [ 212 if $editing [ s = edit ] [ 213 if (player1 alive) [ s = game ] [ s = spect ] 214 ] 215 (concatword delta _ $s _ $modifier) 216] 217// To utilize the below, you will need to bind "domodifier X" 218// (replace X with the number of the delta_edit) to a key. To 219// use them, simply hold the key that the "domodifier" is bound 220// to and then scroll backwards/forwards while looking at the 221// floor/ceiling. 222delta_edit_0 = [ editheight $flrceil $arg1 ] // Move cubes... 223delta_edit_1 = [ if $flrceil [ vdelta $arg1 ] [ vdelta (- 0 $arg1) ] ] // Change heightfielding... 224delta_edit_2 = [ edittex $flrceil $arg1 ] // Change floor/ceiling textures... 225delta_edit_3 = [ edittex (+ $flrceil 1) $arg1 ] // Change wall/upper-wall textures... 226delta_edit_4 = [ equalize $flrceil ] // Equalize floor/ceiling... 227delta_edit_5 = [ entproperty 0 $arg1 ] // Changes the first value on entities... 228delta_edit_6 = [ entproperty $editaxis $arg1 ] // Move map entity... 229delta_edit_7 = [ entproperty 1 $arg1 ] // Changes the second value on entities... 230delta_edit_8 = [ entproperty 2 $arg1 ] // Changes the third value on entities... 231delta_edit_9 = [ entproperty 3 $arg1 ] // Changes the fourth value on entities... 232delta_edit_10 = [ if (checkrange (+f $flyspeed (divf $arg1 4)) 1 5) [ flyspeed (+f $flyspeed (divf $arg1 4)); echo $flyspeed ] ] // Tweak flyspeed 233delta_edit_11 = [ if (> $arg1 0) [ expandselection 1 ] [ shrinkselection 1 ] ] // Expand/shrink the current selection 234 235// HUD toggles 236const toggleshowmap [ showmap 1; onrelease [ showmap 0 ] ] 237 238// convenient connecting from the serverbrowser 239// sbconnect arg list: 240// arg1 IP, arg2 port, 241// arg3 1: server full 242// arg4 1: password protected 243// arg5 1: private mode, 2: match mode 244// arg6 1: banned, 2: blacklisted 3: both 245// arg7 "server description" 246// TODO: interpret a#3,4,5,6 [ft:any1:2010apr04] 247 248forceinit [sbdns sbport sbdesc sbmsg sbpwd] [] 249const sbconnect [ 250 sbdns = $arg1; sbport = $arg2; sbdesc = $arg7; forceinit [sbpwd sbmsg] [] 251 if (>= $arg5 1) [ 252 sbmsg = [This server is set to private.]; showmenu [password required] 253 ] [ 254 if (>= $arg6 1) [ 255 sbmsg = [You are banned from this server.]; showmenu [password required] 256 ] [ 257 if (= $arg4 1) [ 258 sbmsg = [This server is password-protected.]; showmenu [password required] 259 ] [ 260 echo connecting to $arg7; connect $arg1 $arg2; 261 ] 262 ] 263 ] 264] 265 266// answer last PM 267const quickanswer [ if (>= $lastpm 0) [ saycommand (concat /pm $lastpm []) ] [ saycommand (concat /pm []) ] ] 268 269// For those players who use IRC too much... 270const join [ connect $arg1 $arg2 $arg3 ] 271const reconnect [ if $numargs [ svpass = $arg1 ] [ svpass = [] ]; if $connected [ svdata = (curserver); afterdisconnect [ connect (at $svdata 0) (at $svdata 1) $svpass ] ] ] 272const dlmap [ getmap $arg1 [ sleep 2500 (concat map $arg1) ] ] 273const rndmap [ result (at $defaultmaps (rnd (listlen $defaultmaps))) ] 274const rrnd [ + (rnd (- $arg2 $arg1)) $arg1 ] 275const ++ [ if (checkalias $arg1) [ += $arg1 1 ] ] 276const -- [ if (checkalias $arg1) [ -= $arg1 1 ] ] 277const ++f [ if (checkalias $arg1) [ +=f $arg1 1 ] ] 278const --f [ if (checkalias $arg1) [ -=f $arg1 1 ] ] 279const listaverage [ if (listlen $arg1) [ tmp_sum = 0; loop gsl (listlen $arg1) [ +=f tmp_sum (at $arg1 $gsl) ]; result (divf $tmp_sum (listlen $arg1)) ] ] 280 281forceinit [cp_entbuf cp_entstr] NULL 282const get_ent_attrs [ cp_entbuf = (getenttype); loop gea $ENT_NUM_ATTRS [ add2list cp_entbuf (getentattr $gea) ] ] 283 284const copyent [ 285 if $editing [ 286 get_ent_attrs 287 cp_entstr = (concatword (orange) "(" (at $cp_entbuf 0) [ ] (at $cp_entbuf 1) [ ] (at $cp_entbuf 2) [ ] (at $cp_entbuf 3) [ ] (at $cp_entbuf 4) ")" (white)) // Output (a string): (enttype param1 param2 param3 param4) 288 echo (blue)Note: (white)The current closest entity: $cp_entstr - has been copied. 289 ] 290] 291 292const pasteent [ 293 if $editing [ 294 if (strcmp (at $cp_entbuf 0) mapmodel) [ 295 newent (at $cp_entbuf 0) (at $cp_entbuf 2) (at $cp_entbuf 3) (at $cp_entbuf 4) 296 ] [ 297 newent (at $cp_entbuf 0) (at $cp_entbuf 1) (at $cp_entbuf 2) (at $cp_entbuf 3) (at $cp_entbuf 4) 298 ] 299 echo (blue)Note: (white)The previously copied entity: $cp_entstr - has been pasted. 300 ] 301] 302 303// genhex - Randomly generates a valid hexadecimal color value (e.g. 0x2FCAF1) - useful for finding fogcolours. 304const genhex [ 305 tmp_hex = 0x 306 loop ghl 6 [ 307 if (rnd 2) [ tmp_hex = (concatword $tmp_hex (rnd 10)) ] [ tmp_hex = (concatword $tmp_hex (at [A B C D E F] (rnd 6))) ] 308 ] 309 echo (red)Trying hexadecimal color: (white) $tmp_hex 310 result $tmp_hex 311] 312 313// genwc - Randomly generates a valid watercolour value (e.g. 2 17 29) - useful for finding watercolours. 314const genwc [ 315 if $editing [ 316 tmp_wc = [] 317 loop gwl 3 [ add2list tmp_wc (rrnd 1 256) ] 318 echo (red)Trying water color: (white) $tmp_wc 319 watercolour (at $tmp_wc 0) (at $tmp_wc 1) (at $tmp_wc 2) 320 ] 321] 322 323// gencl - Randomly generates a valid coloured light. 324const gencl [ 325 if $editing [ 326 tmp_numargs = $numargs; tmp_cl = [] 327 loop gcl 3 [ add2list tmp_cl (rrnd 1 256) ] 328 if $tmp_numargs [ 329 if (|| (!= (selx) 0) (!= (sely) 0)) [ 330 echo (red)Trying colored light: (white) $arg1 (at $tmp_cl 0) (at $tmp_cl 1) (at $tmp_cl 2) 331 newent light $arg1 (at $tmp_cl 0) (at $tmp_cl 1) (at $tmp_cl 2) 332 ] [ echo (red)Error: (white)If an argument "(radius)" is given for (concatword (blue) gencl (red) ,) you must select a cube first. ] 333 ] [ 334 if (strcmp (getenttype) light) [ 335 echo (red)Trying colored light: (white) (getentattr 0) (at $tmp_cl 0) (at $tmp_cl 1) (at $tmp_cl 2) 336 entset light (getentattr 0) (at $tmp_cl 0) (at $tmp_cl 1) (at $tmp_cl 2) 337 ] [ echo (red)Error: (white)The current closest entity: (orange) (getenttype) (white)is not a light. ] 338 ] 339 ] [ echo (red)Error: (white)You must be in edit mode for (blue)gencl (white)to function. ] 340] 341 342// /expandselection 1 // makes the current selection bigger by 1 cube on all sides 343const expandselection [ 344 if $numargs [ 345 et1 = $arg1 346 if (> $et1 0) [ 347 ep1 = (selx) 348 ep2 = (sely) 349 eps1 = (selxs) 350 eps2 = (selys) 351 select (- $ep1 $et1) (- $ep2 $et1) (+ $eps1 (* $et1 2)) (+ $eps2 (* $et1 2)) 352 result 1 353 ] [ result 0 ] 354 ] [ result 0 ] 355] 356 357// /shrinkselection 1 // makes the current selection smaller by 1 cube on all sides 358const shrinkselection [ 359 if $numargs [ 360 st1 = $arg1 361 if (> $st1 0) [ 362 sp1 = (selx) 363 sp2 = (sely) 364 sps1 = (selxs) 365 sps2 = (selys) 366 sps1 = (- $sps1 (* $st1 2)) 367 sps2 = (- $sps2 (* $st1 2)) 368 if (&& (> $sps1 0) (> $sps2 0)) [ 369 select (+ $sp1 $st1) (+ $sp2 $st1) $sps1 $sps2 370 result 1 371 ] [ result 0 ] 372 ] [ result 0 ] 373 ] [ result 0 ] 374] 375 376// megabind - Binds a key to many different actions depending on the current game state. 377const megabind [ if (> $numargs 5) [ bind $arg1 (format "if (watchingdemo) [ %1 ] [ if (|| $editing (= $gamemode 1)) [ %2 ] [ if $connected [ %3 ] [ if (curmodeattr bot) [ %4 ] [ %5 ] ] ] ]" $arg2 $arg3 $arg4 $arg5 $arg6) ] ] 378 379// storesets - Generates an alias (list) of the current values for the given CVARs. 380const storesets [ 381 if (> $numargs 1) [ 382 badargs = 0; $arg2 = [] 383 loop ssl (listlen $arg1) [ 384 if (isIdent (at $arg1 $ssl)) [ 385 add2list $arg2 (getalias (at $arg1 $ssl)) 386 ] [ badargs = 1; break ] 387 ] 388 if $badargs [ delalias $arg2; echo (red)Error: (white)Bad "argument(s)" given! ] 389 ] 390] 391 392// makeshift "?" operator for cubescript 393// ex: /? (> $maxroll 0) [voicecom negative D:] [voicecom yes :D] 394// /echo I am (? (>= (player1 health) 50) [result healthy] [result weak]) atm 395? = [ 396 if (> $numargs 1) [ 397 if (> $numargs 2) [ 398 if $arg1 $arg2 $arg3 399 ] [ 400 if $arg1 $arg2 401 ] 402 ] 403] 404 405// switch - Takes an integer argument to determine which block of code to execute. 406// NOTE: This command can only handle up to 23 "cases" (24 arguments). 407switch = [ 408 if (&& (<= $numargs $MAX_ARGS) (checkrange $arg1 0 (- $MAX_ARGS 2))) [ 409 execute (getalias (format arg%1 (+ $arg1 2))) 410 ] 411] 412 413// cleanshot - Take a "clean" screenshot with no HUD items. 414const cs_sets [clockdisplay crosshairsize hidecompass hideconsole hidectfhud hidedamageindicator hidehudequipment hidehudmsgs hideradar hidespecthud hideteam hidevote hudgun specthudgun showstats showtargetname showgrid showclips accuracy] 415const cs_newsets [0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0] 416 417const disablehud [ storesets $cs_sets tmp_old_sets; loop csl (listlen $cs_sets) [ (at $cs_sets $csl) (at $cs_newsets $csl) ]; if $editing [ seteditshow 0 ] ] 418const enablehud [ if (checkalias tmp_old_sets) [ loop ros (listlen $cs_sets) [ (at $cs_sets $ros) (at $tmp_old_sets $ros) ]; if $editing seteditshow ] ] 419const cleanshot [ disablehud; sleep 200 screenshot; sleep 500 enablehud ] 420 421// highestcn - Returns the highest valid client number available. 422const highestcn [ 423 hcn = -1 424 if $connected [ nl = (+ $MAX_CLIENTS 1) ] [ if (curmodeattr bot) [ nl = 100 ] [ nl = 1 ] ] 425 loop h $nl [ 426 if (isclient $h) [ hcn = $h ] 427 ] 428 result $hcn 429] 430 431// convertcase - Zap lists of strings to lower/uppercase. 432const convertcase [ 433 if (> $numargs 1) [ 434 tmpCCO = [] 435 loop ccl $numargs [ if (> $ccl 0) [ tmpCCO = (concatword $tmpCCO [ ] (getalias (format arg%1 (+ $ccl 2)))) ] [ tmpCCO = (concatword $tmpCCO $arg2) ] ] 436 if (!= $arg1 0) [ result (toupper $tmpCCO) ] [ result (tolower $tmpCCO) ] 437 ] 438] 439 440ingall = 0 441const ignoreall [ if $connected [ ingall = 1; loop ia (+ (highestcn) 1) [ ignore $ia ]; echo (blue)NOTE: (white)All clients currently on the server were ignored. ] ] 442const unignoreall [ if $connected [ ingall = 0; clearignored -1; echo (blue)NOTE: (white)All clients currently on the server were unignored. ] ] 443const ignoreteam [ 444 if (curmodeattr team) [ 445 _arg1 = (toupper $arg1) 446 if (|| (strcmp $_arg1 CLA) (strcmp $_arg1 RVSF)) [ 447 loop itl (+ (highestcn) 1) [ 448 if (isclient $itl) [ 449 if (= (player $itl team) (at [0 1] (strcmp $_arg1 RVSF))) [ ignore $itl ] 450 ] 451 ] 452 ] [ 453 if (checkrange $_arg1 0 1) [ 454 loop itl (+ (highestcn) 1) [ 455 if (isclient $itl) [ 456 if (= (player $itl team) $_arg1) [ ignore $itl ] 457 ] 458 ] 459 ] 460 ] 461 ] ignoreall 462] 463const ignoreenemy [ ignoreteam (at [0 1] (! (player1 team))) ] 464 465// Simple claim-admin script for one single-server. 466// Fill in the 3 aliases below, and uncomment the below line to activate. 467// bind F3 "customclaimadminscript" 468_CAS_serverip = "IP ADDRESS" 469_CAS_serverpass = "PASSWORD" 470_CAS_servername = "SERVER NAME" 471const customclaimadminscript [ 472 if (strcmp (curserver 1) $_CAS_serverip) [ 473 if (! (player1 role)) [ setadmin 1 $_CAS_serverpass ] [ setadmin 0 ] 474 ] [ echo (red)Error: (white)you're not connected to $_CAS_servername servers ] 475] 476 477// Execute other .cfgs/scripts. 478run on_quit 479run parsestring 480run dyngamma 481run survival 482run autosave 483run faq 484 485persistidents 1 486execdir scripts 487