#1

i made mute command... but now when i try to make the unmute command and i'm doing KillTimer(Mute_Timer)
it says that there is no Mute_Timer or somthing....
and i have to kill this timer else it will write after the time that i chose in the mute command:
"You Were unmuted by the server"
Reply
#2

Timer? You don`t need any timer for a mute command ... Only if you want to keep the player muted after he relogs aswell...

Can we see your timer and the command ?
Reply
#3

The onest thing I think it could be is that underscore (_) in some programm languages like php, there are sometimes problems with this underscore in a var. I am not a expert in pawn, I just think that is the problem.
Greatz Kayle
Reply
#4

Quote:
Originally Posted by kayle
Посмотреть сообщение
The onest thing I think it could be is that underscore (_) in some programm languages like php, there are sometimes problems with this underscore in a var. I am not a expert in pawn, I just think that is the problem.
Greatz Kayle
Hhmmm? This isn't PHP, this is Pawn.

The problem is tht he havent created a timer. Or im wrong?
Reply
#5

Quote:
Originally Posted by antonio112
Посмотреть сообщение
Timer? You don`t need any timer for a mute command ... Only if you want to keep the player muted after he relogs aswell...

Can we see your timer and the command ?
... i made a /mute <playerid> <time> <reason> command... so there is time(i need timer)
but i want to do that when i unmute the player by myself... without the automaticly unmute that i already created... it give me errors when i put the KillTimer(Mute_Timer);
Reply
#6

What are the errors saying?
Reply
#7

Quote:
Originally Posted by Celson
Посмотреть сообщение
What are the errors saying?
errors:
Код:
D:\Games\Gta San Anreas Online\GodFucker\gamemodes\MyGameMode.pwn(1141) : error 076: syntax error in the expression, or invalid function call
pawn code:
Код:
if(strcmp(cmd, "/unmute", true) == 0)
{
	new tmp[256];
	tmp = strtok(cmdtext,idx);
	if(!strlen(tmp))
	{
	    SendClientMessage(playerid, COLOUR_ORANGE, "Usage: /unmute [playerid]");
	    return 1;
	}
	new id;
	id = strval(tmp);
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername, sizeof(playername));
	new playername2[MAX_PLAYER_NAME];
	GetPlayerName(id, playername2, sizeof(playername2));
	new string[128];
	format(string, sizeof(string), "The admin %s unmuted you.", playername);
	SendClientMessage(playerid, COLOUR_YELLOW, string);
	KillTimer(Mute_Timer);
	format(string, sizeof(string), "You unmuted %s.", playername2);
	SendClientMessage(playerid, COLOUR_YELLOW, string);
	return 1;
}
line 1141:
Код:
KillTimer(Mute_Timer);
Reply
#8

Try this mute and unmute command with Zcmd.

Hope this would be easier then that.

This under #include <a_samp> or somewhere.

pawn Код:
new bool:ismuted[MAX_PLAYERS];
pawn Код:
COMMAND:mute(playerid, params[])
{
    new id;
    if(IsPlayerConnected(id))
    {
        if(IsPlayerAdmin(playerid))
        {
            if(!sscanf(params, "u", id))
            {
                new string[64];
                new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(id, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "Adminstrator %s has muted you.", name);
                SendClientMessage(id, 0xffff00aa, string);
                format(string, sizeof(string), "Player %s has been muted.", PlayerName);
                SendClientMessage(playerid, 0xffff00aa, string);
                ismuted[id] = true;
                return 1;
            }
            else return SendClientMessage(playerid, 0xffff00aa, "Usage:- /Mute (PlayerID/PartOfName).");
        }
        else return SendClientMessage(playerid, 0x0259EAAA, "You are not an Adminstrator.");
    }
    else return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected or The ID is incorrect..");
}
pawn Код:
COMMAND:unmute(playerid, params[])
{
    new id;
    if(IsPlayerConnected(id))
    {
        if(IsPlayerAdmin(playerid))
        {
            if(!sscanf(params, "u", id))
            {
                new string[64];
                new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(id, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "Adminstrator %s has unmuted you.", name);
                SendClientMessage(id, 0xffff00aa, string);
                format(string, sizeof(string), "Player %s has been unmuted.", PlayerName);
                SendClientMessage(playerid, 0xffff00aa, string);
                ismuted[id] = false;
                return 1;
            }
            else return SendClientMessage(playerid, 0xffff00aa, "Usage:- /Unmute (PlayerID/PartOfName).");
        }
        else return SendClientMessage(playerid, 0xffff00aa, "You are not an Adminstrator.");
    }
    else return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected or The ID is incorrect.");
}
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(ismuted[playerid])
    {
        SendClientMessage(playerid, 0xff0000FF, "You're muted, If you think you were muted wrongly please pm an admin.");
        return 0;
    }
    return 1;
}
Thats it.
Reply
#9

I had this problem before..

Create a new variable:

new MuteTimer[MAX_PLAYERS];

and when you set the timer make it:

MuteTimer[playerid] = SetTimer...

then when you kill the timer:

KillTimer(MuteTimer[playerid]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)