AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CSGO] GetClientCount() returns wrong player count in OnClientDisconnect_Post (https://forums.alliedmods.net/showthread.php?t=319900)

user420 11-25-2019 15:52

[CSGO] GetClientCount() returns wrong player count in OnClientDisconnect_Post
 
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.

Powerlord 11-25-2019 16:32

Re: [CSGO] GetClientCount() returns wrong player count in OnClientDisconnect_Post
 
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.

user420 11-26-2019 10:31

Re: [CSGO] GetClientCount() returns wrong player count in OnClientDisconnect_Post
 
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 ;)


All times are GMT -4. The time now is 05:16.

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