Detect back windows? -
scott1 - 31.01.2013
Hi all,
i would like to know if the back window can be pawn detected?
Here is an screen
the Hourglass before the nickname
Max
Re: Detect back windows? -
wups - 31.01.2013
What is that thing? Is this a new feature of 0.3x?
Re: Detect back windows? -
Gforcez - 31.01.2013
Quote:
Originally Posted by wups
What is that thing? Is this a new feature of 0.3x?
|
Yea, it came with the 0.3x RC's
Код:
- The SA-MP nametag can now show the alt-tab/paused status of a player. Use the client command /nametagstatus to toggle this feature on/off.
Re: Detect back windows? -
FufLa - 31.01.2013
Should've rather given us the option to add specific icons to a players nametag.
Re: Detect back windows? -
Rapgangsta - 31.01.2013
Nope, you can't detect if a players has alt-tabbed, you can only see it in game (only if you use SA-MP nametag)
And no one knows why...
Re: Detect back windows? -
tyler12 - 31.01.2013
Quote:
Originally Posted by Rapgangsta
Nope, you can't detect if a players has alt-tabbed, you can only see it in game (only if you use SA-MP nametag)
And no one knows why...
|
It's possible;
pawn Код:
#include <a_samp>
new Timer[MAX_PLAYERS],pPaused[MAX_PLAYERS];
forward public AFKTimer(playerid);
public OnPlayerConnect(playerid)
{
pPaused[playerid] = 1;
Timer[playerid] = SetTimerEx("AFKTimer",500,1,"i",playerid);
return 1;
}
public AFKTimer(playerid)
{
pPaused[playerid] = 1;
return 1;
}
public OnPlayerUpdate(playerid)
{
pPaused[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid)
{
KillTimer(Timer[playerid]);
return 1;
}
OnPlayerUpdate returns 0 when a player is paused.
Re: Detect back windows? -
Cypress - 31.01.2013
Quote:
Originally Posted by tyler12
It's possible;
pawn Код:
#include <a_samp> new Timer[MAX_PLAYERS],pPaused[MAX_PLAYERS]; forward public AFKTimer(playerid); public OnPlayerConnect(playerid) { pPaused[playerid] = 1; Timer[playerid] = SetTimerEx("AFKTimer",500,1,"i",playerid); return 1; } public AFKTimer(playerid) { pPaused[playerid] = 1; return 1; } public OnPlayerUpdate(playerid) { pPaused[playerid] = 0; return 1; } public OnPlayerDisconnect(playerid) { KillTimer(Timer[playerid]); return 1; }
OnPlayerUpdate returns 0 when a player is paused.
|
That's really inaccurate!
Re: Detect back windows? -
wups - 31.01.2013
Quote:
Originally Posted by Cypress
That's really inaccurate!
|
Yeah, the best bet would be to check the TickCount on every PlayerUpdate.
Re : Re: Detect back windows? -
scott1 - 31.01.2013
Quote:
Originally Posted by tyler12
It's possible;
pawn Код:
#include <a_samp> new Timer[MAX_PLAYERS],pPaused[MAX_PLAYERS]; forward public AFKTimer(playerid); public OnPlayerConnect(playerid) { pPaused[playerid] = 1; Timer[playerid] = SetTimerEx("AFKTimer",500,1,"i",playerid); return 1; } public AFKTimer(playerid) { pPaused[playerid] = 1; return 1; } public OnPlayerUpdate(playerid) { pPaused[playerid] = 0; return 1; } public OnPlayerDisconnect(playerid) { KillTimer(Timer[playerid]); return 1; }
OnPlayerUpdate returns 0 when a player is paused.
|
The onplayerupdate won't be called if the player is back windows.
And, if it's call you func won't work
Max
Re: Detect back windows? -
AndreT - 01.02.2013
Quote:
Originally Posted by wups
Yeah, the best bet would be to check the TickCount on every PlayerUpdate.
|
That would perhaps be the most accurate method, but why seek millisecond-specific accuracy when detecting someone's AFK status (I mean, consider the player to be afk when they've not sent an update for 3 seconds rather than 2568 milliseconds
).
And in fact the method that tyler posted does work, but not the best. What I've considered to be the best solution so far is have a variable that is incremented in a timer and set to zero in OnPlayerUpdate.
pawn Код:
new NoUpdateFor[MAX_PLAYERS];
// OnGameModeInit()
SetTimer("IncrementAFK", 1000, true);
// IncrementAFK()
foreach(Player, i)
{
NoUpdateFor[i] ++;
}
// OnPlayerUpdate(playerid)
NoUpdateFor[i] = 0;
// IsPlayerNotSendingUpdates(playerid)
return (NoUpdateFor[playerid] > 3);
This method has an upside of its own: you can specify how long the player has been alt tabbed for (the value of seconds is stored in NoUpdateFor[playerid]). Also it does not run any very large calculations so it should be the best suitable option for using in OnPlayerUpdate as well.