/Mute timer
#1

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.
Reply
#2

because playerid is invalid

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

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;
}
Reply
#4

Thank you all for helping. It worked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)