compatibility.cfg 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Makes very old cubescripts compatible with newer versions of the game
  2. // (write "load_compatibility" into your autoexec.cfg to load)
  3. const alive [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 alive) ] [ result (player1 alive) ] ]
  4. const currole [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 role) ] [ result (player1 role) ] ]
  5. const curmode [ result $gamemode ]
  6. const getclientmode [ result $gamemode ]
  7. const curteam [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 team) ] [ result (player1 team) ] ]
  8. const findpn [ if (isclient $arg1) [ result (player $arg1 name) ] [ result [] ] ]
  9. const isSpect [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 spect) ] [ result (player1 spect) ] ]
  10. const pstat_score [
  11. if (isclient $arg1) [
  12. result (concat (player $arg1 flags) (player $arg1 frags) (player $arg1 deaths) (player $arg1 team) (player $arg1 tks) (player $arg1 name))
  13. ] [ result (concat [0 0 0 0 -1 0] (addpunct)) ]
  14. ]
  15. const orderscorecolumns [
  16. if (= $arg1 1) [
  17. sc_clientnum 0;
  18. sc_name 1;
  19. sc_flags 2;
  20. sc_frags 3;
  21. sc_deaths 4;
  22. sc_lag 5;
  23. sc_ratio -1;
  24. ] [
  25. sc_flags 0;
  26. sc_frags 1;
  27. sc_deaths 2;
  28. sc_ratio -1;
  29. sc_lag 4;
  30. sc_clientnum 5;
  31. sc_name 6;
  32. ]
  33. ]
  34. // deprecated functions
  35. // Helper aliases for easy color insertion. (e.g. echo (red)Hello (blue)world! (white)My fov today is: (orange) $fov)
  36. loop k 10 [ const (at [green blue yellow red gray white dbrown dred purple orange] $k) (format [if (= $arg1 -1) [ result %1 ] [ result %2 ]] $k (concatword "\f" $k)) ]
  37. const showedithide [
  38. if $edithideentmask [
  39. push n "Hidden entities:"
  40. push m 1
  41. looplist (listoptions ents) e [
  42. if (&b $edithideentmask $m) [
  43. n = (concat $n $e)
  44. ]
  45. += m $m
  46. ]
  47. echo (pop n m)
  48. ] [
  49. echo "all entities are visible"
  50. ]
  51. ]
  52. const setedithide [
  53. edithideentmask 0
  54. looplist $arg1 e [
  55. push n (findlist (listoptions ents) $e)
  56. if (< $n 0) [
  57. echo "\f3" $e is not an entity type
  58. ] [
  59. edithideentmask (|b $edithideentmask (powf 2 $n))
  60. ]
  61. pop n
  62. ]
  63. ]