SA-MP Forums Archive
/admins help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /admins help (/showthread.php?tid=365318)



/admins help - mrsamp - 02.08.2012

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;
}



Re: /admins help - mrsamp - 02.08.2012

Help anyone?


Re: /admins help - [KHK]Khalid - 02.08.2012

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


Re: /admins help - mrsamp - 02.08.2012

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


Re: /admins help - Roko_foko - 02.08.2012

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;
}



Re: /admins help - mrsamp - 02.08.2012

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


Re: /admins help - TheArcher - 02.08.2012

Can you show us what SCM is?


Re: /admins help - Roko_foko - 02.08.2012

SMC= SendClientMessage


Re: /admins help - Kingunit - 02.08.2012

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


Re: /admins help - Roko_foko - 02.08.2012

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.