SA-MP Forums Archive
/admin Command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /admin Command (/showthread.php?tid=578344)



/admin Command - peacewalker - 18.06.2015

Hey guys,

i want to make an /admin command, which show me how many admins are online and which rank they have.
Something like that:

Supporter: User1, User2..
Moderator: User3..
Admin: User4..
Owner: User5

My Enums:
Код:
enum pInfo{
	Level,
	Geld,
	Konto,
	Skin,
	Adminlevel
}
enum aInfo{
	ARangname
}
new UserInfo[MAX_PLAYERS][pInfo];
new AdminInfo[7][aInfo];
OnGameModeInit:
Код:
	format(AdminInfo[1][ARangname], 64, "Supporter");
	format(AdminInfo[2][ARangname], 64, "Operator");
	format(AdminInfo[3][ARangname], 64, "Moderator");
	format(AdminInfo[4][ARangname], 64, "Co-Admin");
	format(AdminInfo[5][ARangname], 64, "Admin");
	format(AdminInfo[6][ARangname], 64, "Owner");
My Command:
Код:
CMD:admin(playerid, params[]){

    for(new i = 0; i < MAX_PLAYERS; i++){
    	if(IsPlayerConnected(i)){
     		if(IsPlayerAnAdmin(i, 1)){
       			new name[MAX_PLAYER_NAME], string[128];
       			GetPlayerName(i,name, sizeof(name));
          		format(string, sizeof(string),"%s : %s", AdminInfo[UserInfo[i][Adminlevel]][ARangname], name);
          		SendClientMessage(playerid, YELLOW, string);
			}
          	else{
           		SendClientMessage(playerid, WHITE, "Es ist kein Admin online." );
			}
   		}
   	}
	return CMD_SUCCESS;
}
When my Adminlevel is 6 and i use /admin, i get : "Owner: peacewalker"
But when my Adminlevel is 5, then i get: "AOwner: peacewalker"
Adminlevel 4, i get: "CAOwner: peacewalker"
and so on..

Sorry for that bad english.

Hope you can help me.

Thx.
peacewalker