Raised This Month: $ Target: $400
 0% 

get_user_ping() on client_authorized() event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kalash1k
Member
Join Date: Nov 2008
Old 02-08-2010 , 12:24   get_user_ping() on client_authorized() event
Reply With Quote #1

Hello all.

I have a question. Why is the "ping" in get_user_ping(id, ping, loss) returns 0 on client_authorized() entity ?

Here is what I mean exactly:
Code:
public client_putinserver(id)
{
	new ping, loss

	get_user_ping(id, ping, loss)
	
	server_print("Ping %d", ping)
}
It prints: Ping 0.

I tried to use client_connect(), client_putinserver(id)
And there is the same result.

Is there any way to hook client's ping when he is connecting (or authorized, or putinserver) ?
kalash1k is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 02-08-2010 , 14:58   Re: get_user_ping() on client_authorized() event
Reply With Quote #2

If you're testing it on a local server, then 0 is the ping you're expecting. Ask other person to enter your server from the Internet.
Seta00 is offline
kalash1k
Member
Join Date: Nov 2008
Old 02-09-2010 , 21:32   Re: get_user_ping() on client_authorized() event
Reply With Quote #3

Quote:
Originally Posted by Seta00 View Post
If you're testing it on a local server, then 0 is the ping you're expecting. Ask other person to enter your server from the Internet.
Dont think I am a stupid idiot. I know what ping must be. And no, it is not on local server. Even if it will be a local server the ping will be more than 0 anyway, especially on Win systems.
Anyway, It detects ping 0 before the player will be the "UNASSIGNED". After this it detects ping normally.

The question is the same...

Last edited by kalash1k; 02-09-2010 at 21:41.
kalash1k is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-09-2010 , 22:53   Re: get_user_ping() on client_authorized() event
Reply With Quote #4

Try setting a task 5 seconds post-authorization. See if it's the same outcome, or if it's the server not picking it up for some other reason.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
kalash1k
Member
Join Date: Nov 2008
Old 02-11-2010 , 02:59   Re: get_user_ping() on client_authorized() event
Reply With Quote #5

Hm.
Code:
new ping, loss

public client_authorized(id)
     check_ping(id)

public check_ping(id)
{
     get_user_ping(id, ping, loss)
     
     if(!ping)
         set_task(0.5, "check_ping", id)

     server_print("Ping %d", ping)
}
Am I right?
kalash1k is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-11-2010 , 03:03   Re: get_user_ping() on client_authorized() event
Reply With Quote #6

Quote:
Originally Posted by kalash1k View Post
Hm.
Code:
new ping, loss

public client_authorized(id)
     check_ping(id)

public check_ping(id)
{
     get_user_ping(id, ping, loss)
     
     if(!ping)
         set_task(0.5, "check_ping", id)

     server_print("Ping %d", ping)
}
Am I right?
PHP Code:
new pingloss

public client_authorized(id)
     
set_task4.0"check_ping"id )

public 
check_ping(id)
{
     
get_user_ping(idpingloss)

     
server_print("Ping %d"ping)

__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-11-2010 , 06:29   Re: get_user_ping() on client_authorized() event
Reply With Quote #7

PHP Code:
public client_putinserver(Client)
        
set_task(5.0"CheckPing"Client);
 
public 
client_disconnect(Client)
        
remove_task(Client);
 
public 
CheckPing(Client)
{
        new 
PingLoss;
        
get_user_ping(ClientPingLoss);
 
        
server_print("Ping %d"Ping);

__________________
hleV is offline
kalash1k
Member
Join Date: Nov 2008
Old 02-26-2010 , 17:33   Re: get_user_ping() on client_authorized() event
Reply With Quote #8

Big thanks!
kalash1k is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-26-2010 , 17:41   Re: get_user_ping() on client_authorized() event
Reply With Quote #9

Is that remove_task necessary since the set_task isn't called to repeat?
__________________
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-26-2010 , 17:51   Re: get_user_ping() on client_authorized() event
Reply With Quote #10

Client can disconnect within 5 seconds error?
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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 07:22.


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