Bukz

Custom gamma values for every official map...

Apr 1st, 2011
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.71 KB | None | 0 0
  1. // V-Man's add2list - Quickly append something to a list, without add2alias'es ";"
  2. add2list = [ if (strcmp "" (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat (getalias $arg1) $arg2) ] ]
  3.  
  4. // Initialize the list (if it doesn't already exist) using the current gamma as initial values.
  5. if (! (checkalias ofc_gamma_list)) [
  6.   ofc_gamma_list = [ ]
  7.   loop ogl (listlen $defaultmaps) [
  8.     add2list ofc_gamma_list $gamma
  9.   ]
  10. ]
  11.  
  12. // setgamma - allows clients to set custom gamma values for each official map, disabling/enabling the entire system
  13. //            can be done with the dyngamma variable.
  14. setgamma = [
  15.   if (&& (<= $arg1 300) (>= $arg1 30)) [
  16.     if (strstr $defaultmaps (curmap 1)) [
  17.       tmp_gamma_list = $ofc_gamma_list
  18.       ofc_gamma_list = [ ]
  19.       cmapp = (findlist $defaultmaps (curmap 1)) // Find the position in the list of the current map
  20.       loop sgl (listlen $defaultmaps) [
  21.         if (= $sgl $cmapp) [ // Add the new gamma at the correct position in the list
  22.           add2list ofc_gamma_list $arg1
  23.         ] [
  24.           add2list ofc_gamma_list (at $tmp_gamma_list $sgl)
  25.         ]
  26.       ]
  27.       echo (c 1)Note: (c 5) $arg1 has been set as your default gamma for (c 2) (curmap 1)
  28.     ] [
  29.       echo (c 3)Error: (c 5)You are not on a official map!
  30.     ]
  31.   ] [
  32.     echo (c 3)Error: (c 5)gamma has a minimum value of 30 and maximum value of 300!
  33.   ]
  34. ]
  35.  
  36. // Plugin to mapstartalways on every run if it doesn't already exist.
  37. if (! (checkalias dyngamma)) [ dyngamma = 0 ]
  38. if (! (checkalias mapstartalways)) [ mapstartalways = [  ] ]
  39. if (! (strstr $mapstartalways dyngamma)) [
  40.   add2alias mapstartalways [
  41.     if $dyngamma [ gamma (at $ofc_gamma_list (findlist $defaultmaps (curmap 1))) ]
  42.   ]
  43. ]
Advertisement
Add Comment
Please, Sign In to add comment