Help with 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: Help with timer (
/showthread.php?tid=300516)
Help with timer -
Azzeto - 30.11.2011
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.
Re: Help with timer -
Vince - 30.11.2011
Use SetTimerEx to pass the targetid.
This forum requires that you wait ... blah blah blah.
Re: Help with timer -
Azzeto - 30.11.2011
Could you give me an example of how to use it? I'v never used SetTimerEx
Re: Help with timer -
sleepysnowflake - 30.11.2011
https://sampwiki.blast.hk/wiki/SetTimerEx
There you go.
Re: Help with timer -
Azzeto - 30.11.2011
Ugh, i'v seen the wiki, plenty of times, I just don't know how I would use it to unmute the targetid instead of playerid.
Re: Help with timer -
MP2 - 30.11.2011
Change playerid to targetid..? Show your code.
Re: Help with timer -
Azzeto - 30.11.2011
PHP код:
public unmutetimer(playerid)
{
GetPvarInt(targetid,"Muted");
PlayerInfo[targetid][pMuted] = 0;
SendClientMessage(playerid,COLOR_GREEN,"You've been unmuted.");
return 1;
}
- Public
PHP код:
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;
}
Re: Help with timer -
sleepysnowflake - 30.11.2011
pawn Код:
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.
Re: Help with timer -
Azzeto - 30.11.2011
Thanks for the code berlovan, will test it, but it is 60000 because 60000=1 minute, and they get muted for the minutes, so /mute id 1(1 minute)
Re: Help with timer -
sleepysnowflake - 30.11.2011
Oh, okay. Sorry. I thought something else.