Log pausers on echo channel? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Log pausers on echo channel? (
/showthread.php?tid=185178)
Log pausers on echo channel? -
Face9000 - 23.10.2010
Hi all,i use incognito IRC Plugin for an echo channel and i need to add a function.
If player pause (He press ESC),the echo will show a message like this:
Код:
[6:53pm] <13@CrazyBOT> 07,08* Mobilephoon has paused.
Thanks.
Re: Log pausers on echo channel? -
Face9000 - 25.10.2010
Up...lol
Re: Log pausers on echo channel? -
Rachael - 25.10.2010
first you need a global variable, eg paused[MAX_PLAYERS], then you either set a timer, or put under a timer the following
pawn Код:
forward PauseCheck();
...
new Paused[MAX_PLAYERS];
...
//under public OnGameModeInit()
SetTimer("PauseCheck",5000,true);
...
public OnPlayerUpdate(playerid)
{
new string[64];
if( /* check for irc connection */ ) // I wouldn't put this part in, it might use too many resources
{
if(Paused[playerid] > 2)
{
format(string,sizeof(string),"UPDATE: %s unpaused",Name(playerid));
IRC_Say(connection,channel,string);
}
} // I suggest starting here - see comment above
Paused[playerid] = 0;
return 1;
}
...
public PauseCheck()
{
new string[64];
if( /* check for IRC connection */ )
{
for(new i = 0; i < MAX_PLAYERS;i++)
{
Paused[playerid] ++;
if(Paused[playerid] == 2) //this is set to 2 because some functions will briefly stop onplayerupdate for a player
format(string,sizeof(string),"WARNING: %s paused",Name(i));
IRC_Say(connection,channel,string);
}
}
return 1;
}
as I have mention in the comments above, I would be wary of putting too many operations unde OnPlayerUpdate.
This is just a quick unoptimized script to get you started.