Quote:
Originally Posted by OnePL
Sorry, get_user_time returns 0 when map is changing (server is full - 32 players)
|
I think it returns 0 when someone goes to fastdl on changelevel. It is 0 because get_user_time is reset on reconnect. If you need time that is insensitive to reconnections (like player's time in ServerBrowser) you can use this:
PHP Code:
#include <amxmodx>
#include <fakemeta>
public plugin_init() {
register_clcmd("say /mytime", "MyTime");
}
public MyTime(player) {
client_print(player, print_chat, "%f", GetPlayerTime(player));
}
Float:GetPlayerTime(player) {
new pUserInfo = engfunc(EngFunc_GetInfoKeyBuffer, player);
new userInfoOffs = is_linux_server() ? 0x4AA0 : 0x4BC0;
new pClient = pUserInfo - userInfoOffs;
new netchanConnectTimeOffs = is_linux_server() ? 0x3C : 0x40;
new pNetchanConnectTime = pClient + netchanConnectTimeOffs;
new Float:netchanConnectTime = any:get_tr2(pNetchanConnectTime, TR_AllSolid);
// netchanConnectTime is realtime based and Time is Sys_FloatTime based
// but Sys_FloatTime is nearly the same as realtime, the difference should be lower than 1ms
return Float:engfunc(EngFunc_Time) - netchanConnectTime;
}
But it is sensitive to retry and fastdl.
__________________