/admin cmd prob
#1

PHP код:
CMD:admins(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] > 0)
    {
        new 
string[50], string2[50];
        
SendClientMessage(playeridCOLOR_YELLOW"Online Administrators:");
        foreach(new 
Player)
        {
            if(
PlayerInfo[i][pAdmin] >= 0)
            {
                
GetPlayerName(istring2sizeof(string2));
                
format(stringsizeof(string), "%s | Admin Level: %d"string2PlayerInfo[i][pAdmin]);
                
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
            }
        }
        return 
1;
    }
    return 
1;

I've created a simple cmd to show online administrators, but I can't find a way to show that cmd to players with level 0.
+reppin for helpers. Thanks
Reply
#2

Quote:
Originally Posted by rakinz
Посмотреть сообщение
PHP код:
CMD:admins(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] > 0)
    {
        new 
string[50], string2[50];
        
SendClientMessage(playeridCOLOR_YELLOW"Online Administrators:");
        foreach(new 
Player)
        {
            if(
PlayerInfo[i][pAdmin] >= 0)
            {
                
GetPlayerName(istring2sizeof(string2));
                
format(stringsizeof(string), "%s | Admin Level: %d"string2PlayerInfo[i][pAdmin]);
                
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
            }
        }
        return 
1;
    }
    return 
1;

I've created a simple cmd to show online administrators, but I can't find a way to show that cmd to players with level 0.
+reppin for helpers. Thanks
Try


Код:
CMD:admins(playerid, params[]) 
{ 
        new string[50], string2[50]; 
        SendClientMessage(playerid, COLOR_YELLOW, "Online Administrators:"); 
        foreach(new i : Player) 
        { 
            if(PlayerInfo[i][pAdmin] >= 0) 
            { 
                GetPlayerName(i, string2, sizeof(string2)); 
                format(string, sizeof(string), "%s | Admin Level: %d", string2, PlayerInfo[i][pAdmin]); 
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string); 
            } 
        } 
        return 1; 
    } 
    return 1; 
}
Reply
#3

Quote:
Originally Posted by Ryan50
Посмотреть сообщение
Try


Код:
CMD:admins(playerid, params[]) 
{ 
        new string[50], string2[50]; 
        SendClientMessage(playerid, COLOR_YELLOW, "Online Administrators:"); 
        foreach(new i : Player) 
        { 
            if(PlayerInfo[i][pAdmin] >= 0) 
            { 
                GetPlayerName(i, string2, sizeof(string2)); 
                format(string, sizeof(string), "%s | Admin Level: %d", string2, PlayerInfo[i][pAdmin]); 
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string); 
            } 
        } 
        return 1; 
    } 
    return 1; 
}
I've tried that too **btw the return 1;} in the end is useless
The problem is when you make the command like that on the admin list you're getting shown with level 0.
Reply
#4

Quote:
Originally Posted by rakinz
Посмотреть сообщение
I've tried that too **btw the return 1;} in the end is useless
The problem is when you make the command like that on the admin list you're getting shown with level 0.
it should be.
you don't need
Код:
if(PlayerInfo[playerid][pAdmin] > 0)
on top


Код:
CMD:admins(playerid, params[]) 
{ 
    if(PlayerInfo[playerid][pAdmin] > 0) 
    { 
        new string[50], string2[50]; 
        SendClientMessage(playerid, COLOR_YELLOW, "Online Administrators:"); 
        foreach(new i : Player) 
        { 
            if(PlayerInfo[i][pAdmin] >= 1) // set the number you want to show in /admins
            { 
                GetPlayerName(i, string2, sizeof(string2)); 
                format(string, sizeof(string), "%s | Admin Level: %d", string2, PlayerInfo[i][pAdmin]); 
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string); 
            } 
        } 
        return 1; 
    } 
    return 1; 
}
OR

Код:
CMD:admins(playerid, params[]) 
{ 
        new string[50], string2[50]; 
        SendClientMessage(playerid, COLOR_YELLOW, "Online Administrators:"); 
        foreach(new i : Player) 
        { 
            if(PlayerInfo[i][pAdmin] >= 1) 
            { 
                GetPlayerName(i, string2, sizeof(string2)); 
                format(string, sizeof(string), "%s | Admin Level: %d", string2, PlayerInfo[i][pAdmin]); 
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string); 
            } 
        } 
        return 1; 
    } 
    return 1; 
}
Reply
#5

Thanks man +repped ya..

This is the final code for who wishes it:

PHP код:
CMD:admins(playeridparams[])
{
new 
string[50], string2[50];
foreach(new 
Player)
{
if(
PlayerInfo[i][pAdmin] > 0)
{
SendClientMessage(playeridCOLOR_YELLOW"Online Administrators:");
GetPlayerName(istring2sizeof(string2));
format(stringsizeof(string), "%s | Admin Level: %d"string2PlayerInfo[i][pAdmin]);
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
}
}
return 
1;

if needed use in the end of the code more return 1;}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)