SA-MP Forums Archive
HELP /a command - 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: HELP /a command (/showthread.php?tid=565011)



HELP /a command - XYZero - 24.02.2015

Код:
CMD:a(playerid,params[])
{
        new string[128];
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
    if (IsPlayerConnected(i))
    		{
                GetPlayerName(i,PlayerName2(i),MAX_PLAYER_NAME);
                if(PlayerInfo[i][Level] == 1)
                {
                    format(string,sizeof(string), "{FF9900}[BasicVip]{09F911} %s (Level: %d) : %s",PlayerName2(i),PlayerInfo[i][Level], params );
                }
                else if(PlayerInfo[i][Level] == 2)
                {
                    format(string,sizeof(string), "{FF9900}[Vip]{09F911} %s (Level: %d) : %s",PlayerName2(i),PlayerInfo[i][Level], params );
                }
                else if(PlayerInfo[i][Level] == 3)
                {
                    format(string,sizeof(string), "{FF9900}[MasterVip]{09F911} %s (Level: %d) : %s",PlayerName2(i),PlayerInfo[i][Level], params );
                }
                else if(PlayerInfo[i][Level] == 4)
                {
                    format(string,sizeof(string), "{7CFC00}[Admin]{09F911} %s (Level: %d) : %s",PlayerName2(i),PlayerInfo[i][Level], params );
                }
                else if(PlayerInfo[i][Level] == 5)
                {
                    format(string,sizeof(string), "{1E90FF}[MasterAdmin]{09F911} %s (Level: %d) : %s",PlayerName2(i),PlayerInfo[i][Level], params );
                }
                else if(PlayerInfo[i][Level] == 6)
                {
                    format(string,sizeof(string), "{00FFFF}[ProAdmin]{09F911} %s (Level: %d) : %s",PlayerName2(i),PlayerInfo[i][Level], params );
                }
                else if(PlayerInfo[i][Level] == 7)
                {
                    format(string,sizeof(string), "[SuperAdmin]{09F911} %s (Level: %d) : %s",PlayerName2(i),PlayerInfo[i][Level], params );
                }
                else if(PlayerInfo[i][Level] == 8)
                {
                    format(string,sizeof(string), "{FF0000}[DeltaAdmin]{09F911} %s (Level: %d) : %s",PlayerName2(i),PlayerInfo[i][Level], params );
                }
	  	            MessageToAdmins(NICE_PINK,string);
      }
 	 	  }
	  	return 1;
}
Problem (example) : One of five admins online says Test, then all admins online say Test too in admin chat, but they don't say it. "sorry bad english"
Can someone fix the problem chat above?


Re: HELP /a command - De4dpOol - 24.02.2015

pawn Код:
CMD:a(playerid,params[])
{
        new string[128];
    if (IsPlayerConnected(playerid))
            {
                GetPlayerName(playerid,PlayerName2(playerid),MAX_PLAYER_NAME);
                if(PlayerInfo[playerid][Level] == 1)
                {
                    format(string,sizeof(string), "{FF9900}[BasicVip]{09F911} %s (Level: %d) : %s",PlayerName2(playerid),PlayerInfo[playerid][Level], params );
                }
                else if(PlayerInfo[playerid][Level] == 2)
                {
                    format(string,sizeof(string), "{FF9900}[Vip]{09F911} %s (Level: %d) : %s",PlayerName2(playerid),PlayerInfo[playerid][Level], params );
                }
                else if(PlayerInfo[playerid][Level] == 3)
                {
                    format(string,sizeof(string), "{FF9900}[MasterVip]{09F911} %s (Level: %d) : %s",PlayerName2(playerid),PlayerInfo[playerid][Level], params );
                }
                else if(PlayerInfo[playerid][Level] == 4)
                {
                    format(string,sizeof(string), "{7CFC00}[Admin]{09F911} %s (Level: %d) : %s",PlayerName2(playerid),PlayerInfo[playerid][Level], params );
                }
                else if(PlayerInfo[playerid][Level] == 5)
                {
                    format(string,sizeof(string), "{1E90FF}[MasterAdmin]{09F911} %s (Level: %d) : %s",PlayerName2(playerid),PlayerInfo[playerid][Level], params );
                }
                else if(PlayerInfo[playerid][Level] == 6)
                {
                    format(string,sizeof(string), "{00FFFF}[ProAdmin]{09F911} %s (Level: %d) : %s",PlayerName2(playerid),PlayerInfo[playerid][Level], params );
                }
                else if(PlayerInfo[playerid][Level] == 7)
                {
                    format(string,sizeof(string), "[SuperAdmin]{09F911} %s (Level: %d) : %s",PlayerName2(playerid),PlayerInfo[playerid][Level], params );
                }
                else if(PlayerInfo[playerid][Level] == 8)
                {
                    format(string,sizeof(string), "{FF0000}[DeltaAdmin]{09F911} %s (Level: %d) : %s",PlayerName2(playerid),PlayerInfo[playerid][Level], params );
                }
                    MessageToAdmins(NICE_PINK,string);
      }
        return 1;
}
You were looping through all the online players. It should work, not tested :P


Re: HELP /a command - XYZero - 24.02.2015

Wooow, thank you
it works, but I'll try to chat when two or more admins online :P once again thank you