Mute player OnPlayerText -
Ilaibens - 08.08.2017
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 !
Re: Mute player OnPlayerText -
Swarn - 08.08.2017
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;
}
Re: Mute player OnPlayerText -
Ilaibens - 08.08.2017
Dont work
Re: Mute player OnPlayerText -
Misiur - 08.08.2017
1. Do
pawn Код:
printf("%d", PlayerInfo[playerid][pMuted]);
if it shows 1 yet it does not work, show us whole OnPlayerText
Re: Mute player OnPlayerText -
Ilaibens - 08.08.2017
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;
}
Re: Mute player OnPlayerText -
Swarn - 08.08.2017
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.
Re: Mute player OnPlayerText -
Ilaibens - 08.08.2017
Now it's work and print 1, Thank you man !!!!!
Re: Mute player OnPlayerText -
Swarn - 08.08.2017
No problem, glad I could help.