/Admins Command
#1

Ok, so basically, i need this to show ALL admins that are online, not just one of em. I'm completely lost as to why it won't.

Code:
dcmd_admins(playerid,params[])
{
	#pragma unused params
	//new count = 0;
	new string[128];
	for(new i = 0; i <MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        if(AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
	        {
	            if(AccInfo[i][Level] > 5)
	            {
	                AdmRank = "Server Owner";
				}
				if(IsPlayerAdmin(i))
				{
				    AdmRank = "RCON Administrator";
				}
				else
				{
				    switch(AccInfo[i][Level])
				    {
				        case 1: {
				        AdmRank = "Trial Moderator";
						}
						case 2: {
						AdmRank = "Moderator";
						}
						case 3: {
						AdmRank = "Administrator";
						}
						case 4: {
						AdmRank = "Senior Administrator";
						}
						case 5: {
						AdmRank = "Community Leader";
						}
					}
				}
				format(string, sizeof(string), "%s (Id:%i) | %s",PlayerName2(i),i,AdmRank);
				ShowPlayerDialog(playerid, 668, DIALOG_STYLE_MSGBOX, "Online Administrators",string,"Submit","Cancel");
				return 1;
			}
		}
	}
	return 1;
}
Reply
#2

Remove return 1, from the inside of the loop.

EDIT: Use [pawn] tags not [code], there may be more wrong with the code but i CBA looking through code with poo indentation.
Reply
#3

PHP Code:
dcmd_admins(playerid,params[])
{
    
#pragma unused params
    //new count = 0;
    
new string[128];
    new 
PlayerName2[MAX_PLAYER_NAME];
    for(new 
0<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
AccInfo[i][Level] >= && AccInfo[i][Hide] == 0)
            {
                if(
AccInfo[i][Level] > 5)
                {
                    
AdmRank "Server Owner";
                }
                if(
IsPlayerAdmin(i))
                {
                    
AdmRank "RCON Administrator";
                }
                else
                {
                    switch(
AccInfo[i][Level])
                    {
                        case 
1AdmRank "Trial Moderator";
                        case 
2AdmRank "Moderator";
                        case 
3AdmRank "Administrator";
                        case 
4AdmRank "Senior Administrator";
                        case 
5AdmRank "Community Leader";
                    }
                }
                
GetPlayerName(iPlayerName2MAX_PLAYER_NAME);
                
format(stringsizeof(string), "%s (Id:%i) | %s"PlayerName2iAdmRank);
                
ShowPlayerDialog(playerid668DIALOG_STYLE_MSGBOX"Online Administrators",string,"Submit","Cancel");
            }
        }
    }
    return 
1;

There was a problem with the "PlayerName2(i)" lines, since you've never defined that variable perhaps? Unless that's a function of course.
Reply
#4

Quote:
Originally Posted by Income
View Post
PHP Code:
dcmd_admins(playerid,params[])
{
    
#pragma unused params
    //new count = 0;
    
new string[128];
    new 
PlayerName2[MAX_PLAYER_NAME];
    for(new 
0<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
AccInfo[i][Level] >= && AccInfo[i][Hide] == 0)
            {
                if(
AccInfo[i][Level] > 5)
                {
                    
AdmRank "Server Owner";
                }
                if(
IsPlayerAdmin(i))
                {
                    
AdmRank "RCON Administrator";
                }
                else
                {
                    switch(
AccInfo[i][Level])
                    {
                        case 
1AdmRank "Trial Moderator";
                        case 
2AdmRank "Moderator";
                        case 
3AdmRank "Administrator";
                        case 
4AdmRank "Senior Administrator";
                        case 
5AdmRank "Community Leader";
                    }
                }
                
GetPlayerName(iPlayerName2MAX_PLAYER_NAME);
                
format(stringsizeof(string), "%s (Id:%i) | %s"PlayerName2iAdmRank);
                
ShowPlayerDialog(playerid668DIALOG_STYLE_MSGBOX"Online Administrators",string,"Submit","Cancel");
            }
        }
    }
    return 
1;

There was a problem with the "PlayerName2(i)" lines, since you've never defined that variable perhaps? Unless that's a function of course.
Nah, PlayerName2 seems to be a function on this thing, i'm using the LuxAdmin script at the moment for this. But either way i still can't get /admins to work, and don't know what i'm doing wrong here
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)