Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <math.h>
- using namespace std;
- int main(int argc, char* argv)
- {
- ofstream file;
- file.open("cl_rainbowch.cfg");
- // Alteration of attack binds to cycle through the crosshair when using either primary or secondary attack
- // If you use different keys for attack and alternate (WHYYYYYYY) edit the keycodes "mouse1" and "mouse2"
- file << "bind mouse1 \"+attack; rbch_next;\"" << endl;
- file << "bind mouse2 \"+attack2; rbch_next;\"" << endl<<endl;
- // Required for the crosshair to change colour at all
- file << "cl_crosshaircolor 5" << endl;
- // Minimum and maximum luminescence values
- double minv = 128.0;
- double maxv = 256.0;
- /* Some examples:
- minv = 0.0; maxv = 256.0; // Colours are fully saturated
- minv = 128.0; maxv = 256.0; // Colours are semi-saturated into white; pastel colours
- minv = 0.0; maxv = 128.0; // Colours are semi-saturated into black; darkened colours
- minv = 96.0; maxv = 144.0; // Colours are distinctly greyed
- minv = 256.0; maxv = 256.0; // Crosshair will just be white, what are you doing
- minv = 0.0; maxv = 0.0; // Now it's just gone completely black, stop this nonsense
- ...and so on */
- // Number of steps it takes to cycle through the entire rainbow
- int cycle = 24;
- // Main loop
- for(int i=0; i<cycle; ++i)
- {
- double c = (double)i / (double)cycle;
- double r = abs((1.0/2.0 - c)*6.0) - 1.0; r = (maxv-minv)*r + minv; r = (r<minv?minv:(r>maxv?maxv:r));
- double g = 2.0 - abs((1.0/3.0 - c)*6.0); g = (maxv-minv)*g + minv; g = (g<minv?minv:(g>maxv?maxv:g));
- double b = 2.0 - abs((2.0/3.0 - c)*6.0); b = (maxv-minv)*b + minv; b = (b<minv?minv:(b>maxv?maxv:b));
- int ir = (int)r; ir=(ir<0?0:(ir>255?255:ir));
- int ig = (int)g; ig=(ig<0?0:(ig>255?255:ig));
- int ib = (int)b; ib=(ib<0?0:(ib>255?255:ib));
- file << "alias rbch_" << i << " \"";
- file << "cl_crosshaircolor_r " << ir << "; ";
- file << "cl_crosshaircolor_g " << ig << "; ";
- file << "cl_crosshaircolor_b " << ib << "; ";
- file << "alias rbch_next rbch_" << (i+1==cycle?0:i+1) << "\"" << endl;
- }
- file << "rbch_0" << endl;
- file.close();
- return 0;
- }
- // Don't forget to actually put the generated file into your csgo/cfg folder
- // Also then add "exec cl_rainbowch" to your autoexec.cfg else it won't even run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement