Advertisement
Mangus875
May 22nd, 2023
142
0
Never
This is comment for paste [FIXED!] (TF2) RGB Crosshair Script
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement