Checking Pause Screen
#3

Quote:
Originally Posted by admantis
Посмотреть сообщение
A good idea is, to set OnPlayerUpdate a variable value to 1.

Now, create a timer every second (1000 ms), and lower the defined value by 1.
Check on that timer if the value is zero (if it's decreased), if so, he paused for one second.

This is because OnPlayerUpdate is not called when the player pauses, therefore the value is not set to 1 anymore and can decrease (timers are still executed).

But for a more efficent way use the OnPlayerPause include.
I tried that include and it didn't work good. I found this though (credits to ev0lutionnn):

pawn Код:
new lastupdate[MAX_PLAYERS];
public OnPlayerUpdate(playerid) {
  lastupdate[playerid] = GetTickCount();
  return 1;
}
pawn Код:
if(GetTickCount() > (lastupdate[playerid]+2000))
pawn Код:
#define IsPlayerPaused(%1) GetTickCount() > (lastupdate[%1]+2000)
That works great! Thanks anyways :P
Reply


Messages In This Thread
Checking Pause Screen - by s1k - 06.03.2011, 03:20
Re: Checking Pause Screen - by admantis - 06.03.2011, 04:08
Re: Checking Pause Screen - by s1k - 06.03.2011, 04:11

Forum Jump:


Users browsing this thread: 2 Guest(s)