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

[CSGO] GetClientCount() returns wrong player count in OnClientDisconnect_Post


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
user420
New Member
Join Date: Nov 2019
Old 11-25-2019 , 15:52   [CSGO] GetClientCount() returns wrong player count in OnClientDisconnect_Post
Reply With Quote #1

I want to get the amount of players when a player disconnects.

First I tried GetClientCount() inside "OnClientDisconnect" but it seemed to still count the player who disconnected so I tried it inside "OnClientDisconnect_Post" but it still seems to count the player who left.

I know I could simply do GetClientCount()-1 but maybe I'm missing something.
user420 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-25-2019 , 16:32   Re: [CSGO] GetClientCount() returns wrong player count in OnClientDisconnect_Post
Reply With Quote #2

I'm not sure if this will work, but you could also try a post-event hook on the player_disconnect event. This event only fires when a player disconnects from the server; the two other methods also fire when the server changes maps.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
user420
New Member
Join Date: Nov 2019
Old 11-26-2019 , 10:31   Re: [CSGO] GetClientCount() returns wrong player count in OnClientDisconnect_Post
Reply With Quote #3

I decided to stick with the GetClientCount()-1 solution since hooking on mapchange isn't a problem in my case.

Anyway, thank you for your efforts ;)
user420 is offline
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 04:19.


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