qboolean G_adminWhitelistGlobal(gentity_t *ent, int skiparg) { gentity_t *victim = NULL; char type[5]; char who[16]; char reason[MAX_STRING_CHARS]; int playerSlot = -1; int minArguments = 2 + skiparg; if (G_SayArgc() < minArguments) { ADMP( "^3!help: ^7!wadd\n" ); return qfalse; } G_SayArgv(1 + skiparg, type, sizeof(type)); G_SayArgv(2 + skiparg, who, sizeof(who)); Com_sprintf(reason, MAX_STRING_CHARS, "%s", G_SayConcatArgs(3 + skiparg)); playerSlot = G_adminGlobalSetSlot(who); if (playerSlot != -1) { victim = &g_entities[playerSlot]; } if (strcmp(type, "ip") == 0) { if (!G_isValidIpAddress(who) && !victim) { ADMP( "^3!help: ^7INVALID IP\n" ); return qfalse; } G_globalAddToWhitelist(ent, victim, who, reason, (G_isValidIpAddress(who)) ? who : victim->client->pers.ip, NULL); return qtrue; } else if (strcmp(type, "guid") == 0) { if (!victim || strcmp(victim->client->pers.guid, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") == 0) { ADMP( "^3!help: ^7INVALID GUID\n" ); return qfalse; } G_globalAddToWhitelist(ent, victim, who, reason, NULL, victim->client->pers.guid); return qtrue; } else { ADMP( "^3!help: ^7!wadd\n" ); return qtrue; } }
qboolean G_adminGlobal(gentity_t *ent, int skiparg, globalType_t type) { gentity_t *vic = NULL; char who[MAX_STRING_CHARS]; char reason[MAX_STRING_CHARS] = { "" }; qboolean subnetBan = qfalse; int playerSlot = -1; int minArguments = 2 + skiparg; //Subnet is optional int globalID; if (G_SayArgc() < minArguments) { ADMP( "^3!help: ^7!command\n" ); return qfalse; } G_adminGlobalSetWho(who, skiparg); subnetBan = G_adminGlobalSetSubnet(skiparg); G_adminGlobalSetReason(skiparg, subnetBan, reason, sizeof(reason)); //If isnt a ip check if is a slot, atoi converts ips into ins :( if(!G_isValidIpAddress(who)) playerSlot = G_adminGlobalSetSlot(who); if (playerSlot == -1 && !G_isValidIpAddress(who)) { ADMP( "^3No player found by that name, IP, or slot number\n" ); return qfalse; } if (playerSlot != -1) { vic = &g_entities[playerSlot]; globalID = G_globalAdd(ent, vic, vic->client->pers.guid, vic->client->pers.ip, vic->client->pers.netname, reason, subnetBan, NULL, type); } else { globalID = G_globalAdd(ent, vic, NULL, who, NULL, reason, subnetBan, NULL, type); } G_globalPrintMsgForAdmins(ent, vic, type, globalID, who, reason); G_globalPrintMsgForPlayer(ent, vic, type, globalID, reason); G_globalAction(ent, vic, type, reason); if (G_isPlayerConnected(vic)) vic->client->pers.globalID = globalID; return qtrue; }
/* ================= Cmd_AdminMessage_f Send a message to all active admins ================= */ void Cmd_AdminMessage_f( gentity_t *ent ) { char cmd[ sizeof( "say_team" ) ]; char prefix[ 50 ]; char *msg; int skiparg = 0; // Check permissions and add the appropriate user [prefix] if( !ent ) { Com_sprintf( prefix, sizeof( prefix ), "[CONSOLE]:" ); } else if( !G_admin_permission( ent, ADMF_ADMINCHAT ) ) { if( !g_publicAdminMessages.integer ) { ADMP( "Sorry, but use of /a by non-admins has been disabled.\n" ); return; } else { Com_sprintf( prefix, sizeof( prefix ), "[PLAYER] %s" S_COLOR_WHITE ":", ent->client->pers.netname ); ADMP( "Your message has been sent to any available admins and to the server logs.\n" ); } } else { Com_sprintf( prefix, sizeof( prefix ), "[ADMIN] %s" S_COLOR_WHITE ":", ent->client->pers.netname ); } // Skip say/say_team if this was used from one of those G_SayArgv( 0, cmd, sizeof( cmd ) ); if( !Q_stricmp( cmd, "say" ) || !Q_stricmp( cmd, "say_team" ) ) { skiparg = 1; G_SayArgv( 1, cmd, sizeof( cmd ) ); } if( G_SayArgc( ) < 2 + skiparg ) { ADMP( va( "usage: %s [message]\n", cmd ) ); return; } msg = G_SayConcatArgs( 1 + skiparg ); // Send it G_AdminMessage( prefix, "%s", msg ); }
static void G_BotListTeamNames( gentity_t *ent, const char *heading, team_t team, const char *marker ) { int i; if ( botNames[team].count ) { ADMP( heading ); ADMBP_begin(); for ( i = 0; i < botNames[team].count; ++i ) { ADMBP( va( " %s^7 %s", botNames[team].name[i].inUse ? marker : " ", botNames[team].name[i].name ) ); } ADMBP_end(); } }
/** * Execute a command related to bots * @param master [gentity_t] player who executed the command * @param clientNum [int] bot client id * @param command [string] : * - regular , idle , standground, followattack, etc. (change bot mode) * - kill (kill the bot) * - give (fund a bot) * @param value [int] give value (for aliens 500 is about 1 evo) * * //TODO: bot modes will be removed */ void G_BotCmd( int clientNum, char *command, int value, int value2 ) { gentity_t *ent; ent = &g_entities[clientNum]; if( !( ent->r.svFlags & SVF_BOT ) ) { return; } if( !Q_stricmp( command, "give" ) ) { //LEPE: give money/evos to ent G_AddCreditToClient( ent->client, (short)value, qfalse ); } else if( !Q_stricmp( command, "kill" ) ) { //LEPE: kill ent ent->client->ps.stats[ STAT_HEALTH ] = ent->health = 0; player_die( ent, ent, ent, 10000, MOD_SUICIDE ); } else if( !Q_stricmp( command, "state" ) ) { //LEPE: change bot state. Requires g_bot_manual = 1 if(g_bot_manual.integer) { ent->bot->think.state[ THINK_LEVEL_MAX ] = value; } } else if( !Q_stricmp( command, "nav" ) ) { //LEPE: change bot state. Requires g_bot_manual_nav = 1 if(g_bot_manual_nav.integer) { ent->bot->path.state = value; } } else if( !Q_stricmp( command, "move" ) ) { //LEPE: move bot manually. Requires g_bot_manual = 1 if(g_bot_manual.integer) { if(value > BOT_EMPTY_MOVE && value <= BOT_STOP) { BotAddMove( ent, (botMove)value, value2 ); BotStartMove( ent, BOT_EMPTY_MOVE ); } else { switch(value) { case 50: BotControl( ent , BOT_LOOK_UP); break; case 51: BotControl( ent , BOT_LOOK_DOWN); break; case 52: BotControl( ent , BOT_LOOK_LEFT); break; case 53: BotControl( ent , BOT_LOOK_RIGHT); break; case 54: BotControl( ent , BOT_LOOK_RANDOM); break; case 60: Bot_Strafe( ent ); break; case 61: Bot_Pounce( ent, value2 ); break; case 62: Bot_FullLuci( ent ); break; default: ADMP("unknown move value\n"); break; } } } } else if( !Q_stricmp( command, "moveto" ) ) { if(g_bot_manual.integer) { BotMoveToPoint( ent , level.paths[value].coord ); G_Printf("MoveTo %d\n",value); ADMP(va("Moving to node %d\n", value)); } } else { ADMP("unknown bot command\n"); } return; }