View Full Version : Ways getting ping?
- Billy The Kid -
11-14-2006, 10:30
Is the code of get_user_ping function available?
Anyway I have few other questions, that I think are not related to module coding, but are related to this question, so I'm putting link to that topic:
http://forums.alliedmods.net/showthread.php?p=403171#post403171
Thx in advance ;)
Is the code of get_user_ping function available?
Yes http://svn.tcwonline.org/viewvc.cgi/trunk/amxmodx/amxmodx.cpp?root=amxmodx&view=log
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#define PLAYER_CNX_STATS ( *g_engfuncs.pfnGetPlayerStats )
void (*pfnGetPlayerStats) ( const edict_t *pClient, int *ping, int *packet_loss );
- Billy The Kid -
11-14-2006, 15:00
Thx man, really helpfull ;) Too bad karma up is limited to 1 :D
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.