Dedicated Servers Aren't Included in Player List Iteration

Status
Not open for further replies.
For some odd reason, the dedicated server is not included when you iterate the player list by using for player in players.iterate. I originally thought the MapChange and ThinkFrame hooks aren't executing in dedicated servers, but then I tested local variables outside of for player in players.iterate, and the hooks worked perfectly fine, but player is nil if I attempt to use any player variables outside of for player in players.iterate, since player is undefined in the MapChange and ThinkFrame hooks.

Original Version of Thread:
If you are using the dedicated server, then the MapChange and ThinkFrame hooks never execute; as a result, player.empiralMP is nil for the dedicated server, and it is causing Lua errors. I found this out when I didn't see any messages being printed involving the pre-init, init, and post-init stages for EmpiralMP on the dedicated server's side. I do not know if this is intentional or a bug with SRB2. On integrated servers and clients, there are no Lua errors at all.
 
Last edited:
Are you absolutely sure that ThinkFrame doesn't run at all for dedicated servers? If it did then a lot of scripts would be breaking in dedicated mode I'd imagine.

No idea about MapChange though, that has issues of its own even outside of dedicated servers IIRC.
 
Are you absolutely sure that ThinkFrame doesn't run at all for dedicated servers? If it did then a lot of scripts would be breaking in dedicated mode I'd imagine.

No idea about MapChange though, that has issues of its own even outside of dedicated servers IIRC.
I need to do some more testing.

---------- Post added at 09:41 PM ---------- Previous post was at 09:28 PM ----------

Update: Sorry to double post, but ThinkFrame, and MapChange do in fact work on dedicated servers; the real issue is that dedicated servers are not included when the player list is iterated through for some reason.
 
Pretty sure that is intentional—for many common scripts, it would be a waste to constantly iterate through a player slot that doesn't have any actual in-game presence. If you need to access the player_t struct of the dedicated server, I believe the global Lua variable server points to it. https://wiki.srb2.org/wiki/Lua/Global_variables
 
Pretty sure that is intentional—for many common scripts, it would be a waste to constantly iterate through a player slot that doesn't have any actual in-game presence. If you need to access the player_t struct of the dedicated server, I believe the global Lua variable server points to it. https://wiki.srb2.org/wiki/Lua/Global_variables
Thanks. I will go ahead and fix that before working on multiple home support.

Sent from my LGL62VL using ********
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top