void G_adminGlobalSetReason(int skiparg, qboolean subnet, char *reason, int rlen) { if (subnet) { Com_sprintf(reason, rlen, "%s", G_SayConcatArgs(3 + skiparg)); } else { Com_sprintf(reason, rlen, "%s", G_SayConcatArgs(2 + skiparg)); } }
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; } }
/* ================= 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 ); }