Raised This Month: $32 Target: $400
 8% 

Is client on desktop?


Post New Thread Reply   
 
Thread Tools Display Modes
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 05-16-2014 , 05:22   Re: Is client on desktop?
Reply With Quote #21

What about save a "last active" time on OnPlayerRunCmd and if you need to know if someone is afk you check his last saved time against current time?

PHP Code:
new Float:g_fLastCmd[MAXPLAYERS+1];

...

if(
IsClientInGame(client) && GetGameTime() - g_fLastCmd[client] > 5.0)
{
   
//player is on destop
}

...

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    
g_fLastCmd[client] = GetGameTime();

__________________
zipcore is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 05-16-2014 , 13:34   Re: Is client on desktop?
Reply With Quote #22

Quote:
Originally Posted by zipcore View Post
What about save a "last active" time on OnPlayerRunCmd and if you need to know if someone is afk you check his last saved time against current time?

PHP Code:
new Float:g_fLastCmd[MAXPLAYERS+1];

...

if(
IsClientInGame(client) && GetGameTime() - g_fLastCmd[client] > 5.0)
{
   
//player is on destop
}

...

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    
g_fLastCmd[client] = GetGameTime();

i.e. check out my strange lvlr plugin, i have a method of checking for afk.
Mitchell is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 05-16-2014 , 22:57   Re: Is client on desktop?
Reply With Quote #23

may also work to hook one of the thinks, pretty sure nothing happens there as well. I've noticed that when clients minimize or lag when i'm having a think teleport a prop around, it'll fall down sometimes
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 05-17-2014 , 02:10   Re: Is client on desktop?
Reply With Quote #24

Quote:
Originally Posted by friagram View Post
think teleport a prop around, it'll fall down sometimes
this has heppened to me before too, but it would only happen a few times, and then continue, mainly server lag though.
Mitchell is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 05-20-2014 , 19:07   Re: Is client on desktop?
Reply With Quote #25

I started csgo, it was still waiting in steam for starting so I went back to my browers, then after 1min i clicked first time to csgo, and I read the red line in my console:
CGameEventManager::AddListener: event 'gameui_hidden' unknown.
You all know what Im now thinking about

Hook gameui_hidden? even if it is unknown ... or maybe it will come soon..
TheWho is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-21-2014 , 09:07   Re: Is client on desktop?
Reply With Quote #26

Quote:
Originally Posted by TheWho View Post
I started csgo, it was still waiting in steam for starting so I went back to my browers, then after 1min i clicked first time to csgo, and I read the red line in my console:
CGameEventManager::AddListener: event 'gameui_hidden' unknown.
You all know what Im now thinking about

Hook gameui_hidden? even if it is unknown ... or maybe it will come soon..
That's a clientside event. It has never existed on the server.
psychonic is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 05-21-2014 , 11:41   Re: Is client on desktop?
Reply With Quote #27

Okay but since it is a command...
PHP Code:
native bool:AddCommandListener(CommandListener:callback, const String:command[]=""); 
we can do this.
TheWho is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-21-2014 , 11:43   Re: Is client on desktop?
Reply With Quote #28

Quote:
Originally Posted by TheWho View Post
Okay but since it is a command...
PHP Code:
native bool:AddCommandListener(CommandListener:callback, const String:command[]=""); 
we can do this.
It's an event, not a command. There exist some gameui_ commands, but they are only on the client and not sent to the server.
psychonic is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 05-21-2014 , 11:46   Re: Is client on desktop?
Reply With Quote #29

Mate.. you know everything
TheWho is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 05-21-2014 , 13:00   Re: Is client on desktop?
Reply With Quote #30

PSYduck
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.
Dr. Greg House is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode