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

Player Load Time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
midnight9
Senior Member
Join Date: Nov 2012
Old 02-12-2017 , 16:28   Player Load Time
Reply With Quote #1

Hello, I want to print to chat player loading time, something like this:

Player "Name" has loaded in 7.8 seconds

I assume i need to use GetGameTime() on OnClientConnected forward and then check the time when client is loaded so for example OnClientPostAdminCheck, just not sure how to put this together.
Any help will be greatly appreciated.

Last edited by midnight9; 02-12-2017 at 16:29.
midnight9 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-12-2017 , 16:33   Re: Player Load Time
Reply With Quote #2

You would do the second check on player spawn as its called with team none just before the team selection menu.
__________________
Neuro Toxin is offline
fakuivan
Senior Member
Join Date: Nov 2015
Old 02-15-2017 , 09:25   Re: Player Load Time
Reply With Quote #3

Create two arrays one representing the time a player connected and other one representing the time a player is fully in game, clear the indices on client disconnect. Then do a ``gi_client_in_game[i_client] - gi_client_connected[i_client]`` to get the loading time
__________________
fakuivan is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-15-2017 , 10:04   Re: Player Load Time
Reply With Quote #4

Use OnClientConnect, not OnClientConnected
Mitchell is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 02-16-2017 , 07:27   Re: Player Load Time
Reply With Quote #5

Quote:
Originally Posted by Mitchell View Post
Use OnClientConnect, not OnClientConnected
OnClientConnected sort of worked but sometimes on map changes i was getting weird loading times for example: Player 1 loaded in 0.2seconds, Player 2 loaded in 0.4 seconds etc. I have allready changed to OnClientConnect and im waiting to see this will solve the issue or not. Since i cant think of anything else.

Last edited by midnight9; 02-16-2017 at 07:27.
midnight9 is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 02-16-2017 , 13:30   Re: Player Load Time
Reply With Quote #6

OnClientConnect and OnClientPutInServer is what you want.
__________________
Benoist3012 is offline
Lolz123
Member
Join Date: Aug 2010
Old 02-17-2017 , 06:29   Re: Player Load Time
Reply With Quote #7

PHP Code:
float g_fTime[MAXPLAYERS 1];

public 
bool OnClientConnect(int clientchar[] rejectmsgint maxlen)
{
    
g_fTime[client] = GetGameTime();
}

public 
void OnClientPutInServer(int client)
{
    
PrintToChatAll("Player %N has loaded in %.1f seconds"clientGetGameTime() - g_fTime[client]);

Something like this?
Lolz123 is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 02-17-2017 , 09:11   Re: Player Load Time
Reply With Quote #8

I got it sorted, thanks all for help.

Last edited by midnight9; 02-17-2017 at 09:12.
midnight9 is offline
Reply



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 02:44.


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