[Help] Player Command
#1

Someone know why it does't working?, he compiles, but ingame it just do not work

PHP код:
CMD:adminlist(playeridparams[])
{
    new 
nomeadmintrabalho[MAX_PLAYER_NAME];
    new 
nomeadminjogo[MAX_PLAYER_NAME];
    new 
admlevel;
    new 
admtrabalhando;
    new 
count 0;
    for(new 
0MAX_PLAYERSi++)
    {   
        if(
IsPlayerConnected(i))
        {
            if((
IsPlayerAdmin(i)) && (GetPlayerAdminLevel(i) >= 2))
            {
                
GetPlayerName(inomeadmintrabalhosizeof(nomeadmintrabalho));
                
GetPlayerAdminLevel(i);
                if(
IsPlayerOnAdminDuty(i))
                {
                    
admtrabalhando 1;
                }
                else
                {
                    
admtrabalhando 2;
                }
                new 
rank[24];
                new 
checagem[50];
                switch(
admlevel)
                {
                    case 
1rank "Ajudante";
                    case 
2rank "Admin 1";
                    case 
3rank "Admin 2";
                    case 
4rank "Admin 3";
                    case 
5rank "Admin Master";
                    case 
6rank "CEO Servidor";
                }
                switch(
admtrabalhando)
                {
                    case 
1checagem "Trabalhando";
                    case 
2checagem "Jogador";
                }
                new 
str[1000];
                
format(strsizeof(str), "[%s] %s (%s)"ranknomeadmintrabalhochecagem);
                
SendClientMessage(playerid, -1str);
                
count++;
                
            }
        }
    }
    return 
1;

Reply
#2

pawn Код:
CMD:adminlist(playerid, params[])
{
    new nomeadmintrabalho[MAX_PLAYER_NAME];
    new nomeadminjogo[MAX_PLAYER_NAME];
    new count = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if((IsPlayerAdmin(i)) && (GetPlayerAdminLevel(i) >= 2))
            {
                GetPlayerName(i, nomeadmintrabalho, sizeof(nomeadmintrabalho));
                new rank[24];
                new checagem[50];
                switch(GetPlayerAdminLevel(i))
                {
                    case 1: rank = "Ajudante";
                    case 2: rank = "Admin 1";
                    case 3: rank = "Admin 2";
                    case 4: rank = "Admin 3";
                    case 5: rank = "Admin Master";
                    case 6: rank = "CEO Servidor";
                }
                switch(IsPlayerOnAdminDuty(i))
                {
                    case 1: checagem = "Trabalhando";
                    case 2: checagem = "Jogador";
                }
                new str[1000];
                format(str, sizeof(str), "[%s] %s (%s)", rank, nomeadmintrabalho, checagem);
                SendClientMessage(playerid, -1, str);
                count++;

            }
        }
    }
    return 1;
}
Can you please provide IsPlayerOnAdminDuty and GetPlayerAdminLevel code, i just want to make sure i didn't do it wrong.
Also what have you used
pawn Код:
count++
for?
Reply
#3

Here:

PHP код:
stock IsPlayerOnAdminDuty(playerid)
{
    if(!
IsPlayerConnected(playerid))
        return 
0;
    return 
admin_OnDuty[playerid];

And:

PHP код:
stock GetPlayerAdminLevel(playerid)
{
    if(!
IsPlayerConnected(playerid))
        return 
0;
    return 
admin_Level[playerid];

I had made a count to indicate when there are no admins online, but I did not and forgot to remove the "count ++"
Reply
#4

Try the command i provided, also you just need to use that count++ before you send the client message and then you do
pawn Код:
if(count == 0)
{
    return SendClientMessage(playerid, -1, "There's no admin online at the moment.");
}
else
{
    new str[1000];
    format(str, sizeof(str), "[%s] %s (%s)", rank, nomeadmintrabalho, checagem);
    SendClientMessage(playerid, -1, str);
    count = 0; //we set this back to 0 so it won't duplicate the value next /adminlist usage.
}
Reply
#5

It doesn't works, i put the command and just nothing happens
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)