View Single Post
VEN
Veteran Member
Join Date: Jan 2005
Old 11-14-2006 , 13:42   Re: Ways getting ping?
Reply With Quote #2

Quote:
Is the code of get_user_ping function available?
Yes http://svn.tcwonline.org/viewvc.cgi/...xmodx&view=log
Code:
static cell AMX_NATIVE_CALL get_user_ping(AMX *amx, cell *params) /* 3 param */
{
    int index = params[1];

    if (index < 1 || index > gpGlobals->maxClients)
        return 0;

    CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);

    if (pPlayer->ingame)
    {
        cell *cpPing = get_amxaddr(amx, params[2]);
        cell *cpLoss = get_amxaddr(amx, params[3]);
        int ping, loss;
        PLAYER_CNX_STATS(pPlayer->pEdict, &ping, &loss);
        *cpPing = ping;
        *cpLoss = loss;

        return 1;
    }

    return 0;
}
Where PLAYER_CNX_STATS is an engine function
Quote:
Originally Posted by HLSDK
#define PLAYER_CNX_STATS ( *g_engfuncs.pfnGetPlayerStats )
Quote:
Originally Posted by HLSDK
void (*pfnGetPlayerStats) ( const edict_t *pClient, int *ping, int *packet_loss );
VEN is offline