muted players
#1

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 :
PHP код:
CMD:muted(playeridparams[])
{
  if(
IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1)
  {
    new 
iname[MAX_PLAYER_NAME], string[128], count 0;
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
           if(
Muted[i] == 1)
           {
                
GetPlayerName(iinamesizeof(iname));
                
format(stringsizeof(string), "- %s (%d).\n"inameiMuted[i]);
                
count ++;
           }
        }
    }
    if(
count 0)
    {
        
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players"string"OK""");
    }
    else 
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players""No players muted at the moment.""OK""");
  }
  else 
SendClientMessage(playeriderror,"You are not authorized to use that command.");
  return 
1;

Any help please? +rep for the one who helps me.
Thank you in advance.
Reply
#2

Quote:
Originally Posted by Moudix
Посмотреть сообщение
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 :
PHP код:
CMD:muted(playeridparams[])
{
  if(
IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1)
  {
    new 
iname[MAX_PLAYER_NAME], string[128], count 0;
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
           if(
Muted[i] == 1)
           {
                
GetPlayerName(iinamesizeof(iname));
                
format(stringsizeof(string), "- %s (%d).\n"inameiMuted[i]);
                
count ++;
           }
        }
    }
    if(
count 0)
    {
        
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players"string"OK""");
    }
    else 
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players""No players muted at the moment.""OK""");
  }
  else 
SendClientMessage(playeriderror,"You are not authorized to use that command.");
  return 
1;

Any help please? +rep for the one who helps me.
Thank you in advance.
Try this string size should be more to show more players names .
it will show only 1 or 2 name for if you use string[128].
PHP код:
CMD:muted(playeridparams[]) 

  if(
IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1
  { 
    new 
iname[MAX_PLAYER_NAME], string[500], count 0
    for(new 
0MAX_PLAYERSi++) 
    { 
        if(
IsPlayerConnected(i)) 
        { 
           if(
Muted[i] == 1
           { 
                
GetPlayerName(iinamesizeof(iname)); 
                
format(stringsizeof(string), "- %s (%d).\n"inameiMuted[i]); 
                
count ++; 
           } 
        } 
    } 
    if(
count 0
    { 
        
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players"string"OK"""); 
    } 
    else 
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players""No players muted at the moment.""OK"""); 
  } 
  else 
SendClientMessage(playeriderror,"You are not authorized to use that command."); 
  return 
1

Reply
#3

Same problem bro.. even the first 2 names doesnt have 128 characters.
Still need help.
Reply
#4

Try this.

PHP код:
CMD:mute(playeridparams[])
{
    if(
PlayaInfo[playerid][pAdministrator] >= 137)
    {
        new 
string[128], giveplayerid;
        if(
sscanf(params"u"giveplayerid)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /mute [player]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
giveplayerid == playerid)
            {
                
SendClientMessage(playeridCOLOR_RED"You can not use this command on yourself!");
                return 
1;
            }
            if(
PlayaInfo[giveplayerid][pMuted] == 0)
            {
                if(
PlayaInfo[giveplayerid][pAdministrator] >= PlayaInfo[playerid][pAdministrator])
                {
                    
format(stringsizeof(string), "%s just tried to /mute you.",GetPlayerName(playerid));
                    
SendClientMessage(giveplayeridCOLOR_YELLOWstring);
                    
SendClientMessage(playeridCOLOR_WHITE"You can't perform this action on an equal or higher level administrator.");
                    return 
1;
                }
                
PlayaInfo[giveplayerid][pMuted] = 1;
                
format(stringsizeof(string), "Admin Broadcast: %s was silenced by %s.",GetPlayerName(giveplayerid),GetPlayerName(playerid));
                
AMessage(COLOR_LIGHTRED,string,2);
            }
            else
            {
                
PlayaInfo[giveplayerid][pMuted] = 0;
                
format(stringsizeof(string), "Admin Broadcast: %s was unsilenced by %s.",GetPlayerName(giveplayerid),GetPlayerName(playerid));
                
AMessage(COLOR_LIGHTRED,string,2);
            }
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"You are not authorized to use that command.");
    }
    return 
1;

Its coming from my script you can maybe use it, edit it how you have your systems.
Reply
#5

PHP код:
new Rstring[500];
CMD:muted(playeridparams[])  
{  
  if(
IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1)  
  {  
    
strdel(Rstring,0,500);
    new 
iname[MAX_PLAYER_NAME], string[128], count 0;  
    for(new 
0MAX_PLAYERSi++)  
    {  
        if(
IsPlayerConnected(i))  
        {  
           if(
Muted[i] == 1)  
           {  
                
GetPlayerName(iinamesizeof(iname));  
                
format(stringsizeof(string), "- %s (%d).\n"inameiMuted[i]); 
                
strcat(Rstringstringsizeof(Rstring));
                
count ++;  
           }  
        }  
    }  
    if(
count 0)  
    {  
        
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players"Rstring"OK""");  
    }  
    else 
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players""No players muted at the moment.""OK"""); 
strdel(Rstring,0,500); 
  }  
  else 
SendClientMessage(playeriderror,"You are not authorized to use that command.");  
  return 
1;  

Reply
#6

PHP код:
new iname[MAX_PLAYER_NAME], string[512], count 0;
    
string[0] = EOS;
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
           if(
Muted[i] == 1)
           {
                
GetPlayerName(iinamesizeof(iname));
                
format(stringsizeof(string), "%s- %s (%d).\n",stringinameiMuted[i]);
                
count ++;
           }
        }
    } 
Reply
#7

Quote:
Originally Posted by MBilal
Посмотреть сообщение
PHP код:
new Rstring[500];
CMD:muted(playeridparams[])  
{  
  if(
IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1)  
  {  
    
strdel(Rstring,0,500);
    new 
iname[MAX_PLAYER_NAME], string[128], count 0;  
    for(new 
0MAX_PLAYERSi++)  
    {  
        if(
IsPlayerConnected(i))  
        {  
           if(
Muted[i] == 1)  
           {  
                
GetPlayerName(iinamesizeof(iname));  
                
format(stringsizeof(string), "- %s (%d).\n"inameiMuted[i]); 
                
strcat(Rstringstringsizeof(Rstring));
                
count ++;  
           }  
        }  
    }  
    if(
count 0)  
    {  
        
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players"Rstring"OK""");  
    }  
    else 
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Muted players""No players muted at the moment.""OK"""); 
strdel(Rstring,0,500); 
  }  
  else 
SendClientMessage(playeriderror,"You are not authorized to use that command.");  
  return 
1;  

Thanks ! Finally worked. +Rep
@SacrificeGaming, i wanted a /muted command , i already have /mute and /unmute bro.. Thanks anyway.
Reply
#8

unlock ur server dude
Reply
#9

Quote:
Originally Posted by TenTen
Посмотреть сообщение
unlock ur server dude
I'm currently creating a new admin system , instead of LuxAdmin, and many new updates.
If you really need me to unlock it >> PM me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)