Fix spectator bug

This commit is contained in:
Federico Cecchetto 2022-07-01 22:24:13 +02:00
parent c7296a5600
commit 51ecb9fa35
2 changed files with 31 additions and 2 deletions

View File

@ -123,6 +123,12 @@ namespace patches
const auto menu_id = atoi(params.get(1)); const auto menu_id = atoi(params.get(1));
const auto client = &svs_clients[ent->s.entityNum]; const auto client = &svs_clients[ent->s.entityNum];
// 13 => change class
if (menu_id == 13 && ent->client->team == game::mp::TEAM_SPECTATOR)
{
return;
}
// 32 => "end_game" // 32 => "end_game"
if (menu_id == 32 && client->header.remoteAddress.type != game::NA_LOOPBACK) if (menu_id == 32 && client->header.remoteAddress.type != game::NA_LOOPBACK)
{ {

View File

@ -1519,16 +1519,39 @@ namespace game
int usesDelta; int usesDelta;
}; };
enum sessionState_t
{
SESS_STATE_PLAYING = 0x0,
SESS_STATE_DEAD = 0x1,
SESS_STATE_SPECTATOR = 0x2,
SESS_STATE_INTERMISSION = 0x3,
};
enum team_t
{
TEAM_FREE = 0x0,
TEAM_BAD = 0x0,
TEAM_AXIS = 0x1,
TEAM_ALLIES = 0x2,
TEAM_SPECTATOR = 0x3,
TEAM_NUM_TEAMS = 0x4,
};
struct gclient_s struct gclient_s
{ {
char __pad0[2]; char __pad0[2];
char pm_type; // 2 char pm_type; // 2
char __pad1[18831]; char __pad1[18573];
sessionState_t sessionState;
char __pad2[220]; // 254
team_t team;
char __pad3[30];
char name[32]; // 18834 char name[32]; // 18834
char __pad2[622]; char __pad4[622];
int flags; // 19488 int flags; // 19488
}; // size = ? }; // size = ?
static_assert(offsetof(gclient_s, team) == 18800);
static_assert(offsetof(gclient_s, name) == 18834); static_assert(offsetof(gclient_s, name) == 18834);
static_assert(offsetof(gclient_s, flags) == 19488); static_assert(offsetof(gclient_s, flags) == 19488);