15.01.2016, 17:12
If it were me, I'd use pInfo[id][Muted] to store the un-mute time.
Example:
This is WAY better than using timers.
Example:
pawn Код:
CMD:mute(playerid, params[])
{
if(pInfo[playerid][pLevel] >= 1)
{
new id, time, reason[50];
if(isnull(params)) return SendClientMessage(playerid, yellow, "Usage: /mute <Player ID> <Time in seconds> <Reason>");
sscanf(params, "uus[50]", id, time, reason);
if(IsPlayerConnected(id))
{
if(pInfo[playerid][pLevel] < pInfo[id][pLevel]) return ShowMessage(playerid, red, 6);
if(!isnull(reason))
format(Jstring,sizeof(Jstring),"Administrator %s has muted player '%s' | Reason: %s",GetName(playerid),GetName(id),reason);
else
format(Jstring,sizeof(Jstring),"Administrator %s has muted '%s'",GetName(playerid),GetName(id));
SendClientMessageToAll(red, Jstring);
pInfo[id][Muted] = gettime() + (time * 1000);
CommandToAdmins(playerid,"mute");
return 1;
}
else return ShowMessage(playerid, red, 2);
}
else return ShowMessage(playerid, red, 1);
}
CMD:unmute:
pInfo[id][Muted] = 0;
OnPlayerText:
if(pInfo[id][Muted] > gettime())
return 0;