[Tutorial] How to make an /admins command Using ONLY ZCMD !
#1

Hello, As you know, I would like to share my /admins command to all players ! Cause, i found a lot of players that they need any clear /admins commands in full english ! So, if you want, Here IT IS! Hope you enjoy, And Stay awesome!

We need ONLY one stuff.

ZCMD:

For ZCMD : https://sampforum.blast.hk/showthread.php?tid=91354

First, we need the enums to define them for the /admins command...

Code:
enum pInfo
{
       Level,
       Hide,
       OnDuty,

};
new PlayerInfo[MAX_PLAYERS][pInfo];
Done!

Now, let's go to /admins.

We need to put the defines before doing it.

Put the CMD

Code:
CMD:admins(playerid,params[])
{
Then, if you want to put pragma like #pragma unused params if you want. I will add it

__________________________________________________ _________________________________

After it, Put

Code:
#pragma unused params
Now, let's define them with news.

Code:
new count = 0;
new string[128];
new AdmRank[128];
new AdmDuty[128];
new ChangeColor;
Let's send a message.

Code:
SendClientMessage(playerid, COLOR_LIMEGREEN, " ");
SendClientMessage(playerid, COLOR_LIMEGREEN, "{5EFF00}___________ |- Online Admins -| ___________");
SendClientMessage(playerid, COLOR_LIMEGREEN, " ");
So, let's countinue...

Put the ||| for(new i = 0; i < MAX_PLAYERS; i++)
{ |||

Code:
for(new i = 0; i < MAX_PLAYERS; i++)
{
Then, put the if(IsPlayerConnected for all players to show it, and the next of the word....

Code:
if (IsPlayerConnected(i))
{
After it, put the level. But dont change the PlayerInfo[playerid][Hide]. Let it to 0 to be showed to all players.

Code:
if(PlayerInfo[i][Level] >= 1 && PlayerInfo[i][Hide] == 0)
{
After it, Put the RCON rank Like this.

Code:
if(IsPlayerAdmin(i))
{
Below from it, Put the AdmRank. You can put the (RCON Administrator to your level, Everything you want.)

Code:
AdmRank = "RCON Administrator";
ChangeColor = red;
After it, Put the levels like this.

Code:
}
else
{
Now, Let's use the levels. Switching levels.

Code:
switch(PlayerInfo[i][Level])
{
Now, Let's START TO ADD THE LEVELS ! You can place any cases you need. I will put 8 cases (Levels).

Code:
                        case 1: {
                            AdmRank = "Trial Moderator";
                            ChangeColor = COLOR_ORANGE;
                        }
                        case 2: {
                            AdmRank = "Junior Moderator";
                            ChangeColor = COLOR_GREEN;
                        }
                        case 3: {
                            AdmRank = "Super Moderator";
                            ChangeColor = COLOR_YELLOW;
                        }
                        case 4: {
                            AdmRank = "Administrator";
                            ChangeColor = COLOR_LIMEGREEN;
                        }
                        case 5: {
                            AdmRank = "Supreme Administrator";
                            ChangeColor = COLOR_WHITE;
                        }
                        case 6: {
                            AdmRank = "Expert Administrator";
                            ChangeColor = COLOR_ROYALBLUE;
                        }
                        case 7: {
                            AdmRank = "Delta Administrator";
                            ChangeColor = red;
                        }
                        case 8: {
                            AdmRank = "Alfa Administrator";
                            ChangeColor = red;
                        }
                    }
                }
Now let's put the Duties. You can put 2+ cases for the duties. I added only 2

Code:
                switch(PlayerInfo[i][OnDuty])
                {
                    case 0: AdmDuty = "Off Duty!";
                    case 1: AdmDuty = "On Duty!";
                }
The best it is to add how it will be seeing to players the duties.

Code:
                if(PlayerInfo[i][OnDuty] == 0 || PlayerInfo[i][OnDuty] == 2) {
                    format(string, 128, "Level: %d - %s (Id:%i) | %s |  {FF0000}%s",PlayerInfo[i][Level], GetName(i),i,AdmRank,AdmDuty);
                    SendClientMessage(playerid, ChangeColor, string);
                    count++;
                }
                if(PlayerInfo[i][OnDuty] == 1) {
                    format(string, 128, "Level: %d - %s (Id:%i) | %s | {5EFF00}%s",PlayerInfo[i][Level], GetName(i),i,AdmRank,AdmDuty);
                    SendClientMessage(playerid, ChangeColor, string);
                    count++;
                }
            }
        }
    }
Now, if there is no any admin online in the list, Put it like this BELOW !

You can change these colours if you want

Code:
    if (count == 0)
    SendClientMessage(playerid,red,"No admin online in the list");
    SendClientMessage(playerid, COLOR_LIMEGREEN, "{5EFF00}________________________________________");
    SendClientMessage(playerid, red, " ");
    return 1;
}
And Let's put the last thing we need.

Code:
stock GetName(playerid)
{
    new name[24]; GetPlayerName(playerid, name, 24);
    return name;
}
That's it!

__________________________________________________ ______________________________________

For full, Copy this !

Code:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new count = 0;
    new string[128];
    new AdmRank[128];
    new AdmDuty[128];
    new ChangeColor;
    SendClientMessage(playerid, COLOR_LIMEGREEN, " ");
    SendClientMessage(playerid, COLOR_LIMEGREEN, "{5EFF00}___________ |- Online Admins -| ___________");
    SendClientMessage(playerid, COLOR_LIMEGREEN, " ");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if(PlayerInfo[i][Level] >= 1 && PlayerInfo[i][Hide] == 0)
            {
                if(IsPlayerAdmin(i))
                  {
                      AdmRank = "RCON Administrator";
                      ChangeColor = red;
                  }
                else
                {
                    switch(PlayerInfo[i][Level])
                    {
                        case 1: {
                            AdmRank = "Trial Moderator";
                            ChangeColor = COLOR_ORANGE;
                        }
                        case 2: {
                            AdmRank = "Junior Moderator";
                            ChangeColor = COLOR_GREEN;
                        }
                        case 3: {
                            AdmRank = "Super Moderator";
                            ChangeColor = COLOR_YELLOW;
                        }
                        case 4: {
                            AdmRank = "Administrator";
                            ChangeColor = COLOR_LIMEGREEN;
                        }
                        case 5: {
                            AdmRank = "Supreme Administrator";
                            ChangeColor = COLOR_WHITE;
                        }
                        case 6: {
                            AdmRank = "Expert Administrator";
                            ChangeColor = COLOR_ROYALBLUE;
                        }
                        case 7: {
                            AdmRank = "Delta Administrator";
                            ChangeColor = red;
                        }
                        case 8: {
                            AdmRank = "Alfa Administrator";
                            ChangeColor = red;
                        }
                    }
                }
                switch(PlayerInfo[i][OnDuty])
                {
                    case 0: AdmDuty = "Off Duty!";
                    case 1: AdmDuty = "On Duty!";
                    case 2: AdmDuty = "AFK!";
                }
                if(PlayerInfo[i][OnDuty] == 0 || PlayerInfo[i][OnDuty] == 2) {
                    format(string, 128, "Level: %d - %s (Id:%i) | %s |  {FF0000}%s",PlayerInfo[i][Level], GetName(i),i,AdmRank,AdmDuty);
                    SendClientMessage(playerid, ChangeColor, string);
                    count++;
                }
                if(PlayerInfo[i][OnDuty] == 1) {
                    format(string, 128, "Level: %d - %s (Id:%i) | %s | {5EFF00}%s",PlayerInfo[i][Level], GetName(i),i,AdmRank,AdmDuty);
                    SendClientMessage(playerid, ChangeColor, string);
                    count++;
                }
            }
        }
    }
    if (count == 0)
    SendClientMessage(playerid,red,"No admin online in the list");
    SendClientMessage(playerid, COLOR_LIMEGREEN, "{5EFF00}________________________________________");
    SendClientMessage(playerid, red, " ");
    return 1;
}

