Log pausers on echo channel?
#1

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

Up...lol
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)