Mute player OnPlayerText
#1

Hey,
Mute CMD in my mode not muted the player in onplayertext,
Код HTML:
CMD:mute(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
	new targetid, string[128];
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /mute [playerid/PartOfName]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified !");
	if(PlayerInfo[targetid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "This player muted!");
	PlayerInfo[targetid][pMuted] = 1;
	format(string, sizeof(string), "AdmCmd: %s was silenced by %s.", GetName(targetid), GetName(playerid));
	ABroadCast(COLOR_LIGHTRED, string, 1);
	return 1;
}

onplayertext:
	if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't speak, you're muted."), 0;
I dont know why all the codes good please help me !!
thanks !
Reply
#2

Change,

Код:
if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't speak, you're muted."), 0;
to

Код:
if(PlayerInfo[playerid][pMuted] == 1)
{
        SendClientMessage(playerid, COLOR_GREY, "You can't speak, you're muted.");
        return 0;
}
Reply
#3

Dont work
Reply
#4

1. Do
pawn Код:
printf("%d", PlayerInfo[playerid][pMuted]);
if it shows 1 yet it does not work, show us whole OnPlayerText
Reply
#5

This is not print nothing, all the public:
Код:
public OnPlayerText(playerid, text[])
{
    if (realchat)
	{
	    new string[128];
		format(string, sizeof(string), "%s says: %s", GetName(playerid), text);
  		ProxDetector(30.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		format(string, sizeof(string), "says: %s", text);
		SetPlayerChatBubble(playerid,string,COLOR_WHITE,5.0,5000);
		return 0;
	}
	
	if(PlayerInfo[playerid][pMuted] == 1)
	{
	        SendClientMessage(playerid, COLOR_GREY, "You can't speak, you're muted.");
	        printf("%d", PlayerInfo[playerid][pMuted]);
	        return 0;
	}
	return 1;
}
Reply
#6

Yeah, replace

Код:
public OnPlayerText(playerid, text[])
{
    if (realchat)
	{
	    new string[128];
		format(string, sizeof(string), "%s says: %s", GetName(playerid), text);
  		ProxDetector(30.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		format(string, sizeof(string), "says: %s", text);
		SetPlayerChatBubble(playerid,string,COLOR_WHITE,5.0,5000);
		return 0;
	}
	
	if(PlayerInfo[playerid][pMuted] == 1)
	{
	        SendClientMessage(playerid, COLOR_GREY, "You can't speak, you're muted.");
	        printf("%d", PlayerInfo[playerid][pMuted]);
	        return 0;
	}
	return 1;
}
with

Код:
public OnPlayerText(playerid, text[])
{
	if(PlayerInfo[playerid][pMuted] == 1)
	{
	        SendClientMessage(playerid, COLOR_GREY, "You can't speak, you're muted.");
	        printf("%d", PlayerInfo[playerid][pMuted]);
	        return 0;
	}

    if (realchat)
	{
	    new string[128];
		format(string, sizeof(string), "%s says: %s", GetName(playerid), text);
  		ProxDetector(30.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		format(string, sizeof(string), "says: %s", text);
		SetPlayerChatBubble(playerid,string,COLOR_WHITE,5.0,5000);
		return 0;
	}
	return 1;
}
You're sending the chat first, then checking if he's muted. You want to check he's muted before calling the (realchat) code in.
Reply
#7

Now it's work and print 1, Thank you man !!!!!
Reply
#8

No problem, glad I could help.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)