Admin Status
#1

Okay.. I created a Available/Busy Command for the admins on the staff list In Game.. But its kinda bugged.. if you do /astatus it says that you are Busy.. But the whole Staff team is Busy then,. Same as by Availabe, how can i create it that everyplayer can see for his self who is available and not available(sorry for my bad english) +rep if you help me

pawn Код:
CMD:staff(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");

    SendClientMessage(playerid,COLOR_ORANGE, "Administrators:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdmin])
        if(Busy[playerid] == 0)
        {
                format(string, sizeof(string), "Name: %s Level: %d{1EFF00}(Available)", RPN(i),PlayerInfo[i][pAdmin]);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(Busy[playerid] == 1)
        {
                format(string, sizeof(string), "Name: %s Level: %d{FF0000}(Busy)", RPN(i),PlayerInfo[i][pAdmin]);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
          }
    }
    SendClientMessage(playerid,COLOR_ORANGE, "Moderators:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pMod])
        if(Busy[playerid] == 0)
        {
                format(string, sizeof(string), "Name: %s{1EFF00}(Available)", RPN(i));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(Busy[playerid] == 1)
        {
                format(string, sizeof(string), "{FF0000}Name: %s(Busy)", RPN(i));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
    }
    SendClientMessage(playerid,COLOR_ORANGE, "Helpers:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pHelper])
        {
                format(string, sizeof(string), "Name: %s", RPN(i));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
    }
    return 1;
}
pawn Код:
CMD:astatus(playerid,params[])
{
    if(!PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(Busy[playerid] == 0)
    {
        Busy[playerid] = 1;
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You setted your self busy on the staff list");
    }
    else
    {
        Busy[playerid] = 0;
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You setted your self Available on the staff list");
    }
    return 1;
}
Reply
#2

Try this:
pawn Код:
CMD:staff(playerid, params[])
{
* * new string[128];
* * if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");

* * SendClientMessage(playerid,COLOR_ORANGE, "Administrators:");
* * foreach(Player, i)
* * {
* * * * if(PlayerInfo[i][pAdmin] >= 1)
        {
* * * * if(Busy[playerid] == 0)
* * * * {
* * * * * * * * format(string, sizeof(string), "Name: %s Level: %d{1EFF00}(Available)", RPN(i),PlayerInfo[i][pAdmin]);
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * }
* * * * else if(Busy[playerid] == 1)
* * * * {
* * * * * * * * format(string, sizeof(string), "Name: %s Level: %d{FF0000}(Busy)", RPN(i),PlayerInfo[i][pAdmin]);
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * *}
         }
* * }
* * SendClientMessage(playerid,COLOR_ORANGE, "Moderators:");
* * foreach(Player, i)
* * {
* * * * if(PlayerInfo[i][pMod] >= 1)
        {
* * * * if(Busy[playerid] == 0)
* * * * {
* * * * * * * * format(string, sizeof(string), "Name: %s{1EFF00}(Available)", RPN(i));
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * }
* * * * else if(Busy[playerid] == 1)
* * * * {
* * * * * * * * format(string, sizeof(string), "{FF0000}Name: %s(Busy)", RPN(i));
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * }
        }
* * }
* * SendClientMessage(playerid,COLOR_ORANGE, "Helpers:");
* * foreach(Player, i)
* * {
* * * * if(PlayerInfo[i][pHelper] >= 1)
* * * * {
* * * * * * * * format(string, sizeof(string), "Name: %s", RPN(i));
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * }
* * }
* * return 1;
}
Reply
#3

Quote:
Originally Posted by biker122
Посмотреть сообщение
Try this:
pawn Код:
CMD:staff(playerid, params[])
{
* * new string[128];
* * if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");

* * SendClientMessage(playerid,COLOR_ORANGE, "Administrators:");
* * foreach(Player, i)
* * {
* * * * if(PlayerInfo[i][pAdmin] >= 1)
        {
* * * * if(Busy[playerid] == 0)
* * * * {
* * * * * * * * format(string, sizeof(string), "Name: %s Level: %d{1EFF00}(Available)", RPN(i),PlayerInfo[i][pAdmin]);
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * }
* * * * else if(Busy[playerid] == 1)
* * * * {
* * * * * * * * format(string, sizeof(string), "Name: %s Level: %d{FF0000}(Busy)", RPN(i),PlayerInfo[i][pAdmin]);
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * *}
         }
* * }
* * SendClientMessage(playerid,COLOR_ORANGE, "Moderators:");
* * foreach(Player, i)
* * {
* * * * if(PlayerInfo[i][pMod] >= 1)
        {
* * * * if(Busy[playerid] == 0)
* * * * {
* * * * * * * * format(string, sizeof(string), "Name: %s{1EFF00}(Available)", RPN(i));
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * }
* * * * else if(Busy[playerid] == 1)
* * * * {
* * * * * * * * format(string, sizeof(string), "{FF0000}Name: %s(Busy)", RPN(i));
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * }
        }
* * }
* * SendClientMessage(playerid,COLOR_ORANGE, "Helpers:");
* * foreach(Player, i)
* * {
* * * * if(PlayerInfo[i][pHelper] >= 1)
* * * * {
* * * * * * * * format(string, sizeof(string), "Name: %s", RPN(i));
* * * * * * * * SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
* * * * }
* * }
* * return 1;
}
Nope its not working still the same issue
Reply
#4




You can see the issue here
Reply
#5

pawn Код:
CMD:staff(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");

    SendClientMessage(playerid,COLOR_ORANGE, "Administrators:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdmin])
        {
            if(Busy[i] == 0) // You were placing "playerid" in Busy[playerid] instead of Busy[i] which only shows that if you're busy, they're all busy.
            {
                    format(string, sizeof(string), "Name: %s Level: %d{1EFF00}(Available)", RPN(i),PlayerInfo[i][pAdmin]);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            }
            else if(Busy[i] == 1) // Same goes here
            {
                    format(string, sizeof(string), "Name: %s Level: %d{FF0000}(Busy)", RPN(i),PlayerInfo[i][pAdmin]);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            }
        }
    }
    SendClientMessage(playerid,COLOR_ORANGE, "Moderators:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pMod])
        {
            if(Busy[i] == 0) // Same goes here
            {
                    format(string, sizeof(string), "Name: %s{1EFF00}(Available)", RPN(i));
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            }
            else if(Busy[i] == 1) // Same goes here.
            {
                    format(string, sizeof(string), "{FF0000}Name: %s(Busy)", RPN(i));
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            }
        }
    }
    SendClientMessage(playerid,COLOR_ORANGE, "Helpers:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pHelper])
        {
                format(string, sizeof(string), "Name: %s", RPN(i));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
    }
    return 1;
}
btw ignore the // the code itself that i just posted is the fixed version, i'm just showing you what was wrong.
Reply
#6

Okay, let me help you, add on the PlayerInfo enum "Busy". Not sure if it works, because I did not test it!

Then replace the old astatus with this one:
Код:
CMD:astatus(playerid,params[])
{
    if(!PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(PlayerInfo[playerid][Busy] == 0)
    {
        Busy[playerid] = 1;
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You setted your self busy on the staff list.");
    }
    else if(PlayerInfo[playerid][Busy] == 1)
    {
        Busy[playerid] = 0;
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You setted your self Available on the staff list.");
    }
    return 1;
}
And then replace staff command with this one:

Код:
CMD:staff(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");

    SendClientMessage(playerid,COLOR_ORANGE, "Administrators:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdmin])
        if(PlayerInfo[i][Busy] == 0)
        {
                format(string, sizeof(string), "Name: %s Level: %d{1EFF00}(Available)", RPN(i),PlayerInfo[i][pAdmin]);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(PlayerInfo[i][Busy == 1)
        {
                format(string, sizeof(string), "Name: %s Level: %d{FF0000}(Busy)", RPN(i),PlayerInfo[i][pAdmin]);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
          }

    }
    SendClientMessage(playerid,COLOR_ORANGE, "Moderators:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pMod])
        if(PlayerInfo[i][Busy] == 0)
        {
                format(string, sizeof(string), "Name: %s{1EFF00}(Available)", RPN(i));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(PlayerInfo[i][Busy] == 1)
        {
                format(string, sizeof(string), "{FF0000}Name: %s(Busy)", RPN(i));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
		}
    SendClientMessage(playerid,COLOR_ORANGE, "Helpers:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pHelper])
        {
                format(string, sizeof(string), "Name: %s", RPN(i));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by Turn
Посмотреть сообщение
pawn Код:
CMD:staff(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");

    SendClientMessage(playerid,COLOR_ORANGE, "Administrators:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdmin])
        {
            if(Busy[i] == 0) // You were placing "playerid" in Busy[playerid] instead of Busy[i] which only shows that if you're busy, they're all busy.
            {
                    format(string, sizeof(string), "Name: %s Level: %d{1EFF00}(Available)", RPN(i),PlayerInfo[i][pAdmin]);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            }
            else if(Busy[i] == 1) // Same goes here
            {
                    format(string, sizeof(string), "Name: %s Level: %d{FF0000}(Busy)", RPN(i),PlayerInfo[i][pAdmin]);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            }
        }
    }
    SendClientMessage(playerid,COLOR_ORANGE, "Moderators:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pMod])
        {
            if(Busy[i] == 0) // Same goes here
            {
                    format(string, sizeof(string), "Name: %s{1EFF00}(Available)", RPN(i));
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            }
            else if(Busy[i] == 1) // Same goes here.
            {
                    format(string, sizeof(string), "{FF0000}Name: %s(Busy)", RPN(i));
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            }
        }
    }
    SendClientMessage(playerid,COLOR_ORANGE, "Helpers:");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pHelper])
        {
                format(string, sizeof(string), "Name: %s", RPN(i));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
    }
    return 1;
}
btw ignore the // the code itself that i just posted is the fixed version, i'm just showing you what was wrong.
Works thanks!! +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)