SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/01/2015, 01:19 PM   #1
Axey187
Big Clucker
 
Join Date: Sep 2013
Posts: 139
Reputation: 25
Default /Mute timer

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.
Axey187 is offline   Reply With Quote
Old 12/01/2015, 01:22 PM   #2
rickisme
Huge Clucker
 
rickisme's Avatar
 
Join Date: Mar 2013
Location: Vietnam
Posts: 225
Reputation: 27
Default Re: /Mute timer

because playerid is invalid

use SetTimerEx instead SetTimer ( http://wiki.sa-mp.com/wiki/SetTimerEx ) or just use YSI for simple timer
__________________

Sorry for my bad english.
  1. [FS] SoundCloud Music Player
  2. [VIDEO] Horse Betting System
rickisme is offline   Reply With Quote
Old 12/01/2015, 01:25 PM   #3
HY
Gangsta
 
HY's Avatar
 
Join Date: Sep 2014
Location: Romānia.
Posts: 540
Reputation: 87
Default Re: /Mute timer

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;
}
__________________
hi.
HY is offline   Reply With Quote
Old 12/01/2015, 01:30 PM   #4
Axey187
Big Clucker
 
Join Date: Sep 2013
Posts: 139
Reputation: 25
Default Re: /Mute timer

Thank you all for helping. It worked.
Axey187 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Mute Em' - Mute system Pawnify Filterscripts 31 03/12/2014 03:40 PM
mute timer text in textdraw Zaec Scripting Help 1 04/02/2014 07:53 AM
I need mute script with timer bustern Scripting Help 21 05/09/2013 03:00 PM
help with mute timer jaksimaksi Scripting Help 2 15/07/2012 03:18 PM


All times are GMT. The time now is 08:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.