15.07.2015, 20:44
Hey,
i tried to create a cmd for admins that shows the muted players..
/mute and /unmute are working perfectly, even the /muted cmd , but with a small problem..
The problem is when 2 players are muted it shows the last muted player in the dialog. Here's my code :
Any help please? +rep for the one who helps me.
Thank you in advance.
i tried to create a cmd for admins that shows the muted players..
/mute and /unmute are working perfectly, even the /muted cmd , but with a small problem..
The problem is when 2 players are muted it shows the last muted player in the dialog. Here's my code :
PHP код:
CMD:muted(playerid, params[])
{
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1)
{
new iname[MAX_PLAYER_NAME], string[128], count = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(Muted[i] == 1)
{
GetPlayerName(i, iname, sizeof(iname));
format(string, sizeof(string), "- %s (%d).\n", iname, i, Muted[i]);
count ++;
}
}
}
if(count > 0)
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Muted players", string, "OK", "");
}
else ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Muted players", "No players muted at the moment.", "OK", "");
}
else SendClientMessage(playerid, error,"You are not authorized to use that command.");
return 1;
}
Thank you in advance.