Raised This Month: $32 Target: $400
 8% 

L4D2: What is a reliable way to perform an action AFTER ALL players are loaded in?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NgBUCKWANGS
Senior Member
Join Date: Dec 2014
Old 01-05-2017 , 14:12   L4D2: What is a reliable way to perform an action AFTER ALL players are loaded in?
Reply With Quote #1

My plugin ABM has 2 bugs (one is rare, the other extremely rare).
  • Between loading screens, if a person crashes, quits, times out during a tiny window, it can screw up the counting of team mates. This is the only time I can't track a player disconnecting.
  • For some reason (completely unrepeatable, very random), rarely someone gets moved to spectator.

I believe I can solve these two bugs if I can find the correct moment to iterate over the survivors. I can set an explicit spectator flag pretty easily where if a person didn't explicitly choose to be a spectator, I'll put them back on their team. Also by finding the best time to iterate over all of the survivors, I can fix the count for those rare disconnects that don't fire the player_disconnect event.

My approach would be this. After all players are loaded, iterate over them and find the ones that are no longer connected and remove them from the StringMap. Once this is done, start a timer that will watch out for spectators that didn't explicitly ask to spectate.

My problem is, I don't know the perfect moment, in which ALL players are really and finally connected AND where GetClientAuthId would actually work. I had some hacks that worked but I felt quite uncomfortable with them. Any help is greatly appreciated
NgBUCKWANGS is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 01-05-2017 , 18:57   Re: L4D2: What is a reliable way to perform an action AFTER ALL players are loaded in
Reply With Quote #2

You can just add natives in other plugins that can handle the bugs you mention. Examples of this are my Modified Self-Help and Different Ammo Packs plugins.

For the disconnect problem, there are plugins such as Client timeout override and Kick Load Stuckers plugins that handles kicking clients that are taking too long to connect including those who crashed and suddenly quit.

Here's how to do it:
Spoiler


For the spectator problem, there's Spectators always stay spectators plugin that records every human spectator's SteamID and checks it in the next map. You can do the same as above.

Last edited by cravenge; 01-05-2017 at 19:00.
cravenge is offline
NgBUCKWANGS
Senior Member
Join Date: Dec 2014
Old 01-05-2017 , 20:54   Re: L4D2: What is a reliable way to perform an action AFTER ALL players are loaded in
Reply With Quote #3

You've give me a great idea. So basically, would it be safe to say that after the very first person activates on the server after a map change, start a timer that counts down, say 120 seconds and anyone that isn't connected after that, kick them?
NgBUCKWANGS is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 01-06-2017 , 07:07   Re: L4D2: What is a reliable way to perform an action AFTER ALL players are loaded in
Reply With Quote #4

I think there's a downside and it would affect the clients. Could be wrong though..

Last edited by cravenge; 01-06-2017 at 07:10.
cravenge 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 09:07.


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