Forum

> > CS2D > Scripts > Check if a player has completely joined the server
Forums overviewCS2D overview Scripts overviewLog in to reply

English Check if a player has completely joined the server

6 replies
To the start Previous 1 Next To the start

old Check if a player has completely joined the server

Nekomata
User Off Offline

Quote
solved


I've come over this bug recently and have no idea how to provide an efficient fix for it. Too tired&busy to experiment over it therefore I'm looking for a solution to this issue. I'll attempt to explain this as simply as possible.

As you all know, when you join a server. There's a state inbetween you joining and hitting the "join" hook. This state occurs during the "Connecting to server" phase which can be often prolonged due to lag.

During that state you're given an ID in the server however you don't reach the join hook yet.

Clear so far? Alright. The problem with this is that if you're using a script to loop through the players at some time and they have a user object defined, it returns a nil value and crashes the script.

What's this user object I speak of? >



If that doesn't explain it then consider this le badly made flowchart.


This phase occurs for 2-4 seconds (depending on lag), however that's sufficient enough to bug the script by returning a nil during loops if you need to update something in their array. Is there any way to check if a player has completely joined?
edited 1×, last 14.11.15 12:54:32 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview