SA-MP Forums Archive
Pause Function? - 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: Pause Function? (/showthread.php?tid=169165)



Pause Function? - Kevin_Joshen - 18.08.2010

Is there any way so that when a player pauses a textdraw appears above his head saying "Paused Player"

and that he gets sent to /afk after 30 seconds.



Thank You,

Kevin


Re: Pause Function? - Lorrden - 18.08.2010

Create3DTextLabel on get player key pressed ?... Just a guess, dunno if it would work. But it'd be cool :P


Re: Pause Function? - Kevin_Joshen - 18.08.2010

that wouldnt work.. because players could just alt+tab....


i seen it on another server... XD


Re: Pause Function? - playbox12 - 18.08.2010

Alt+tab counts the same as pausing.


Re: Pause Function? - Kevin_Joshen - 19.08.2010

any more?


Re: Pause Function? - Kyosaur - 19.08.2010

OnPlayerUpdate is not called when a player is paused, you can use this to detect when a player is paused.


Re: Pause Function? - Matthias_ - 19.08.2010

Or use this:

Код:
new iLastUpdate[ MAX_PLAYERS ];

public OnPlayerUpdate( playerid )
{
   iLastUpdate[ playerid ] = GetTickCount();
   return 1;
}

stock IsPlayerPausing( iPlayerID )
{
   if(GetTickCount() > ( iLastUpdate[ iPlayerID ] + 2000 ))
   {
      return 1;
   }
   return 0;
}



Re: Pause Function? - Kyosaur - 19.08.2010

Quote:
Originally Posted by Matthias_
Посмотреть сообщение
Or use this:

Код:
new iLastUpdate[ MAX_PLAYERS ];

public OnPlayerUpdate( playerid )
{
   iLastUpdate[ playerid ] = GetTickCount();
   return 1;
}

stock IsPlayerPausing( iPlayerID )
{
   if(GetTickCount() > ( iLastUpdate[ iPlayerID ] + 2000 ))
   {
      return 1;
   }
   return 0;
}
Exactly, although i wouldn't do i EVERY updated. I would personally do it like ever 30 updates.


Re: Pause Function? - Jay_ - 21.08.2010

Quote:
Originally Posted by Matthias_
Посмотреть сообщение
Or use this:
[...]
Lol that would fail miserably.


Re: Pause Function? - WillyP - 27.08.2010

Quote:
Originally Posted by Kevin_Joshen
Посмотреть сообщение
that wouldnt work.. because players could just alt+tab....


i seen it on another server... XD
*cough* sacnr