AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_ping() on client_authorized() event (https://forums.alliedmods.net/showthread.php?t=118178)

kalash1k 02-08-2010 12:24

get_user_ping() on client_authorized() event
 
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) ?

Seta00 02-08-2010 14:58

Re: get_user_ping() on client_authorized() event
 
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.

kalash1k 02-09-2010 21:32

Re: get_user_ping() on client_authorized() event
 
Quote:

Originally Posted by Seta00 (Post 1082972)
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...

wrecked_ 02-09-2010 22:53

Re: get_user_ping() on client_authorized() event
 
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.

kalash1k 02-11-2010 02:59

Re: get_user_ping() on client_authorized() event
 
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?

wrecked_ 02-11-2010 03:03

Re: get_user_ping() on client_authorized() event
 
Quote:

Originally Posted by kalash1k (Post 1085236)
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)



hleV 02-11-2010 06:29

Re: get_user_ping() on client_authorized() event
 
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);



kalash1k 02-26-2010 17:33

Re: get_user_ping() on client_authorized() event
 
Big thanks!

Bugsy 02-26-2010 17:41

Re: get_user_ping() on client_authorized() event
 
Is that remove_task necessary since the set_task isn't called to repeat?

fysiks 02-26-2010 17:51

Re: get_user_ping() on client_authorized() event
 
Client can disconnect within 5 seconds :arrow: error?


All times are GMT -4. The time now is 07:22.

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