Advertisement
Mangus875

[FIXED!] (TF2) RGB Crosshair Script

May 22nd, 2023 (edited)
1,346
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 12.96 KB | None | 0 0
  1. alias "ch_cycle_rgb" "next_col_speed2"  // edit this to change speed
  2.  
  3. alias "next_col_speed1" "wait 1; ch_next_col"
  4. alias "next_col_speed2" "wait 2; ch_next_col"
  5. alias "next_col_speed3" "wait 3; ch_next_col"
  6. alias "next_col_speed4" "wait 4; ch_next_col"
  7. alias "next_col_speed5" "wait 5; ch_next_col"
  8. alias "next_col_speed6" "wait 7; ch_next_col"
  9. alias "next_col_speed7" "wait 10; ch_next_col"
  10. alias "next_col_speed8" "wait 15; ch_next_col"
  11. alias "next_col_speed9" "wait 20; ch_next_col"
  12.  
  13. alias "ch_next_col" "ch_col1"
  14. alias "ch_col1" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 0; alias ch_next_col ch_col2; ch_cycle_rgb"
  15. alias "ch_col2" "cl_crosshair_red 255; cl_crosshair_green 16; cl_crosshair_blue 0; alias ch_next_col ch_col3; ch_cycle_rgb"
  16. alias "ch_col3" "cl_crosshair_red 255; cl_crosshair_green 32; cl_crosshair_blue 0; alias ch_next_col ch_col4; ch_cycle_rgb"
  17. alias "ch_col4" "cl_crosshair_red 255; cl_crosshair_green 48; cl_crosshair_blue 0; alias ch_next_col ch_col5; ch_cycle_rgb"
  18. alias "ch_col5" "cl_crosshair_red 255; cl_crosshair_green 64; cl_crosshair_blue 0; alias ch_next_col ch_col6; ch_cycle_rgb"
  19. alias "ch_col6" "cl_crosshair_red 255; cl_crosshair_green 80; cl_crosshair_blue 0; alias ch_next_col ch_col7; ch_cycle_rgb"
  20. alias "ch_col7" "cl_crosshair_red 255; cl_crosshair_green 96; cl_crosshair_blue 0; alias ch_next_col ch_col8; ch_cycle_rgb"
  21. alias "ch_col8" "cl_crosshair_red 255; cl_crosshair_green 112; cl_crosshair_blue 0; alias ch_next_col ch_col9; ch_cycle_rgb"
  22. alias "ch_col9" "cl_crosshair_red 255; cl_crosshair_green 128; cl_crosshair_blue 0; alias ch_next_col ch_col10; ch_cycle_rgb"
  23. alias "ch_col10" "cl_crosshair_red 255; cl_crosshair_green 144; cl_crosshair_blue 0; alias ch_next_col ch_col11; ch_cycle_rgb"
  24. alias "ch_col11" "cl_crosshair_red 255; cl_crosshair_green 160; cl_crosshair_blue 0; alias ch_next_col ch_col12; ch_cycle_rgb"
  25. alias "ch_col12" "cl_crosshair_red 255; cl_crosshair_green 176; cl_crosshair_blue 0; alias ch_next_col ch_col13; ch_cycle_rgb"
  26. alias "ch_col13" "cl_crosshair_red 255; cl_crosshair_green 192; cl_crosshair_blue 0; alias ch_next_col ch_col14; ch_cycle_rgb"
  27. alias "ch_col14" "cl_crosshair_red 255; cl_crosshair_green 208; cl_crosshair_blue 0; alias ch_next_col ch_col15; ch_cycle_rgb"
  28. alias "ch_col15" "cl_crosshair_red 255; cl_crosshair_green 224; cl_crosshair_blue 0; alias ch_next_col ch_col16; ch_cycle_rgb"
  29. alias "ch_col16" "cl_crosshair_red 255; cl_crosshair_green 240; cl_crosshair_blue 0; alias ch_next_col ch_col17; ch_cycle_rgb"
  30. alias "ch_col17" "cl_crosshair_red 255; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col18; ch_cycle_rgb"
  31. alias "ch_col18" "cl_crosshair_red 240; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col19; ch_cycle_rgb"
  32. alias "ch_col19" "cl_crosshair_red 224; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col20; ch_cycle_rgb"
  33. alias "ch_col20" "cl_crosshair_red 208; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col21; ch_cycle_rgb"
  34. alias "ch_col21" "cl_crosshair_red 192; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col22; ch_cycle_rgb"
  35. alias "ch_col22" "cl_crosshair_red 176; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col23; ch_cycle_rgb"
  36. alias "ch_col23" "cl_crosshair_red 160; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col24; ch_cycle_rgb"
  37. alias "ch_col24" "cl_crosshair_red 144; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col25; ch_cycle_rgb"
  38. alias "ch_col25" "cl_crosshair_red 128; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col26; ch_cycle_rgb"
  39. alias "ch_col26" "cl_crosshair_red 112; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col27; ch_cycle_rgb"
  40. alias "ch_col27" "cl_crosshair_red 96; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col28; ch_cycle_rgb"
  41. alias "ch_col28" "cl_crosshair_red 80; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col29; ch_cycle_rgb"
  42. alias "ch_col29" "cl_crosshair_red 64; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col30; ch_cycle_rgb"
  43. alias "ch_col30" "cl_crosshair_red 48; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col31; ch_cycle_rgb"
  44. alias "ch_col31" "cl_crosshair_red 32; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col32; ch_cycle_rgb"
  45. alias "ch_col32" "cl_crosshair_red 16; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col33; ch_cycle_rgb"
  46. alias "ch_col33" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 0; alias ch_next_col ch_col34; ch_cycle_rgb"
  47. alias "ch_col34" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 16; alias ch_next_col ch_col35; ch_cycle_rgb"
  48. alias "ch_col35" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 32; alias ch_next_col ch_col36; ch_cycle_rgb"
  49. alias "ch_col36" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 48; alias ch_next_col ch_col37; ch_cycle_rgb"
  50. alias "ch_col37" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 64; alias ch_next_col ch_col38; ch_cycle_rgb"
  51. alias "ch_col38" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 80; alias ch_next_col ch_col39; ch_cycle_rgb"
  52. alias "ch_col39" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 96; alias ch_next_col ch_col40; ch_cycle_rgb"
  53. alias "ch_col40" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 112; alias ch_next_col ch_col41; ch_cycle_rgb"
  54. alias "ch_col41" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 128; alias ch_next_col ch_col42; ch_cycle_rgb"
  55. alias "ch_col42" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 144; alias ch_next_col ch_col43; ch_cycle_rgb"
  56. alias "ch_col43" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 160; alias ch_next_col ch_col44; ch_cycle_rgb"
  57. alias "ch_col44" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 176; alias ch_next_col ch_col45; ch_cycle_rgb"
  58. alias "ch_col45" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 192; alias ch_next_col ch_col46; ch_cycle_rgb"
  59. alias "ch_col46" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 208; alias ch_next_col ch_col47; ch_cycle_rgb"
  60. alias "ch_col47" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 224; alias ch_next_col ch_col48; ch_cycle_rgb"
  61. alias "ch_col48" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 240; alias ch_next_col ch_col49; ch_cycle_rgb"
  62. alias "ch_col49" "cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 255; alias ch_next_col ch_col50; ch_cycle_rgb"
  63. alias "ch_col50" "cl_crosshair_red 0; cl_crosshair_green 240; cl_crosshair_blue 255; alias ch_next_col ch_col51; ch_cycle_rgb"
  64. alias "ch_col51" "cl_crosshair_red 0; cl_crosshair_green 224; cl_crosshair_blue 255; alias ch_next_col ch_col52; ch_cycle_rgb"
  65. alias "ch_col52" "cl_crosshair_red 0; cl_crosshair_green 208; cl_crosshair_blue 255; alias ch_next_col ch_col53; ch_cycle_rgb"
  66. alias "ch_col53" "cl_crosshair_red 0; cl_crosshair_green 192; cl_crosshair_blue 255; alias ch_next_col ch_col54; ch_cycle_rgb"
  67. alias "ch_col54" "cl_crosshair_red 0; cl_crosshair_green 176; cl_crosshair_blue 255; alias ch_next_col ch_col55; ch_cycle_rgb"
  68. alias "ch_col55" "cl_crosshair_red 0; cl_crosshair_green 160; cl_crosshair_blue 255; alias ch_next_col ch_col56; ch_cycle_rgb"
  69. alias "ch_col56" "cl_crosshair_red 0; cl_crosshair_green 144; cl_crosshair_blue 255; alias ch_next_col ch_col57; ch_cycle_rgb"
  70. alias "ch_col57" "cl_crosshair_red 0; cl_crosshair_green 128; cl_crosshair_blue 255; alias ch_next_col ch_col58; ch_cycle_rgb"
  71. alias "ch_col58" "cl_crosshair_red 0; cl_crosshair_green 112; cl_crosshair_blue 255; alias ch_next_col ch_col59; ch_cycle_rgb"
  72. alias "ch_col59" "cl_crosshair_red 0; cl_crosshair_green 96; cl_crosshair_blue 255; alias ch_next_col ch_col60; ch_cycle_rgb"
  73. alias "ch_col60" "cl_crosshair_red 0; cl_crosshair_green 80; cl_crosshair_blue 255; alias ch_next_col ch_col61; ch_cycle_rgb"
  74. alias "ch_col61" "cl_crosshair_red 0; cl_crosshair_green 64; cl_crosshair_blue 255; alias ch_next_col ch_col62; ch_cycle_rgb"
  75. alias "ch_col62" "cl_crosshair_red 0; cl_crosshair_green 48; cl_crosshair_blue 255; alias ch_next_col ch_col63; ch_cycle_rgb"
  76. alias "ch_col63" "cl_crosshair_red 0; cl_crosshair_green 32; cl_crosshair_blue 255; alias ch_next_col ch_col64; ch_cycle_rgb"
  77. alias "ch_col64" "cl_crosshair_red 0; cl_crosshair_green 16; cl_crosshair_blue 255; alias ch_next_col ch_col65; ch_cycle_rgb"
  78. alias "ch_col65" "cl_crosshair_red 0; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col66; ch_cycle_rgb"
  79. alias "ch_col66" "cl_crosshair_red 16; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col67; ch_cycle_rgb"
  80. alias "ch_col67" "cl_crosshair_red 32; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col68; ch_cycle_rgb"
  81. alias "ch_col68" "cl_crosshair_red 48; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col69; ch_cycle_rgb"
  82. alias "ch_col69" "cl_crosshair_red 64; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col70; ch_cycle_rgb"
  83. alias "ch_col70" "cl_crosshair_red 80; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col71; ch_cycle_rgb"
  84. alias "ch_col71" "cl_crosshair_red 96; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col72; ch_cycle_rgb"
  85. alias "ch_col72" "cl_crosshair_red 112; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col73; ch_cycle_rgb"
  86. alias "ch_col73" "cl_crosshair_red 128; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col74; ch_cycle_rgb"
  87. alias "ch_col74" "cl_crosshair_red 144; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col75; ch_cycle_rgb"
  88. alias "ch_col75" "cl_crosshair_red 160; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col76; ch_cycle_rgb"
  89. alias "ch_col76" "cl_crosshair_red 176; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col77; ch_cycle_rgb"
  90. alias "ch_col77" "cl_crosshair_red 192; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col78; ch_cycle_rgb"
  91. alias "ch_col78" "cl_crosshair_red 208; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col79; ch_cycle_rgb"
  92. alias "ch_col79" "cl_crosshair_red 224; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col80; ch_cycle_rgb"
  93. alias "ch_col80" "cl_crosshair_red 240; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col81; ch_cycle_rgb"
  94. alias "ch_col81" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 255; alias ch_next_col ch_col82; ch_cycle_rgb"
  95. alias "ch_col82" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 240; alias ch_next_col ch_col83; ch_cycle_rgb"
  96. alias "ch_col83" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 224; alias ch_next_col ch_col84; ch_cycle_rgb"
  97. alias "ch_col84" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 208; alias ch_next_col ch_col85; ch_cycle_rgb"
  98. alias "ch_col85" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 192; alias ch_next_col ch_col86; ch_cycle_rgb"
  99. alias "ch_col86" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 176; alias ch_next_col ch_col87; ch_cycle_rgb"
  100. alias "ch_col87" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 160; alias ch_next_col ch_col88; ch_cycle_rgb"
  101. alias "ch_col88" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 144; alias ch_next_col ch_col89; ch_cycle_rgb"
  102. alias "ch_col89" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 128; alias ch_next_col ch_col90; ch_cycle_rgb"
  103. alias "ch_col90" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 112; alias ch_next_col ch_col91; ch_cycle_rgb"
  104. alias "ch_col91" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 96; alias ch_next_col ch_col92; ch_cycle_rgb"
  105. alias "ch_col92" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 80; alias ch_next_col ch_col93; ch_cycle_rgb"
  106. alias "ch_col93" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 64; alias ch_next_col ch_col94; ch_cycle_rgb"
  107. alias "ch_col94" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 48; alias ch_next_col ch_col95; ch_cycle_rgb"
  108. alias "ch_col95" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 32; alias ch_next_col ch_col96; ch_cycle_rgb"
  109. alias "ch_col96" "cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 16; alias ch_next_col ch_wait_test; ch_cycle_rgb"
  110.  
  111. alias "ch_wait_test" "alias wait ch_no_wait; alias ch_wait ch_rgb_go; wait; ch_wait"
  112. alias "ch_rgb_go" "alias ch_next_col ch_col1; ch_next_col"
  113. alias "ch_no_wait" "alias ch_wait"
  114. alias "ch_rgb_off" "alias ch_next_col; alias toggle_rgb_crosshair ch_rgb_on"
  115. alias "ch_rgb_on" "alias toggle_rgb_crosshair ch_rgb_off; ch_wait_test"
  116. alias "toggle_rgb_crosshair" "ch_rgb_on"
  117.  
  118. sv_allow_wait_command 1     // the script wont work if this isnt enabled. (casual servers & most community servers have this enabled)
