// This command lists all online admins COMMAND:admins(playerid, params[]) { // Setup local variables new AdminList[500], Name[24]; // Send the command to all admins so they can see it SendAdminText(playerid, "/admins", params); // Check if the player has logged in if (APlayerData[playerid][LoggedIn] == true) { // Scan through all players for (new i; i < MAX_PLAYERS; i++) { // Check if this player is connected if (IsPlayerConnected(i)) { // Get the name of the player GetPlayerName(i, Name, sizeof(Name)); // Check if this player is an RCON admin if (IsPlayerAdmin(i)) { // Add all admin players to the list format(AdminList, 500, "%s%s: %s (id: %i), admin-level: %i (RCON admin)\n", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list // Re-start the for loop (skipping the remaining code for this iteration) continue; } //Check if that player is an admin (using the PlayerLevel) if (APlayerData[i][PlayerLevel] > 0) { // Add all admin players to the list format(AdminList, 500, "%s%s: %s (id: %i), admin-level: %i\n", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list } } } // Check if there were admin-names added to the list if (strlen(AdminList) > 0) ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Online admins:", AdminList, "OK", "Cancel"); else SendClientMessage(playerid, 0xFF0000FF, "No admin online"); // No admins are online } else return SendClientMessage(playerid, 0xFF0000FF, "REPORT THIS TO ADMIN"); // No admins are online; // Let the server know that this was a valid command return 1; }
AdminLevelName[APlayerData[i][PlayerLevel]]
if (strcmp(cmd, "/admins", true) == 0) { if(IsPlayerConnected(playerid)) { SendClientMessage(playerid, COLOR_GREEN, "__________ Admini On __________"); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pAdmin] == 1337) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{FF0000}Co-Ownar {80FF80}| {FFFFFF}Nume: {FF8000}%s {FFFFFF}| ID: {80FFFF}[%d]", sendername,i); SendClientMessage(playerid, 0x33CCFFAA, string); } if(PlayerInfo[i][pAdmin] == 1340) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{00FF80}Scripter {80FF80}| {FFFFFF}Nume: {FF8000}%s {FFFFFF}| ID: {80FFFF}[%d]", sendername,i); SendClientMessage(playerid, 0x33CCFFAA, string); } if(PlayerInfo[i][pAdmin] == 1339) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{00FF80}Mapper {80FF80}| {FFFFFF}Nume: {FF8000}%s {FFFFFF}| ID: {80FFFF}[%d]", sendername,i); SendClientMessage(playerid, 0x33CCFFAA, string); } if(PlayerInfo[i][pAdmin] == 133 ![]() { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{FF0000}Owner {80FF80}| {FFFFFF}Nume: {FF8000}%s {FFFFFF}| ID: {80FFFF}[%d]", sendername,i); SendClientMessage(playerid, 0x33CCFFAA, string); } if(PlayerInfo[i][pAdmin] == 1) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{0080FF}Admin 1 {80FF80}| {FFFFFF}Nume: {FF8000}%s {FFFFFF}| ID: {80FFFF}[%d]", sendername,i); SendClientMessage(playerid, 0x33CCFFAA, string); } if(PlayerInfo[i][pAdmin] == 2) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{0080FF}Admin 2 {80FF80}| {FFFFFF}Nume: {FF8000}%s {FFFFFF}| ID: {80FFFF}[%d]", sendername,i); SendClientMessage(playerid, 0x33CCFFAA, string); } if(PlayerInfo[i][pAdmin] == 3) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{0080FF}Admin 3 {80FF80}| {FFFFFF}Nume: {FF8000}%s {FFFFFF}| ID: {80FFFF}[%d]", sendername,i); SendClientMessage(playerid, 0x33CCFFAA, string); } if(PlayerInfo[i][pAdmin] == 4) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{0080FF}Admin 4 {80FF80}| {FFFFFF}Nume: {FF8000}%s {FFFFFF}| ID: {80FFFF}[%d]", sendername,i); SendClientMessage(playerid, 0x33CCFFAA, string); } } } } return 1; } |
{FF0000}Co-Ownar {80FF80}| {FFFFFF}Nume: {FF8000}%s {FFFFFF}| ID: {80FFFF}[%d] |
COMMAND:admins(playerid, params[])
{
SendAdminText(playerid, "/admins", params);
if(!APlayerData[playerid][LoggedIn]) return SendClientMessage(playerid, 0xFF0000FF, "REPORT THIS TO ADMIN");
new count = 0, AdminList[750];
for(new i = 0, j = GetPlayerPoolSize(); i != j; i++)
{
if(!IsPlayerConnected(i)) continue;
if(!APlayerData[i][PlayerLevel]) continue;
new fstr[75], Name[MAX_PLAYER_NAME];
GetPlayerName(i, Name, sizeof(Name));
format(fstr, sizeof(fstr), "%s: %s (id: %i), admin-level: %i", AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]);
strcat(fstr, (IsPlayerAdmin(i)) ? ("(RCON admin)\n") : ("\n"));
strcat(AdminList, fstr);
count++;
if(count >= 10) break;
}
if(!count) return SendClientMessage(playerid, 0xFF0000FF, "No admin online");
ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Online admins:", AdminList, "OK", "Cancel");
return 1;
}