help with mute timer
#2

Quote:
Originally Posted by jaksimaksi
Посмотреть сообщение
Im making mute with timer, but when I mute someone he gets unmuted at the same time. I mean mute_time is not saving to variable, whats wrong?

pawn Код:
#define MUTE_TIME 10000

CMD:mute(playerid, params[])
{
new Msg[180];
new pID;

new MuteID, MuteStr[128], MuteReason[128];
if (sscanf(params, "us",MuteID,MuteReason)) return SendClientMessage(playerid, COLOR_RED, "[SERVER]: usage: \"/mute [id] [reason\"");
if(IsPlayerConnected(MuteID))
{
MuteTimer[MuteID] = SetTimerEx("PlayerUnMute",PlayerData[playerid][Muted]*MUTE_TIME,0,"d",MuteID);
format(Msg, sizeof(Msg), "adm: %s(%d) muted player %s(%d) reason %s", pName(playerid), playerid, pName(pID), pID, params);
SendClientMessageToAll(COLOR_RED, Msg);
}
return 1;
}
Thats my mute time load code on login callback:


pawn Код:
if(PlayerData[playerid][Muted] >= 1)
{
MuteTimer[playerid] = SetTimerEx("PlayerUnMute",PlayerData[playerid][Muted]*MUTE_TIME,0,"d",playerid);
return false;
}
Two things you need to take care of, your MUTE_TIME is only 10 seconds and and you forgot to add PlayerData[MuteID][Muted] = 1;

So, if the player has not PlayerData[playerid][Muted] >= 1, it says he is to 0 and your MUTE_TIMER is 10000 = 0*10000 = 0.
Plus, it's aint calling the timer PlayerUnMute.

Plus, why calling a timer twice for the same time? The player will need to wait 20 seconds before talking.

If you want me to change things from your script, tell me.
Reply


Messages In This Thread
help with mute timer - by jaksimaksi - 15.07.2012, 12:29
Re : help with mute timer - by lelemaster - 15.07.2012, 14:51
Re: help with mute timer - by [MM]RoXoR[FS] - 15.07.2012, 15:18

Forum Jump:


Users browsing this thread: 1 Guest(s)