SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   How do I make this? (https://forum.sa-mp.com/showthread.php?t=587987)

AndreiWow 04/09/2015 04:29 PM

How do I make this?
 
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.

SWAT4 04/09/2015 04:35 PM

Re: How do I make this?
 
Give us the codes that defines the admin levels/ranks..
check them as defines, if not, check at the /admins command itself,

AndreiWow 04/09/2015 04:38 PM

Re: How do I make this?
 
Code:

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

mirou123 04/09/2015 04:48 PM

Re: How do I make this?
 
Use this code
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
Code:

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

AndreiWow 04/09/2015 05:02 PM

Re: How do I make this?
 
Thanks alot, I will rep when I will be able to


All times are GMT. The time now is 06:57 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.