Fix for CS:GO update.
3 * ===============================================================
4 * CS:S DM, Copyright (C) 2004-2007 AlliedModders LLC.
5 * By David "BAILOPAN" Anderson
7 * ===============================================================
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or (at
12 * your option) any later version.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; see the file COPYING; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
27 #include "cssdm_players.h"
28 #include "cssdm_headers.h"
29 #include "cssdm_utils.h"
30 #include "cssdm_config.h"
31 #include "cssdm_includesdk.h"
33 ClientListener g_ClientListener;
34 dm_player_t g_players[65];
36 void DM_ResetPlayer(int client);
37 void DM_ActivatePlayer(int client);
39 void ClientListener::OnClientConnected(int client)
41 memset(&g_players[client], 0, sizeof(dm_player_t));
44 void ClientListener::OnClientDisconnecting(int client)
46 dm_player_t *player = DM_GetPlayer(client);
48 DM_ResetPlayer(client);
51 void ClientListener::OnClientPutInServer(int client)
53 DM_ActivatePlayer(client);
56 void DM_ResetPlayer(int client)
58 dm_player_t *player = DM_GetPlayer(client);
64 if (player->respawn_timer)
66 timersys->KillTimer(player->respawn_timer);
69 memset(player, 0, sizeof(dm_player_t));
72 void DM_ActivatePlayer(int client)
74 dm_player_t *player = DM_GetPlayer(client);
80 CBaseEntity *pEntity = DM_GetBaseEntity(client);
86 player->pEdict = gamehelpers->EdictOfIndex(client);
87 player->pEntity = pEntity;
88 player->pInfo = playerinfomngr->GetPlayerInfo(player->pEdict);
89 player->pBot = botmanager->GetBotController(player->pEdict);
90 player->userid = engine->GetPlayerUserId(player->pEdict);
93 dm_player_t *DM_GetPlayer(int client)
95 if (client < 1 || client > gpGlobals->maxClients)
100 return &g_players[client];