25.10.2010, 07:28
first you need a global variable, eg paused[MAX_PLAYERS], then you either set a timer, or put under a timer the following
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.
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;
}
This is just a quick unoptimized script to get you started.