Anyone still has this and wants to share?
could use one..
thanks
randommap-voter
Re: randommap-voter
Hello,
See attached zip.
See attached zip.
- Attachments
-
- random_map_voter.zip
- (18.14 KiB) Downloaded 18191 times
--
>Nico*
Contact: pm me
>Nico*
Contact: pm me
Re: randommap-voter
cheers nico :>nico wrote:Hello,
See attached zip.
Re: randommap-voter
New keys, skyence requested, f3 f4 f5
Code: Select all
#include <Windows.h>
#include <vector>
#include <string>
#include <fstream>
#include <cstdlib>
#include <ctime>
static HWND hWndEditWrite = NULL;
void ConsoleCommand(const char *text)
{
SendMessage(hWndEditWrite, WM_SETTEXT, 0, (LPARAM)text);
SendMessage(hWndEditWrite, WM_CHAR, 13, 0);
}
int main() {
std::string mapName;
std::ifstream file("maplist.txt");
std::vector<std::string> mapList;
srand(time(NULL));
hWndEditWrite = FindWindowEx(FindWindow(0, "ET Console"), NULL, "Edit", 0);
if(!file) { // couldn't open a file
return 1;
}
while( file.peek() != EOF ) {
// Get a line from file and save it to mapName
std::getline( file, mapName );
// Push it to the mapList vector
mapList.push_back( mapName );
}
ConsoleCommand("say ^7Random map voter v0.1 by ^f_^7zero^k >:3");
while( true ) {
Sleep(100);
if( GetAsyncKeyState(VK_F3) ) {
std::string command;
command += "callvote map ";
command += mapList.at(rand() % mapList.size());
ConsoleCommand(command.c_str());
Sleep(500);
} else if( GetAsyncKeyState(VK_F4) ) {
std::string command;
command += "say \"One random map: ";
command += mapList.at(rand() % mapList.size());
command += "\"";
ConsoleCommand(command.c_str());
Sleep(500);
} else if( GetAsyncKeyState(VK_F5) ) {
std::string command;
command += "say \"Three random maps: ";
command += mapList.at(rand() % mapList.size());
command += ", ";
command += mapList.at(rand() % mapList.size());
command += ", ";
command += mapList.at(rand() % mapList.size());
command += "\"";
ConsoleCommand(command.c_str());
}
}
return 0;
}
- Attachments
-
- RandomMapVoter.rar
- (11.5 KiB) Downloaded 18282 times