/admins help
#1

The command is working but if its 2 players online it will send the "admins online" twice, and if its 1 online once, and if its 3 online it will send it 3 times. Help? Thanks!
Код:
YCMD:admins(playerid, params[], help)
{
        #pragma unused help
        new
			string[128];

        foreach(Player, i) {
		if(P_Data[i][pAdmin] == 1) { format(string,sizeof(string),""COL_GREEN"Helper %s",GetName(i)); }
        else if(P_Data[i][pAdmin] == 2) { format(string,sizeof(string),""COL_GREEN"Jr.Moderator %s",GetName(i)); }
        else if(P_Data[i][pAdmin] == 3) { format(string,sizeof(string),""COL_GREEN"Moderator %s",GetName(i)); }
        else if(P_Data[i][pAdmin] == 4) { format(string,sizeof(string),""COL_GREEN"Admin %s",GetName(i)); }
        else if(P_Data[i][pAdmin] == 5) { format(string,sizeof(string),""COL_GREEN"Owner %s",GetName(i)); }
		if(IsPlayerAdmin(i)) { format(string,sizeof(string),""COL_GREEN"RCON Admin %s",GetName(i)); }
		SCM(playerid,-1,"Admins online:");
		SCM(playerid,-1,string); }
        return 1;
}
Reply
#2

Help anyone?
Reply
#3

Put
pawn Код:
SCM(playerid,-1,"Admins online:");
somewhere out of the foreach loop (Above it?).
Reply
#4

I did that but now is it:
Admins Online:
A EMPTY SPACE HERE
Owner - My name
Reply
#5

pawn Код:
YCMD:admins(playerid, params[], help)
{
        #pragma unused help
        new
            string[128];
        new bool:flag=false;

        foreach(Player, i) {
        if(P_Data[i][pAdmin] == 1) { format(string,sizeof(string),""COL_GREEN"Helper %s",GetName(i)); }
        else if(P_Data[i][pAdmin] == 2) { format(string,sizeof(string),""COL_GREEN"Jr.Moderator %s",GetName(i)); }
        else if(P_Data[i][pAdmin] == 3) { format(string,sizeof(string),""COL_GREEN"Moderator %s",GetName(i)); }
        else if(P_Data[i][pAdmin] == 4) { format(string,sizeof(string),""COL_GREEN"Admin %s",GetName(i)); }
        else if(P_Data[i][pAdmin] == 5) { format(string,sizeof(string),""COL_GREEN"Owner %s",GetName(i)); }
        if(IsPlayerAdmin(i)) { if(flag==false){flag=true;SCM(playerid,-1,"Admins online:");}
        format(string,sizeof(string),""COL_GREEN"RCON Admin %s",GetName(i)); }
        SCM(playerid,-1,string); }
        return 1;
}
Reply
#6

Still not working its sending it multiple times: admin name
and again: admin name etc
Reply
#7

Can you show us what SCM is?
Reply
#8

SMC= SendClientMessage
Reply
#9

You guys put the "Admins online:" inside the loop. Place it outside the loop and it won't repeat.
Reply
#10

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
You guys put the "Admins online:" inside the loop. Place it outside the loop and it won't repeat.
Actually the problem is if there is no admins, then it shouldn't be written. But still, I don't see why my code doesn't work Lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)