PDA

View Full Version : session.members table bugged? Private?



Dealman
29-05-2018, 11:17
I've started working on my server addon for a self-managed server again and while it's coming along nicely, I've run into a problem.

I want admins to be able to kick/ban players, however I am unable to do this because the global table session.members is always empty. Is this table bugged or locked to certain resources? 'Cause I know sms_stats uses it.

This also messes with my command where admins can set the track whilst in the lobby, as I can't check how many players are currently in the server. I need to do this since if the track's maximum grid size is smaller than the currently allowed max players - the server selects a random track(usually Red Bull National).

Wouldn't it be better if the grid is full, any extra players are put as spectators instead? Since I can only change MaxPlayers for the next session.

Edit:

So I've made my own workaround meanwhile. I haven't tested it all too much yet, just got it working for my kick command and checking how many players are online. If anyone else runs into this issue, here's the code that I use (https://pastebin.com/WpfEwXD6).

I might make it a dedicated resource later on with dedicated functions such as GetPlayerByName and such.