SA-MP Forums Archive
Problems with /mute - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problems with /mute (/showthread.php?tid=94600)



Problems with /mute - Sayaron - 30.08.2009

Hi, I got some problems with my mute command. When I try to mute another player, it mutes myself..
Hope some of you can help me with this.
pawn Код:
if(strcmp(cmd, "/mute", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /mute [playerid]");
                return 1;
            }
            new playa;
            playa = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
              if(IsPlayerConnected(playa))
              {
                if(playa != INVALID_PLAYER_ID)
                {
                        if(Mute[playerid] == 0)
                        {
                            Mute[playerid] = 1;
                            format(string, sizeof(string), "You muted %s.",GetPlayerNameEx(playa));
                            SendClientMessage(playerid,COLOR_ADMINCMD,string);
                            format(string, sizeof(string), "You have been muted by %s.",GetPlayerNameEx(playerid));
                            SendClientMessage(playa,COLOR_ADMINCMD,string);
                        }
                        else
                        {
                            Mute[playerid] = 0;
                            format(string, sizeof(string), "You unmuted %s.",GetPlayerNameEx(playa));
                            SendClientMessage(playerid,COLOR_ADMINCMD,string);
                            format(string, sizeof(string), "You have been unmuted by %s.",GetPlayerNameEx(playerid));
                            SendClientMessage(playa,COLOR_ADMINCMD,string);
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "SERVER: Your not an administrator.");
            }
        }
        return 1;
    }



Re: Problems with /mute - JR ! - 30.08.2009

You didn't put mute as Mute[playa], you had them to playerid, so it was muting yourself.

Код:
if(Mute[playa] == 0)
{
	Mute[playa] = 1;
	format(string, sizeof(string), "You muted %s.",GetPlayerNameEx(playa));
	SendClientMessage(playerid,COLOR_ADMINCMD,string);
	format(string, sizeof(string), "You have been muted by %s.",GetPlayerNameEx(playerid));
	SendClientMessage(playa,COLOR_ADMINCMD,string);
}
else				
{
	Mute[playa] = 0;
	format(string, sizeof(string), "You unmuted %s.",GetPlayerNameEx(playa));
	SendClientMessage(playerid,COLOR_ADMINCMD,string);
	format(string, sizeof(string), "You have been unmuted by %s.",GetPlayerNameEx(playerid));
	SendClientMessage(playa,COLOR_ADMINCMD,string);
}



Re: Problems with /mute - Sayaron - 30.08.2009

Quote:
Originally Posted by JR !
You didn't put mute as Mute[playa], you had them to playerid, so it was muting yourself.

Код:
if(Mute[playa] == 0)
{
	Mute[playa] = 1;
	format(string, sizeof(string), "You muted %s.",GetPlayerNameEx(playa));
	SendClientMessage(playerid,COLOR_ADMINCMD,string);
	format(string, sizeof(string), "You have been muted by %s.",GetPlayerNameEx(playerid));
	SendClientMessage(playa,COLOR_ADMINCMD,string);
}
else				
{
	Mute[playa] = 0;
	format(string, sizeof(string), "You unmuted %s.",GetPlayerNameEx(playa));
	SendClientMessage(playerid,COLOR_ADMINCMD,string);
	format(string, sizeof(string), "You have been unmuted by %s.",GetPlayerNameEx(playerid));
	SendClientMessage(playa,COLOR_ADMINCMD,string);
}
Oh, xD
Thanx