Advertisement
Comments
  • Mangus875
    1 year
    # Lua 0.88 KB | 0 0
    1. -- code to generate colors:
    2.  
    3. local function chCol(r,g,b,alias)
    4.     return 'alias "ch_col'..alias..'" "cl_crosshair_red '..r.."; cl_crosshair_green "..g.."; cl_crosshair_blue "..b..'; alias ch_next_col ch_col'..(alias+1)..'; wait 3; ch_col_next"'
    5. end
    6.  
    7. local function clamp(n, min, max)
    8.     if n < min then return min end
    9.     if n > max then return max end
    10.     return n
    11. end
    12.  
    13. local rgb = {256, 0, 0}
    14. local dir = 1
    15. local mag = 16
    16. local pos = 2
    17. local count = 1
    18.  
    19. while count <= 2*(256/mag)*3 do
    20.     local r,g,b = rgb[1],rgb[2],rgb[3]
    21.     local red,grn,blu = clamp(r,0,255),clamp(g,0,255),clamp(b,0,255)
    22.     print(chCol(red,grn,blu,count))
    23.    
    24.     rgb[pos] = rgb[pos] + mag*dir
    25.     if dir == 1 then
    26.         if rgb[pos] == 256 then
    27.             pos = pos%3+1
    28.             pos = pos%3+1
    29.             dir = dir * -1
    30.         end
    31.     else
    32.         if rgb[pos] == 0 then
    33.             pos = pos%3+1
    34.             pos = pos%3+1
    35.             dir = dir * -1
    36.         end
    37.     end
    38.    
    39.     count = count + 1
    40. end
Add Comment
Please, Sign In to add comment
Advertisement