SA-MP Forums Archive
Admin Ranks - 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 Ranks (/showthread.php?tid=345350)



Admin Ranks - MechaTech - 24.05.2012

I really want admin ranks like level 1 = Moderator level 2 = Administrator etc. I already have some commands and login/register system.


Re: Admin Ranks - Kindred - 24.05.2012

pawn Код:
stock CheckPlayerAdmin(targetid)
{
    new adminrank[10];
    if(PlayerInfo[targetid][pAdmin] == 0) { adminrank = "None"; }
    if(PlayerInfo[targetid][pAdmin] == 1) { adminrank = "Moderator"; }
    if(PlayerInfo[targetid][pAdmin] == 2) { adminrank = "Junior"; }
    if(PlayerInfo[targetid][pAdmin] == 3) { adminrank = "General"; }
    if(PlayerInfo[targetid][pAdmin] == 4) { adminrank = "Senior"; }
    if(PlayerInfo[targetid][pAdmin] == 5) { adminrank = "Executive"; }
    if(PlayerInfo[targetid][pAdmin] == 6) { adminrank = "Owner"; }
    return adminrank;
}
Above is just a simple stock I made, yet I'm not sure if it works. I use this on my gamemode, yet it's untested as of yet. Something like this could be made:

pawn Код:
CMD:stats(playerid, params[])
{
    new string[128], faction[128];
    format(string, sizeof(string), "------------------------------------[%s]-------------------------------", GetName(playerid));
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string, sizeof(string), "|| [Admin]: %s ||", CheckPlayerAdmin(playerid));
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
}
Remember, this is just an example. The stock simply states that it creates a new variable, and then depending on what the admin rank is set to for the player, sets the name of their admin rank.


Re: Admin Ranks - Pizzy - 24.05.2012

pawn Код:
stock AdminRank(targetid)
{
      new adminrank[10];
      switch(PlayerInfo[targetid][pAdmin])
      {
             case 0: { adminrank = "None"; }
             case 1: { adminrank = "Moderator"; }
             case 2: { adminrank = "Junior"; }
             //ETC.
      }
      return adminrank;
}
This is more efficient than Kindred's code, but the same idea/concept.


Re: Admin Ranks - leonardo1434 - 24.05.2012

pawn Код:
new AccountInfo[MAX_PLAYERS]

enum Info
{
    AdminLevel // here is made your admin level...
}

// exemple

if (AccountInfo[playerid][AdminLevel] > 0)
    {
        new lol[40]
        format(lol, sizeof lol, "|» You are now logged in as a level %d admin «|",[AdminLevel]);
        SendClientMessage(playerid, COLOR_GREEN, lol);
    }
}



Re: Admin Ranks - jessejanssen - 24.05.2012

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
pawn Код:
new AccountInfo[MAX_PLAYERS]

enum Info
{
    AdminLevel // here is made your admin level...
}

// exemple

if (AccountInfo[playerid][AdminLevel] > 0)
    {
        new lol[40]
        format(lol, sizeof lol, "|» You are now logged in as a level %d admin «|",[AdminLevel]);
        SendClientMessage(playerid, COLOR_GREEN, lol);
    }
}
That is not right, it should be as this:
pawn Код:
enum Info
{
    AdminLevel
}
new AccountInfo[MAX_PLAYERS][Info];

public OnPlayerConnect(playerid)
{
    if (AccountInfo[playerid][AdminLevel] > 0)
        {
        new string[110];
        format(string, sizeof(string), ">  You are logged in as level %d Administrator.",[AdminLevel]);
        SendClientMessage(playerid, 0xFFFFFFFF, string);
        }
}
Best regards,
Jesse


Re: Admin Ranks - leonardo1434 - 24.05.2012

About my code, it's right. it's pretty obviously it was to be put in onplayerconnect don't think you?

pawn Код:
new lol[40]
it was a random number....


Re: Admin Ranks - jessejanssen - 24.05.2012

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
About my code, it's right. it's pretty obviously it was to be put in onplayerconnect don't think you?

pawn Код:
new lol[40]
it was a random number....
You didn't include the enum into the variable and more, and don't take this on a bad way, you learn from your mistakes ..

Best regards,
Jesse


Re: Admin Ranks - MechaTech - 24.05.2012

both of those scripts is giving me this error:

Код:
W:\Users\Magdy\Desktop\Server 3.0e\filterscripts\MyAdmin.pwn(93) : error 029: invalid expression, assumed zero
W:\Users\Magdy\Desktop\Server 3.0e\filterscripts\MyAdmin.pwn(93) : error 091: ambiguous constant; tag override is required (symbol "AdminLevel")
W:\Users\Magdy\Desktop\Server 3.0e\filterscripts\MyAdmin.pwn(93) : error 029: invalid expression, assumed zero
W:\Users\Magdy\Desktop\Server 3.0e\filterscripts\MyAdmin.pwn(93) : fatal error 107: too many error messages on one line



Re: Admin Ranks - Mike_Peterson - 24.05.2012

Mecha this might be useful or totally unusful, as your dutch aswell I can help you (in dutch) on teamviewer, but if u dont reply quick, theres a chance that I have to go (school). PM me ur TV details.

edit: got to go, if this problem still occurs tomorrow i'll help ya out.


Re: Admin Ranks - jessejanssen - 24.05.2012

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
Mecha this might be useful or totally unusful, as your dutch aswell I can help you (in dutch) on teamviewer, but if u dont reply quick, theres a chance that I have to go (school). PM me ur TV details.

edit: got to go, if this problem still occurs tomorrow i'll help ya out.
I'm Dutch too, so there wouldn't be a language barrier anyways :P. But yea, if that guy can help you that's good aswell, else my PM box is always open. If you need my help, just PM me.

Best regards,
Jesse