Help with /Mute cmd
#1

My Mute cmd doesn't work here is the code

Код:
CMD:mute(playerid, params[])
{
	new giveplayerid, giveplayer[25], playername[25], strings[256], string[256], moneys1, tmp3[25];
	if (adlvl[playerid] < 1) return 0;
	if (sscanf(params, "ud", giveplayerid, moneys1)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /mute [playerid] [time] [reason]");
	if (!IsPlayerConnected2(giveplayerid)) return SendClientMessage2(playerid, COLOR_RED, "Error: Inactive player id!");
	if (moneys1 < 1 || moneys1 > 60) return SendClientMessage2(playerid, COLOR_WHITE, "Error: Select a time between 1-60 minutes.");
	if (giveplayerid == playerid) return SendClientMessage2(playerid, COLOR_RED, "Error: You can't mute yourself!");
	GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
	if (adlvl[giveplayerid] >= adlvl[playerid] && adminuc[giveplayerid] == 0) return SendPlayerFormattedText(playerid, COLOR_RED, "Error: You cannot mute %s.", giveplayer, "");
	if (mutedtime[giveplayerid] != 0) return SendPlayerFormattedText(playerid, COLOR_RED, "Error: %s is already muted.", giveplayer, "");
	if (moneys1 < 1 || moneys1 > 60) return SendClientMessage2(playerid, COLOR_WHITE, "Error: Select a time between 1-60 minutes.");
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
	//mtimer[giveplayerid] = SetTimerEx("unmute", moneys1*60000, 0, "d", giveplayerid);
	mutedtime[giveplayerid] = moneys1 * 60;
	if (sscanf(params, "uds[128]", giveplayerid, moneys1, tmp3))
	{
		format(strings, sizeof(strings), "~ You have been muted by an admin for %d minute(s).", moneys1);
		SendClientMessage2(giveplayerid, COLOR_RED, strings);

		format(strings, sizeof(strings), "~ %s has been muted by an admin for %d minute(s).", giveplayer, moneys1);
		SendClientMessageToAll(COLOR_RED, strings);
	}
	else
	{
		format(strings, sizeof(strings), "~ You have been muted by an admin for %d minute(s) for '%s'.", moneys1,tmp3);
		SendClientMessage2(giveplayerid, COLOR_RED, strings);

		format(strings, sizeof(strings), "~ %s has been muted by an admin for %d minute(s) for '%s'.", giveplayer, moneys1,tmp3);
		SendClientMessageToAll(COLOR_RED, strings);
	}
	SendPlayerFormattedText(playerid, COLOR_RED, "You have muted %s.", giveplayer, "");
	if (adminuc[playerid] == 0)
	{
		if (!strlen(tmp3)) format(string, 128, "Admin Log: %s has muted player %s (Id%d) for %d minute(s).", playername, giveplayer, giveplayerid, moneys1);
		else format(string, 128, "Admin Log: %s has muted player %s (Id%d) for %d minute(s) for %s.", playername, giveplayer, giveplayerid, moneys1, tmp3);
		SendMessageToAdmins(COLOR_ADMIN, string);
	}
	printf("[muted] %s has muted player %s (Id%d) for %d minutes.", playername, giveplayer, giveplayerid, moneys1);
	return 1;
}
Reply
#2

Explain more.What is problem?
Reply
#3

When I mute someone it doesn't mute him thats the problem
Reply
#4

show your OnPlayerText
Reply
#5

here you go
Quote:

public OnPlayerText(playerid, text[])
{
if(AntiAdv(playerid, text)) return 0;
if (!IsPlayerConnected2(playerid)) return 0;

new string[256], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);

if(Advertise(playerid, text))
{
return 0;
}
new count = GetTickCount2();
if (count-cflood[playerid][1] < 1000) {
cflood[playerid][0] ++;
if (cflood[playerid][0] == 5) {
if (cdata[playerid][2] == 0 || text[0] == '!') {
printf("[chat] [%s]: %s", playername, text);
}
else {
GetPlayerName(cdata[playerid][0], string, MAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s", playername, string, text);
new cstring[256];
format(cstring, 256, "[phonecall] [%s - %s]: %s", playername, string, text);
for(new i; i<PLAYERS; i++)
{
if((adlvl[i] >= 1 && Listen(i) >= 1) && (Listen(playerid) != 2) && (adlvl[playerid] <= adlvl[i]) && (i != playerid)) SendClientMessage(i, -1, cstring);
}
}
cflood[playerid][0] = 0;
SendClientMessage2(playerid, COLOR_WHITE, "~ You have been kicked for flooding.");
pkicktimer[playerid] = SetTimerEx("KickBanTimer", 50, 0, "dd", playerid, 1);
format(string, 128, "~ %s has been kicked from the server (Flooding).", playername);
SendClientMessageToAll2(COLOR_WHITE, string);
printf("[kicked] %s has been kicked from the server (Flooding).", playername);
return 0;
}
}
else {
cflood[playerid][0] = 1;
}
cflood[playerid][1] = count;

if (Logged[playerid] == 0) {
printf("[chat] [%s]: %s", playername, text);
if (dini_Exists(AddDirFile(dir_userfiles, playername))) {
SendClientMessage2(playerid, COLOR_WHITE, "You must login to play! Type /login to continue.");
}
else {
SendClientMessage2(playerid, COLOR_WHITE, "You must register to play! Type /register to continue.");
}
return 0;
}

//IdleTime[playerid] = 90;

if (mtimer[playerid] != 0) {
if (cdata[playerid][2] == 0 || text[0] == '!') {
printf("[chat] [%s]: %s", playername, text);
}
else {
GetPlayerName(cdata[playerid][0], string, MAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s", playername, string, text);
}
SendClientMessage2(playerid, COLOR_RED, "Error: You are muted smart ass!");
return 0;
}


GetServerVarAsString("rcon_password", string, 64);
if (strfind(text, string, true) != -1) {
if (cdata[playerid][2] == 0 || text[0] == '!') {
printf("[chat] [%s]: %s", playername, text);
}
else {
GetPlayerName(cdata[playerid][0], string, MAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s", playername, string, text);
}
return 0;
}

new t = 0;
while (t < strlen(text)-1) {
if (text[t] == ' ' && text[t+1] == ' ') {
strdel(text, t+1, t+2);
}
else t ++;
}
if (cdata[playerid][2] == 1) {
if (text[0] == '!') {
printf("[chat] [%s]: %s", playername, text);
strmid(string, text, 1, strlen(text));
for (new i = 0; i < PLAYERS; i++) {
if (IsPlayerConnected2(i)) {
if (PlayerIgnored[i][playerid] == 0) SendPlayerMessageToPlayer(i, playerid, string);
}
}
}
else {
GetPlayerName(cdata[playerid][0], string, MAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s", playername, string, text);
format(string, sizeof(string), "[phonecall] %s", text);
SendClientMessage2(cdata[playerid][0], COLOR_SILVER, string);
format(string, sizeof(string), "[phonecall] %s", text);
SendClientMessage2(playerid, COLOR_LBLUE, string);
}
}
else {
printf("[chat] [%s]: %s", playername, text);
for (new i = 0; i < PLAYERS; i++) {
if (IsPlayerConnected2(i)) {
if (PlayerIgnored[i][playerid] == 0) SendPlayerMessageToPlayer(i, playerid, text);
}
}
}
return 0;
}

Reply
#6

Try these

PHP код:
public OnPlayerText(playeridtext[])
{
if(
AntiAdv(playeridtext)) return 0;
if (!
IsPlayerConnected2(playerid)) return 0;
new 
string[256], playername[MAX_PLAYER_NAME];
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
if(
Advertise(playeridtext))
{
return 
0;
}
new 
count GetTickCount2();
if (
count-cflood[playerid][1] < 1000) {
cflood[playerid][0] ++;
if (
cflood[playerid][0] == 5) {
if (
cdata[playerid][2] == || text[0] == '!') {
printf("[chat] [%s]: %s"playernametext);
}
else {
GetPlayerName(cdata[playerid][0], stringMAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s"playernamestringtext);
new 
cstring[256];
format(cstring256"[phonecall] [%s - %s]: %s"playernamestringtext);
for(new 
ii<PLAYERSi++)
{
if((
adlvl[i] >= && Listen(i) >= 1) && (Listen(playerid) != 2) && (adlvl[playerid] <= adlvl[i]) && (!= playerid)) SendClientMessage(i, -1cstring);
}
}
cflood[playerid][0] = 0;
SendClientMessage2(playeridCOLOR_WHITE"~ You have been kicked for flooding.");
pkicktimer[playerid] = SetTimerEx("KickBanTimer"500"dd"playerid1);
format(string128"~ %s has been kicked from the server (Flooding)."playername);
SendClientMessageToAll2(COLOR_WHITEstring);
printf("[kicked] %s has been kicked from the server (Flooding)."playername);
return 
0;
}
}
else {
cflood[playerid][0] = 1;
}
cflood[playerid][1] = count;
if (
Logged[playerid] == 0) {
printf("[chat] [%s]: %s"playernametext);
if (
dini_Exists(AddDirFile(dir_userfilesplayername))) {
SendClientMessage2(playeridCOLOR_WHITE"You must login to play! Type /login to continue.");
}
else {
SendClientMessage2(playeridCOLOR_WHITE"You must register to play! Type /register to continue.");
}
return 
0;
}
//IdleTime[playerid] = 90;
if (mutedtime[playerid] != 0) {
if (
cdata[playerid][2] == || text[0] == '!') {
printf("[chat] [%s]: %s"playernametext);
}
else {
GetPlayerName(cdata[playerid][0], stringMAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s"playernamestringtext);
}
SendClientMessage2(playeridCOLOR_RED"Error: You are muted smart ass!");
return 
0;
}
GetServerVarAsString("rcon_password"string64);
if (
strfind(textstringtrue) != -1) {
if (
cdata[playerid][2] == || text[0] == '!') {
printf("[chat] [%s]: %s"playernametext);
}
else {
GetPlayerName(cdata[playerid][0], stringMAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s"playernamestringtext);
}
return 
0;
}
new 
0;
while (
strlen(text)-1) {
if (
text[t] == ' ' && text[t+1] == ' ') {
strdel(textt+1t+2);
}
else 
++;
}
if (
cdata[playerid][2] == 1) {
if (
text[0] == '!') {
printf("[chat] [%s]: %s"playernametext);
strmid(stringtext1strlen(text));
for (new 
0PLAYERSi++) {
if (
IsPlayerConnected2(i)) {
if (
PlayerIgnored[i][playerid] == 0SendPlayerMessageToPlayer(iplayeridstring);
}
}
}
else {
GetPlayerName(cdata[playerid][0], stringMAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s"playernamestringtext);
format(stringsizeof(string), "[phonecall] %s"text);
SendClientMessage2(cdata[playerid][0], COLOR_SILVERstring);
format(stringsizeof(string), "[phonecall] %s"text);
SendClientMessage2(playeridCOLOR_LBLUEstring);
}
}
else {
printf("[chat] [%s]: %s"playernametext);
for (new 
0PLAYERSi++) {
if (
IsPlayerConnected2(i)) {
if (
PlayerIgnored[i][playerid] == 0SendPlayerMessageToPlayer(iplayeridtext);
}
}
}
return 
0;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)