How do I make this?
#1

Example if he is admin 1
in /admins will show Admin Level: Moderator instead of 1?
Or in /stats, moderator instead of 1, and so on for all 6 ranks.
Reply
#2

Give us the codes that defines the admin levels/ranks..
check them as defines, if not, check at the /admins command itself,
Reply
#3

Код:
CMD:admins(playerid, params[])
{
	new count = 0;
	new pname[256], string[150];
    SendClientMessage(playerid, COLOR_GREY, "-----------------------------------------------------------");

    foreach (new i : Player) if (PlayerInfo[i][pAdmin] > 0)
	{
        if (PlayerInfo[i][pAdminDuty])
        {
			GetPlayerName(playerid, pname, sizeof(pname));
			PlayerInfo[playerid][pAdminDuty] = 1;
			format(string, sizeof(string), "%s - Admin Level: "COL_LIGHTBLUE"%d "COL_WHITE"("COL_GREEN"On Duty"COL_WHITE")", pname, PlayerInfo[playerid][pAdmin]);
			SendClientMessageToAll(COLOR_WHITE, string);
		}
		else
		{
  			GetPlayerName(playerid, pname, sizeof(pname));
			PlayerInfo[playerid][pAdminDuty] = 1;
			format(string, sizeof(string), "%s - Admin Level: "COL_LIGHTBLUE"%d "COL_WHITE"("COL_RED"Off Duty"COL_WHITE")", pname, PlayerInfo[playerid][pAdmin]);
			SendClientMessageToAll(COLOR_WHITE, string);
		}
        count++;
	}
	if (!count) {
	    SendClientMessage(playerid, COLOR_WHITE, "* No admins online.");
	}
	SendClientMessage(playerid, COLOR_GREY, "-----------------------------------------------------------");
	return 1;
}
Also tell me if it is good, it is made by me xD
Reply
#4

Use this code
Код:
format(string, sizeof(string), "%s - Admin Rank: "COL_LIGHTBLUE"%s "COL_WHITE"("COL_GREEN"On Duty"COL_WHITE")", pname, LevelToRank(PlayerInfo[playerid][pAdmin]));
Notice how I replaced %d with %s and changed PlayerInfo[playerid][pAdmin] to LevelToRank(PlayerInfo[playerid][pAdmin])

Next you need to define LevelToRank so here it is
Код:
stock LevelToRank(level)
{
    new rank[20];
    switch(level)
    {
       case 1: rank = "Moderator";
       case 2: rank = "Whatever you want";
       etc....
       case 6: rank = "Owner";
       default: rank = "Player";
    }
   return rank;
}
You obviously need to finish working on LevelToRank and by the way I did not test that code
Reply
#5

Thanks alot, I will rep when I will be able to
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)