stock GetName(playerid)
{
    new name[24]; GetPlayerName(playerid, name, 24);
    return name;
}
Thanks!

+REP ME If i helped you !


Reply
#2

simple but good good job
Reply
#3

Thank you
Reply
#4

Are you kidding with me ?? You just copied this cmd from GMTDM and didn't update it even and you didn't explain what do every function do or anything and you didn't add what the usage of hide or onduty etc....... So bad just copy + paste
And asking for rep lol -_-
Reply
#5

Such a rep hunger.

You didn't even explain what everything does, and what variables can be actually changed to suit other's needs.

The best part is, it can't even compile.
Reply
#6

PHP Code:
#include <a_samp>
#include <zcmd>
#include <foreach>
#define scm SendClientMessage
#define red         -1
#define limegreen     -1
#define green        -1
#define orange        -1
#define yellow        -1
#define white        -1
#define royalblue    -1
enum pInfoEnum{
    
Name[24],
    
Level,
    
bool:Logged,
    
bool:AOD
};
new 
pInfo[MAX_PLAYERS][pInfoEnum];
CMD:admins(pid){
    
scm(pid,-1" ");
    
scm(pid,-1"{5EFF00}___________ |- Online Admins -| ___________");
    
scm(pid,-1" ");
    new 
arank[9][]={"RCON Administrator","Trial Moderator","Junior Moderator","Super Moderator","Administrator","Supreme Administrator","Expert Administrator",
    
"Delta Administrator","Alfa Administrator"};
    new 
acolor[9]={red,orange,green,yellow,limegreen,white,royalblue,red,red},str[120],cnt;
    foreach(
Player,i){
        if(
pInfo[i][Logged] && pInfo[i][Level] > || IsPlayerAdmin(i)){
            
format(str,sizeof(str),"%d > %s | %s | %s",++cnt,pInfo[i][Name],arank[IsPlayerAdmin(i)?0:pInfo[i][Level]],pInfo[i][AOD]?("{5EFF00}On Duty"):("{FF0000}Off Duty"));
            
scm(pid,acolor[IsPlayerAdmin(i)?0:pInfo[i][Level]],str);
        }
    }
    if(!
cnt)scm(pid,red,"No admins online!");
    return 
1;

Reply
#7

Quote:
Originally Posted by CodeStyle175
View Post
PHP Code:
#include <a_samp>
#include <zcmd>
#include <foreach>
#define scm SendClientMessage
#define red         -1
#define limegreen     -1
#define green        -1
#define orange        -1
#define yellow        -1
#define white        -1
#define royalblue    -1
enum pInfoEnum{
    
Name[24],
    
Level,
    
bool:Logged,
    
bool:AOD
};
new 
pInfo[MAX_PLAYERS][pInfoEnum];
CMD:admins(pid){
    
scm(pid,-1" ");
    
scm(pid,-1"{5EFF00}___________ |- Online Admins -| ___________");
    
scm(pid,-1" ");
    new 
arank[9][]={"RCON Administrator","Trial Moderator","Junior Moderator","Super Moderator","Administrator","Supreme Administrator","Expert Administrator",
    
"Delta Administrator","Alfa Administrator"};
    new 
acolor[9]={red,orange,green,yellow,limegreen,white,royalblue,red,red},str[120],cnt;
    foreach(
Player,i){
        if(
pInfo[i][Logged] && pInfo[i][Level] > || IsPlayerAdmin(i)){
            
format(str,sizeof(str),"%d > %s | %s | %s",++cnt,pInfo[i][Name],arank[IsPlayerAdmin(i)?0:pInfo[i][Level]],pInfo[i][AOD]?("{5EFF00}On Duty"):("{FF0000}Off Duty"));
            
scm(pid,acolor[IsPlayerAdmin(i)?0:pInfo[i][Level]],str);
        }
    }
    if(!
cnt)scm(pid,red,"No admins online!");
    return 
1;

Really You copied a cmd from ur gm Lols -_-
Reply
#8

LOL Asking for rep ... #pragma unused params is not needed ITS ZCMD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)