s1lentq / ReGameDLL_CS

:hammer: Reverse-engineered gamedll (CS 1.6 / CZero)
GNU General Public License v3.0
552 stars 197 forks source link

Players can be spawned while on the UNASSIGNED team #929

Open Nord1cWarr1or opened 5 months ago

Nord1cWarr1or commented 5 months ago

Players can be spawned while on the UNASSIGNED team, if there are less spawns on the map than slots on the server, and all slots in teams on the server are filled, and mp_auto_join_team and mp_forcerespawn CVars are active.

https://github.com/s1lentq/ReGameDLL_CS/assets/47604048/f1ac9d5c-eeb2-4ad4-825b-19be35036bfe

An easy way to reproduce this bug with bots:

  1. Start a server with 21 or more slots, with the startup parameter -bots
  2. Change the map to the original de_nuke or cs_militia, or any other map with only 20 spawns.
  3. Set the CVar values as follows:
    bot_quota 32; bot_stop 1; bot_join_after_player 0; bot_auto_vacate 0; mp_forcerespawn 1; mp_auto_join_team 1; humans_join_team any; mp_kill_filled_spawn 0; sv_restart 1
  4. Wait for the bots to take their places
  5. Connect to the server
  6. You will spawn for team 0 (TEAM_UNASSIGNED).
justgo97 commented 5 months ago

The bug might be related to this line: https://github.com/s1lentq/ReGameDLL_CS/blob/4b49f630da970cc62bb3cd7ecd65710dd7d87122/regamedll/dlls/player.cpp#L10453

probably should become:

if (m_iTeam == UNASSIGNED || m_iTeam == SPECTATOR)