Detect back windows?
#1

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

What is that thing? Is this a new feature of 0.3x?
Reply
#3

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

Should've rather given us the option to add specific icons to a players nametag.
Reply
#5

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

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

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!
Reply
#8

Quote:
Originally Posted by Cypress
Посмотреть сообщение
That's really inaccurate!
Yeah, the best bet would be to check the TickCount on every PlayerUpdate.
Reply
#9

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
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)