alliedmodders / sourcemod

SourceMod - Source Engine Scripting and Administration
http://www.sourcemod.net/
974 stars 422 forks source link

Reserved Bots counts Bots as players #1587

Open FaxMac opened 2 years ago

FaxMac commented 2 years ago

Help us help you

Environment

Description

Reserved Slots counts Bots as players, i am trying to use replays/sourcetv and the way that works is having a bot on spectator mode but also adding 1 hidden slot more to the server

So lets say i make a server with maxplayers 16

the bot makes 1 hidden slot

and i set up sourcemod with sm_reserved_slots 2 and sm_hide_slots 1

sourcemod adds 2 slots

in total i have 19 slots

The issue comes with the visible slots, sourcemod doesn't add the amount of hidden slots before (the hidden slot that the bot created), so sourcemod makes it so its 2 hidden slots

So right now, i have 17 visible slots. 17 usable slots and 2 reserved and 1 usable slot is being used by the bot, the server browser shows (0/17) even if the bot is inside.

The problem comes that when the server is filled with 16 people + 1 bot , all 17 usable slots are filled, but the server shows that the server has 1 free slot more (16/17), that's because the bot isn't being counted as a player, the problem there is that the player instead of using the 17 slot, its using the 18 slot, which is reserved, thus, the person gets kicked for reservation.

I tried to do a workaround by trying to make it so bots have access to the reserved slots thus when the server fills up, the bot will move to the reserved slot so that public slot will be used for a nomal player, but sourcemod doesn't support adding admin perms to Bots, i tried all auth methods but none of them worked.

Problematic Code (or Steps to Reproduce)

-Set up Source TV/Replays

-Use sm_reserved_slots 2 and sm_hide_slots 1

-Fill the server with players

-Server will show there is 1 slot avalible but when trying to use that last slot, it will kick the player returning a message that the slot is reserved

ambaca commented 2 years ago

Hi. I don't know, do you know, but base SM reserved slots plugin is not amazing. Because you need get extra player slots to get this work. SourceMod not add more slots on server. -You need (or server provider) start server with higher count of maxplayers. -Keep in mind, reserved slots not stay filled. Those slots will be free sooner or later, purpose with reserved slot is to make space so you can enter inside server. -You can setup so specific amount of "admins" are in server, all reserved slots turn to public slots.

SM reserved slots plugin change cvar sv_visiblemaxplayers when reserved slot have been added and/or hide slots. -This change max players visibility on server browser site. But can't show higher value than server real maxplayers count.

SourceTV (and Replay ?) do add one more slot on server, for itself. To avoid problems with these, you need enable and set up these from ...cfg/autoexec.cfg, before first map startup. ...cfg/server.cfg is working too late.

All bots are in count as player who occupy player slot after all. Your solution is to get more extra players slots (include SourceTV into calculation). -Keep regular bots count less, otherwise plugin start kick bots with kick command rather than bot_kick command. This could create loop of kicking bot who enter in server.

FaxMac commented 2 years ago

Hi. I don't know, do you know, but base SM reserved slots plugin is not amazing. Because you need get extra player slots to get this work. SourceMod not add more slots on server. -You need (or server provider) start server with higher count of maxplayers. -Keep in mind, reserved slots not stay filled. Those slots will be free sooner or later, purpose with reserved slot is to make space so you can enter inside server. -You can setup so specific amount of "admins" are in server, all reserved slots turn to public slots.

SM reserved slots plugin change cvar sv_visiblemaxplayers when reserved slot have been added and/or hide slots. -This change max players visibility on server browser site. But can't show higher value than server real maxplayers count.

SourceTV (and Replay ?) do add one more slot on server, for itself. To avoid problems with these, you need enable and set up these from ...cfg/autoexec.cfg, before first map startup. ...cfg/server.cfg is working too late.

All bots are in count as player who occupy player slot after all. Your solution is to get more extra players slots (include SourceTV into calculation). -Keep regular bots count less, otherwise plugin start kick bots with kick command rather than bot_kick command. This could create loop of kicking bot who enter in server.

Sorry, i had cohesion problems, i do know that sourcemod doesen't add slots, i got confused talking about actual slots and visible slots, my issue is that if for example, i want 14 visible slots and 2 hidden reserverd slots (in total 16 slots, so i set maxplayers 16) , when the bot adds one slot to the maxplayers (in total 17 now), sourcemod only subtracts 2 visible slots.

Visible Slots = MaxPlayers - Reserved Slots

When the bot isn't present:

14 = 16 - 2

When the bot is present and adds an extra slot:

15 = 17 - 2

Reserved slots doesn't acknowledge that there was 1+ hidden slot before, so it just subtracts the amount of reserved slots.

There is also the fact that bots do not show up in the amount of players connected, so when the server is full, it will show 14/15, but the server is full, the bot isn't being counted, so when players try to connect, they will be kicked because they are trying to use a reserved slot.

as for using autoexec.cfg, enabling replays/SourceTV can be done with parameters on the startup script, so its not an error of order of execution.

The fixes would be either

A) Let bots use reserved slots

Or

B) If Replays/SourceTV is enabled

Visible Slots = MaxPlayers - Reserved Slots + (MaxPlayers - sv_visiblemaxplayers before the plugin is run)