Is can put all admins in one line? +Rep!!
#1

hello, i'v admin lux system but when i type /admins , every admin got his line asthis:
Admins: Player1(Manager)
Admins: Player2(Leader)
Admins: Player3(Manager)
..
..
etc
How to put all the admins in one line :
Admins: Player1(Manager),Player2(Leader),Player3(Manager). .etc

I 'v here my code:-

Код:
dcmd_admins(playerid,params[])
{
    #pragma unused params
        new count = 0;
        new string[128];
        new ChangeColor;
		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 = "{00C0FF}Manager";
						ChangeColor = Color_Professional_Admin;
					}
 					if(IsPlayerAdmin(i))
				  	{
				  		AdmRank = "{6EF83C}Logged with Rcon";
				  		ChangeColor = Color_RCON_Administrator;
				  	}
				    else
				    {
				 		switch(AccInfo[i][Level])
						{
							case 1: {
							AdmRank = "{6EF83C}Trail Mod";
							ChangeColor = Color_Basic_Moderator;
							}
							case 2: {
							AdmRank = "{C3C3C3}Mod";
							ChangeColor = Color_Moderator;
							}
							case 3: {
							AdmRank = "{00C0FF}Admin";
							ChangeColor = Color_Master_Moderator;
							}
							case 4: {
							AdmRank = "{F3FF02}Leader";
							ChangeColor = Color_Administrator;
							}
							case 5: {
							AdmRank = "{C3C3C3}CO-Manager";
							ChangeColor = Color_Master_Administrator;
							}
						}
					}
		 			switch(AccInfo[i][OnDuty])
					{
						case 0: AdmDuty = "Playing!";
						case 1: AdmDuty = "On Duty!";
					}
					format(string, 128, "Admins: {F81414}%s {F81414}[%s{F81414}]",PlayerName2(i),AdmRank);
					SendClientMessage(playerid, ChangeColor, string);
					count++;
				}
			}
		}
		if (count == 0)
		SendClientMessage(playerid,orange,"{C77D87}No {F3FF02}Administrators {C77D87}online {FFFFFF},{C77D87}Try to invite {F3FF02}them!");
		return 1;
}
Anyone can help got +rep!
Reply
#2

You should be able to do it like this:
use strcat to take the admin names together:

pawn Код:
dcmd_admins(playerid,params[])
{
    #pragma unused params
        new count = 0;
        new string[128];
        new ChangeColor;
        new wholestring[126];//new string here to have all the admin names in it
        format(wholestring, sizeof(wholestring), "Admins: ");//just doing this to set the Admins: in start of the line
        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 = "{00C0FF}Manager";
                        ChangeColor = Color_Professional_Admin;
                    }
                    if(IsPlayerAdmin(i))
                    {
                        AdmRank = "{6EF83C}Logged with Rcon";
                        ChangeColor = Color_RCON_Administrator;
                    }
                    else
                    {
                        switch(AccInfo[i][Level])
                        {
                            case 1: {
                            AdmRank = "{6EF83C}Trail Mod";
                            ChangeColor = Color_Basic_Moderator;
                            }
                            case 2: {
                            AdmRank = "{C3C3C3}Mod";
                            ChangeColor = Color_Moderator;
                            }
                            case 3: {
                            AdmRank = "{00C0FF}Admin";
                            ChangeColor = Color_Master_Moderator;
                            }
                            case 4: {
                            AdmRank = "{F3FF02}Leader";
                            ChangeColor = Color_Administrator;
                            }
                            case 5: {
                            AdmRank = "{C3C3C3}CO-Manager";
                            ChangeColor = Color_Master_Administrator;
                            }
                        }
                    }
                    switch(AccInfo[i][OnDuty])
                    {
                        case 0: AdmDuty = "Playing!";
                        case 1: AdmDuty = "On Duty!";
                    }
                    format(string, 128, "{F81414}%s {F81414}[%s{F81414}]",PlayerName2(i),AdmRank);
                    strcat(wholestring, string, sizeof(wholestring));//here i add the string from the loop to the wholestring
                    count++;
                }
            }
        }
        if (count == 0)
        SendClientMessage(playerid,orange,"{C77D87}No {F3FF02}Administrators {C77D87}online {FFFFFF},{C77D87}Try to invite {F3FF02}them!");
                      else{
                      SendClientMessage(playerid, COLOR_YELLOW, wholestring);//and here i send the message wholestring :D
                      }
        return 1;
}
I think that should work, (not tested)

Hope I helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)