Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> //Input/Output
- #include <string> //Manipulate Strings
- #include <fstream> //use <fstream> if you need to write as well.
- using namespace std;
- void addAutoexecLine();
- bool fileExists(const char *fileName);
- bool hasExec();
- void addMainConfig();
- int main()
- {
- addAutoexecLine();
- addMainConfig();
- return 0;
- }
- void addAutoexecLine()
- {
- if(fileExists("autoexec.cfg"))
- {
- fstream notroopsOpener;
- notroopsOpener.open("autoexec.cfg", fstream::in | fstream::out | fstream::app);
- if(!hasExec())
- {
- notroopsOpener << endl << "exec rxgservers.cfg";
- notroopsOpener.close();
- }
- else
- {
- notroopsOpener.close();
- }
- }
- else
- {
- ofstream outfile("autoexec.cfg");
- addAutoexecLine();
- }
- }
- bool fileExists(const char *fileName)
- {
- fstream infile(fileName);
- return infile.good();
- }
- bool hasExec()
- {
- fstream checker;
- checker.open("autoexec.cfg");
- string line;
- while(getline( checker, line))
- {
- if ( line.find("exec rxgservers.cfg") != string::npos )
- {
- return true;
- }
- }
- return false;
- }
- void addMainConfig()
- {
- if(!fileExists("rxgservers.cfg"))
- {
- ofstream outfile("rxgservers.cfg");
- addMainConfig();
- }
- else
- {
- fstream notroopsOpenerTwo;
- notroopsOpenerTwo.open("rxgservers.cfg");
- notroopsOpenerTwo << "//Created by NoTroop, Idea shamelessly stolen from the below post on reddit\n//http://www.reddit.com/r/truetf2/comments/1fbn2x/server_aliases_for_pugna_tf2mix_dm_mge_jump_surf/\n\n//Reflex-Gamers 24/7 Stock Rotation.\nalias \"stock\" \"connect 74.91.120.34:27015;\"\n\n//Reflex-Gamers 24/7 Turbine.\nalias \"turbine\" \"connect 74.201.57.124:27015;\"\n\n//Reflex-Gamers 24/7 Payload Rotation.\nalias \"payload\" \"connect 74.91.126.28:27015;\"\n\n//Reflex-Gamers 24/7 2Fort.\nalias \"2fort\" \"connect 74.91.114.113:27015;\"\n\n//Reflex-Gamers 24/7 10x Mayhem\nalias \"mayhem\" \"connect 74.201.57.57:27015;\"\n\n//Reflex-Gamers 24/7 Scrim Server //Just a note about this one, it won't work for matches, as the server will be passworded.\nalias \"mge\" \"connect 66.150.214.229:27015;\" //Used mge because it won't work during matches.\n\n//Reflex-Gamers24/7 Events\nalias \"events\" \"connect 66.151.244.135:27015;\"";
- }
- }
Add Comment
Please, Sign In to add comment