Bug with mute command
#1

well, i tried to make /mute command with timer but i have 1 big bug ..

when i mute player, hwe cant talking whole time, and when time gone then when player writing something in IC chat its without text ..

Код:
CMD:mute(playerid,params[]) {
	if (PlayerInfo[playerid][pAdmin] >= 1) {
		new id,time,reason[256], string[128],GPlayerName[MAX_PLAYER_NAME];
		if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /mute [ID][Vrijeme][Razlog]");
        if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
		if(PlayerInfo[playerid][pAdmin] > PlayerInfo[playerid][pAdmin])return SendClientMessage(playerid,COLOR_RED,"Nemozes mutati veci admin level");
		if(Muted[id] == 1)return SendClientMessage(playerid,COLOR_RED,"Igrac je vec mutan");
        GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));
		format(string, sizeof(string), "Admin: %s (ID:%d) has been muted for %d minutes; Reason: %s", PlayerName(playerid), id, time, reason);
		SendClientMessageToAll(COLOR_RED, string);
		format(string, sizeof(string), "Admin %s, Command Used 'MUTE' Taregt: %s (ID:%d)", GPlayerName, PlayerName(id), id);
		SendAdminMessage(1,COLOR_YELLOW,string);
		Muted[id] = 1;
		MuteTimer[id] = SetTimerEx("Unmute",time*60000, false, "i", id);
	}
	else {
	    return 0;
	}
	return 1;
}

CMD:unmute(playerid,params[]) {
    new id, string[128];
	if (PlayerInfo[playerid][pAdmin] >= 1) {
		if(sscanf(params,"d",id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unmute <playerid>");
		if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
		if(Muted[id] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is already muted.");
		if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin])return SendClientMessage(playerid,COLOR_RED,"ERROR: He/She is a greater level than your level.");
		new ReturnName[MAX_PLAYER_NAME];
		GetPlayerName(id, ReturnName, sizeof(ReturnName));
		format(string, sizeof(string), "-X Admin-: %s (ID:%d) has been automatically unmuted.", ReturnName, id);
		SendClientMessageToAll(COLOR_RED, string);
		Muted[id] = 0;
		KillTimer(MuteTimer[id]);
	}
	else {
	    return 0;
	}
	return 1;
}
Код:
public OnPlayerText(playerid, text[])
{
	new string[128];
	if(GetPVarInt(playerid, "Muted") == 0)
	{
		if(PlayerInfo[playerid][Clan] == 1 || PlayerInfo[playerid][Lider] == 1)
		{
            if(IsAnIP(text))return
			format(string, sizeof(string), "[GSF]%s: "#COL_WHITE"%s",PlayerName(playerid), text);
			SendClientMessageToAll(COLOR_GREEN, string);
			return 0;
		}
		if(PlayerInfo[playerid][Clan] == 2 || PlayerInfo[playerid][Lider] == 2)
		{
            if(IsAnIP(text))return
			format(string, sizeof(string), "[BM]%s: "#COL_WHITE"%s",PlayerName(playerid), text);
			SendClientMessageToAll(0x3E887496, string);
			return 0;
		}
		if(PlayerInfo[playerid][Clan] == 3 || PlayerInfo[playerid][Lider] == 3)
		{
            if(IsAnIP(text))
			format(string, sizeof(string), "[F]%s[A]: "#COL_WHITE"%s",PlayerName(playerid), text);
			SendClientMessageToAll(COLOR_BLUE, string);
			return 0;
		}
		if(PlayerInfo[playerid][Clan] == 4 || PlayerInfo[playerid][Lider] == 4)
		{
            if(IsAnIP(text))
			format(string, sizeof(string), "[RUS]%s: "#COL_WHITE"%s",PlayerName(playerid), text);
			SendClientMessageToAll(COLOR_YELLOW, string);
			return 0;
		}
 	}
 	else if(GetPVarInt(playerid, "Muted") == 1)
 	{
 	    SendClientMessage(playerid, COLOR_RED, "Ti si mutan i nemozes pricati!");
 	    return 0;
  	}
	return 1;
}
ic chat looks like that: http://imgur.com/uJwbc
Reply
#2

can help me anybody? this thread goes far away
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)