SA-MP Forums Archive
/Mute timer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /Mute timer (/showthread.php?tid=557004)



/Mute timer - Axey187 - 12.01.2015

pawn Code:
CMD:mute(playerid, params[])
{
    new targetid, minutes, reason[128], string[128];
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected to the server");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "Command not found on server! /help");
    if(sscanf(params,"uis[128]", targetid, minutes, reason)) return SendClientMessage(playerid, COLOR_RED, "Mute: /mute (id) (minutes) (reason)");
    format(string, sizeof(string), "Administrator %s muted %s for %d minutes (%s)", PlayerName(playerid), PlayerName(targetid), minutes, reason);
    SendClientMessageToAll(COLOR_RED, string);
    SetTimer("Unmute", minutes*60000, 0);
    return 1;
}
forward Unmute(playerid);
public Unmute(playerid)
{
    SendClientMessage(playerid, COLOR_RED, "You have been unmuted automatically by server");
    return 1;
}
The timer is not working, It should have sent a client message informing that im unmuted, but no message was sent.


Re: /Mute timer - rickisme - 12.01.2015

because playerid is invalid

use SetTimerEx instead SetTimer ( https://sampwiki.blast.hk/wiki/SetTimerEx ) or just use YSI for simple timer


Re: /Mute timer - HY - 12.01.2015

pawn Code:
SetTimerEx("Unmute", minutes*1000, false, "i", playerid);
pawn Code:
forward Unmute(playerid);
public Unmute(playerid)
{
    SendClientMessage(playerid, COLOR_RED, "You have been unmuted automatically by server");
    return 1;
}



Re: /Mute timer - Axey187 - 12.01.2015

Thank you all for helping. It worked.