30.11.2011, 19:13
Okay, another question How do I get it so my timer unmutes the target id? because when I mute a player, the timer starts but keeps them muted because when the timer ends, it unmutes me. thanks.
public unmutetimer(playerid)
{
GetPvarInt(targetid,"Muted");
PlayerInfo[targetid][pMuted] = 0;
SendClientMessage(playerid,COLOR_GREEN,"You've been unmuted.");
return 1;
}
CMD:mute(playerid,params[])
{
new time,targetid,str1[128],pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COLOR_GRAY,"Error: You're not authorized to use this command!");
else if(sscanf(params,"ud",targetid,time)) return SendClientMessage(playerid,COLOR_WHITE,"Format: /mute [PartOfName/ID] [Time(milliseconds)]");
else if(targetid==INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_GRAY,"Error: Player is not connected.");
else
{
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
GetPlayerName(targetid,tName,MAX_PLAYER_NAME);
format(str1,sizeof(str1),"[Mute] Admin %s has muted %s for %d minutes.",pName,tName,time);
SendClientMessageToAll(COLOR_CARROT,str1);
SendClientMessage(targetid,COLOR_RED,"You've been muted.");
PlayerInfo[targetid][pMuted] = 1;
SetTimer("unmutetimer",time*60000,false);
}
return 1;
}
SetTimer("unmutetimer",time*60000,false); // Change this to:
SetTimerEx("unmutetimer",time*6000, false, "i", targetid); // It is 6000 not 60000, okay ?
//Also:
forward unmutetimer(targetid);
public unmutetimer(targetid) // Your code below.