25.03.2016, 14:57
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; }