03.12.2015, 12:53
I have 6 admin level's 1 level to 6 level admin can mute players but if an admin mute some one he can spoke.Why any one help me here's the code of mute
PHP код:
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;
}
CMD:unmute(playerid, params[])
{
new giveplayerid, giveplayer[25], playername[25], string[256];
if (adlvl[playerid] < 1) return 0;
if (sscanf(params, "u", giveplayerid)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /unmute [playerid]");
if (!IsPlayerConnected2(giveplayerid)) return SendClientMessage2(playerid, COLOR_RED, "Error: Inactive player id!");
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
if (mutedtime[giveplayerid] == 0) return SendPlayerFormattedText(playerid, COLOR_RED, "Error: %s isn't muted.", giveplayer, "");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
mutedtime[giveplayerid] = 0;
dini_Unset(AddDirFile(dir_userfiles, giveplayer), "mutetime");
SendClientMessage2(giveplayerid, COLOR_ORANGE, "You have been unmuted by an admin.");
SendPlayerFormattedText(playerid, COLOR_ORANGE, "You have unmuted %s.", giveplayer, "");
if (adminuc[playerid] == 0)
{
format(string, 128, "Admin Log: %s has unmuted player %s (Id%d).", playername, giveplayer, giveplayerid);
SendMessageToAdmins(COLOR_ADMIN, string);
}
printf("[unmuted] %s has unmuted player %s (Id%d).", playername, giveplayer, giveplayerid);
return 1;
}