Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // murdick fails it
- CON_COMMAND(ms_mimic, "name borrowing")
- {
- char tmp[50];
- // I am so sorry for the mess I am about to make here...
- char* names[40];
- int playerCount = 0;
- int randNumber = 0;
- for (int i=0;i<clientEntList->GetHighestEntityIndex();i++)
- {
- player_info_t pinfo;
- engine->GetPlayerInfo(i, &pinfo);
- if(i>31 || pinfo.name[0] == NULL)
- continue;
- names[playerCount] = pinfo.name;
- playerCount++;
- }
- Msg("Found %i names\n", playerCount);
- randNumber = rand()%playerCount;
- Msg("Using %i for seed\n", randNumber);
- char* winner = names[randNumber];
- Msg("Hey Cutie: \t%s \n", winner);
- char cmd[50];
- Q_snprintf( cmd, sizeof(cmd), "setinfo name \"%s \"", winner );
- engineClient->ClientCmd(cmd);
- Msg("Why be me, when I can be \t%s\n", winner );
- // Print this to debug before trying to set your name to it. -> nameList[rand()%playerCount]
- }
Advertisement
Add Comment
Please, Sign In to add comment