28.06.2020, 17:55
Is this the best way?
Code:
#include "a_samp" #include "Pawn.CMD" main(){} new Admin[MAX_PLAYERS]; new SemiAdminLVL[MAX_PLAYERS]; public OnGameModeInit() { return 1; } public OnGameModeExit() { return 1; } CMD:admins(playerid, params[]) { new count = 0; for(new i = 0; i < MAX_PLAYERS; i++) { if(!IsPlayerConnected(i)) continue; if(!Admin[i]) continue; new string[128]; new pName[24]; GetPlayerName(i, pName, sizeof(pName)); switch(Admin[i]) { case 1: format(string, sizeof(string), "Semi-Administrator [Level %d]: %s (ID: %d)", SemiAdminLVL, pName, i); case 2: format(string, sizeof(string), "Administrator: %s (ID: %d)", pName, i); case 3: format(string, sizeof(string), "Vice Head Admin: %s (ID: %d)", pName, i); case 4: format(string, sizeof(string), "Head Admin: %s (ID: %d)", pName, i); default: continue; } ShowPlayerDialog(playerid, 7777, DIALOG_STYLE_MSGBOX, "Online Administrators", string, "OK", ""); count++; } if(!count) ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "No Administrators", "There are no Administrators Online", "OK", ""); return 1; } CMD:rank1(playerid) { Admin[playerid] = 2; return 1; } CMD:rank2(playerid) { Admin[playerid] = 3; return 1; } CMD:rank3(playerid) { Admin[playerid] = 4; return 1; } CMD:semi1(playerid) { Admin[playerid] = 1; SemiAdminLVL[playerid] = 1; return 1; } CMD:semi2(playerid) { Admin[playerid] = 1; SemiAdminLVL[playerid] = 2; return 1; } CMD:semi3(playerid) { Admin[playerid] = 1; SemiAdminLVL[playerid] = 3; return 1; }