Raised This Month: $ Target: $400
 0% 

IsClientTimingOut(client) usage [SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
midnight9
Senior Member
Join Date: Nov 2012
Old 12-10-2016 , 06:18   IsClientTimingOut(client) usage [SOLVED]
Reply With Quote #1

Hello. So i found IsClientTimingOut(client); native and from what i understand it triggers when player is timing out. I allready have a different plugin that prints a message when player is disconnected due to the crash but i would like to print a message as soon as player starts to timing out before he actually gets disconnected, so other players can pause the game. But im not sure how to use this native, i mean i dont know what event or forward i should use to make it work.

Regards

Last edited by midnight9; 12-10-2016 at 19:13.
midnight9 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 12-10-2016 , 07:47   Re: IsClientTimingOut(client) usage
Reply With Quote #2

A periodic timer, every 1 - 5 seconds would probably be reasonable.
__________________
asherkin is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 12-10-2016 , 08:36   Re: IsClientTimingOut(client) usage
Reply With Quote #3

What do you mean by periodic timer?
midnight9 is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 12-10-2016 , 10:05   Re: IsClientTimingOut(client) usage
Reply With Quote #4

https://sm.alliedmods.net/api/index....d=show&id=156&
Miu is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 12-10-2016 , 10:17   Re: IsClientTimingOut(client) usage
Reply With Quote #5

I tried something like this but it didnt work, however im not a coder so kinda i dont know what im doing.

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#define CHECK_TIME    1.0
public OnPluginStart()
{
CreateTimer(CHECK_TIMECheck_Is_TimingOut_TIMER_REPEAT);
}
 
public 
Action:Check_Is_TimingOut(Handle:timer) {
 
 for (new 
1<= MaxClientsi++){
  if (
IsClientInGame(i) && !IsFakeClient(i) && IsClientTimingOut(i) != 1){
   return 
Plugin_Handled;
  }
  
PrintToChatAll("\x04%s\x01 is TimingOut"i);
  
  return 
Plugin_Handled;
 }  


Last edited by midnight9; 12-10-2016 at 10:18.
midnight9 is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 12-10-2016 , 10:23   Re: IsClientTimingOut(client) usage
Reply With Quote #6

Try this:
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#define CHECK_TIME    1.0
public OnPluginStart()
{
CreateTimer(CHECK_TIMECheck_Is_TimingOut_TIMER_REPEAT);
}
 
public 
Action:Check_Is_TimingOut(Handle:timer) {
 
 for (new 
1<= MaxClientsi++){
  if (
IsClientInGame(i) && !IsFakeClient(i) && !IsClientTimingOut(i)){
   return 
Plugin_Handled;
  }
  else if(
IsClientTimingOut(i))
  {
  
PrintToChatAll("\x04%s\x01 is TimingOut"i);
  }
  return 
Plugin_Handled;
 }  

__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 12-10-2016 , 10:33   Re: IsClientTimingOut(client) usage
Reply With Quote #7

Quote:
Originally Posted by BraveFox View Post
Try this:
PHP Code:
#pragma semicolon 1
 #include <sourcemod>
 #define CHECK_TIME    1.0
 
public OnPluginStart()
 {
 
CreateTimer(CHECK_TIMECheck_Is_TimingOut_TIMER_REPEAT);
 }
  
 public 
Action:Check_Is_TimingOut(Handle:timer) {
  
  for (new 
1<= MaxClientsi++){
   if (
IsClientInGame(i) && !IsFakeClient(i) && !IsClientTimingOut(i)){
    return 
Plugin_Handled;
   }
   else if(
IsClientTimingOut(i))
   {
   
PrintToChatAll("\x04%s\x01 is TimingOut"i);
   }
   return 
Plugin_Handled;
  }  
 } 
Doesnt work
midnight9 is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 12-10-2016 , 10:47   Re: IsClientTimingOut(client) usage
Reply With Quote #8

...

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#define CHECK_TIME    1.0

public void OnPluginStart() {
    
CreateTimer(CHECK_TIMECheck_Is_TimingOut_TIMER_REPEAT);
}

public 
Action Check_Is_TimingOut(Handle timer) {
    for (new 
1<= MaxClientsi++)
        if (
IsClientInGame(i) && !IsFakeClient(i) && IsClientTimingOut(i))
            
PrintToChatAll("\x04%N\x01 is TimingOut"i);

__________________

Last edited by ddhoward; 12-10-2016 at 10:48.
ddhoward is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 12-10-2016 , 10:58   Re: IsClientTimingOut(client) usage
Reply With Quote #9

Quote:
Originally Posted by ddhoward View Post
...

PHP Code:
#pragma semicolon 1
 #include <sourcemod>
 #define CHECK_TIME    1.0
 
 
public void OnPluginStart() {
     
CreateTimer(CHECK_TIMECheck_Is_TimingOut_TIMER_REPEAT);
 }
 
 public 
Action Check_Is_TimingOut(Handle timer) {
     for (new 
1<= MaxClientsi++)
         if (
IsClientInGame(i) && !IsFakeClient(i) && IsClientTimingOut(i))
             
PrintToChatAll("\x04%N\x01 is TimingOut"i);
 } 
Allready tried that
midnight9 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-10-2016 , 14:19   Re: IsClientTimingOut(client) usage
Reply With Quote #10

returning Plugin_Handled will kill the timer is what ddhoward is saying.
Mitchell 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 19:18.


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