Raised This Month: $12 Target: $400
 3% 

get_user_time is not supported in client_disconnected?


Post New Thread Reply   
 
Thread Tools Display Modes
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 04-27-2017 , 01:17   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #21

Sorry, get_user_time returns 0 when map is changing (server is full - 32 players)
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-27-2017 , 01:26   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #22

PHP Code:
#define TASK_TIMER 7650
new User_time[33];
public 
client_connect(idUser_time[id] = 0set_task(1.0"timer"TASK_TIMER+id__"b");
public 
client_disconnect(idremove_task(id TASK_TIMER);
public 
timer(taskid)
{
       new 
id taskid TASK_TIMER;
       
User_time[id] ++;

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 04-27-2017 at 01:29.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 04-27-2017 , 02:42   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #23

This is not a solution
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-27-2017 , 06:08   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #24

You do likely something wrong.

You get 0 if the provided index is not between 1 and max clients, or the client is not in-game.

Whatever client_disconnecte(d), when the forward is fired, the player is still technically valid (disconnecting), and internally in AMXX nothing is reset yet (that's it the in-game state is not changed).

If you can reproduce the issue on latest dev version, please give the exact steps.
__________________
Arkshine is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 04-27-2017 , 09:39   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #25

Quote:
Originally Posted by OciXCrom View Post
What's not true? I just said that disconnected is a fixed version of disconnect.
Really is not a fixed version, duo the specific cases. This forward do the same thing as client_disconnect().

IF you need to do something related to client, will not work. The only "FIX" is that forward is now used in conjuction with client_connect:

Code:
 * @note This will be called in some additional cases that client_disconnect doesn't cover,  
 *       most notably when a client aborts the connection process. It is guaranteed to pair  
 *       with the client_connect() forward.
For sure get_user_time() will work, but not in all cases even with client_disconnect() or client_disconnected()
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 04-27-2017 , 13:36   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #26

Quote:
Originally Posted by OnePL View Post
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(playerprint_chat"%f"GetPlayerTime(player));
}

Float:GetPlayerTime(player) {
    new 
pUserInfo engfunc(EngFunc_GetInfoKeyBufferplayer);
    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(pNetchanConnectTimeTR_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.
__________________

Last edited by PRoSToTeM@; 04-27-2017 at 13:38.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 04-27-2017 , 16:46   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #27

Quote:
Originally Posted by Arkshine View Post
You do likely something wrong.

You get 0 if the provided index is not between 1 and max clients, or the client is not in-game.

Whatever client_disconnecte(d), when the forward is fired, the player is still technically valid (disconnecting), and internally in AMXX nothing is reset yet (that's it the in-game state is not changed).

If you can reproduce the issue on latest dev version, please give the exact steps.
Quote:
Originally Posted by OnePL View Post
PHP Code:
#include <amxmodx>

public client_disconnected(id) {
    new 
szName[32];
    
get_user_name(idszName31);
    
log_to_file("test.log""player (%i) %s (time %i) disconnected"idszNameget_user_time(id));

get_user_time returns 0 when map is changing (server is full - 32 players)
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 04-27-2017 , 16:55   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #28

@OnePL can you test with my GetPlayerTime function?
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 04-27-2017 , 17:12   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #29

Yes, wait a minute
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 04-27-2017 , 17:53   Re: get_user_time is not supported in client_disconnected?
Reply With Quote #30

Code:
L 04/27/2017 - 23:51:06: ID: 16 - get_user_time: 0 - getUserTime float: 0.000000 - getUserTime floatround: 0
L 04/27/2017 - 23:51:07: ID: 21 - get_user_time: 0 - getUserTime float: 0.000000 - getUserTime floatround: 0
L 04/27/2017 - 23:51:07: ID: 14 - get_user_time: 0 - getUserTime float: 0.000000 - getUserTime floatround: 0
L 04/27/2017 - 23:51:07: ID: 12 - get_user_time: 0 - getUserTime float: 0.000000 - getUserTime floatround: 0
L 04/27/2017 - 23:51:07: ID: 18 - get_user_time: 0 - getUserTime float: 0.000000 - getUserTime floatround: 0
L 04/27/2017 - 23:51:10: ID: 27 - get_user_time: 0 - getUserTime float: 0.000000 - getUserTime floatround: 0
getUserTime is @PRoSToTeM@'s function
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
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 14:47.


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