Updated for latest hl2sdk-dota changes.
Updated for latest hl2sdk-dota changes.
1.1 --- a/core/ChatTriggers.cpp Mon May 13 14:19:17 2013 -0400
1.2 +++ b/core/ChatTriggers.cpp Mon May 13 15:18:12 2013 -0400
1.3 @@ -286,7 +286,7 @@
1.4 int client = g_ConCmds.GetCommandClient();
1.5 unsigned int old = SetReplyTo(SM_REPLY_CHAT);
1.6 #if SOURCE_ENGINE == SE_DOTA
1.7 - engine->ClientCommand(PEntityOfEntIndex(client), "%s", m_ToExecute);
1.8 + engine->ClientCommand(client, "%s", m_ToExecute);
1.9 #else
1.10 serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
1.11 #endif
2.1 --- a/core/ConCmdManager.cpp Mon May 13 14:19:17 2013 -0400
2.2 +++ b/core/ConCmdManager.cpp Mon May 13 15:18:12 2013 -0400
2.3 @@ -539,7 +539,9 @@
2.4 return true;
2.5 }
2.6
2.7 +#if SOURCE_ENGINE != SE_DOTA
2.8 edict_t *pEdict = PEntityOfEntIndex(client);
2.9 +#endif
2.10
2.11 /* If we got here, the command failed... */
2.12 char buffer[128];
2.13 @@ -553,7 +555,11 @@
2.14 {
2.15 char fullbuffer[192];
2.16 UTIL_Format(fullbuffer, sizeof(fullbuffer), "[SM] %s.\n", buffer);
2.17 +#if SOURCE_ENGINE == SE_DOTA
2.18 + engine->ClientPrintf(client, fullbuffer);
2.19 +#else
2.20 engine->ClientPrintf(pEdict, fullbuffer);
2.21 +#endif
2.22 }
2.23 else if (replyto == SM_REPLY_CHAT)
2.24 {
3.1 --- a/core/ConVarManager.cpp Mon May 13 14:19:17 2013 -0400
3.2 +++ b/core/ConVarManager.cpp Mon May 13 15:18:12 2013 -0400
3.3 @@ -611,7 +611,11 @@
3.4 /* Call StartQueryCvarValue() in either the IVEngineServer or IServerPluginHelpers depending on situation */
3.5 if (m_bIsDLLQueryHooked)
3.6 {
3.7 +#if SOURCE_ENGINE == SE_DOTA
3.8 + cookie = engine->StartQueryCvarValue(IndexOfEdict(pPlayer), name);
3.9 +#else
3.10 cookie = engine->StartQueryCvarValue(pPlayer, name);
3.11 +#endif
3.12 }
3.13 #if SOURCE_ENGINE != SE_DOTA
3.14 else if (m_bIsVSPQueryHooked)
4.1 --- a/core/HalfLife2.cpp Mon May 13 14:19:17 2013 -0400
4.2 +++ b/core/HalfLife2.cpp Mon May 13 15:18:12 2013 -0400
4.3 @@ -300,7 +300,11 @@
4.4 #if SOURCE_ENGINE != SE_DARKMESSIAH
4.5 IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
4.6 {
4.7 +#if SOURCE_ENGINE == SE_DOTA
4.8 + return engine->GetChangeAccessor( IndexOfEdict((const edict_t *)this) );
4.9 +#else
4.10 return engine->GetChangeAccessor( (const edict_t *)this );
4.11 +#endif
4.12 }
4.13 #endif
4.14
4.15 @@ -792,7 +796,7 @@
4.16 {
4.17 CPlayer *pPlayer = g_Players.GetPlayerByIndex(pFake->client);
4.18 #if SOURCE_ENGINE == SE_DOTA
4.19 - engine->ClientCommand(pPlayer->GetEdict(), "%s", pFake->cmd.c_str());
4.20 + engine->ClientCommand(pPlayer->GetIndex(), "%s", pFake->cmd.c_str());
4.21 #else
4.22 serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), pFake->cmd.c_str());
4.23 #endif
5.1 --- a/core/PlayerManager.cpp Mon May 13 14:19:17 2013 -0400
5.2 +++ b/core/PlayerManager.cpp Mon May 13 15:18:12 2013 -0400
5.3 @@ -58,6 +58,13 @@
5.4 int lifestate_offset = -1;
5.5 List<ICommandTargetProcessor *> target_processors;
5.6
5.7 +#if SOURCE_ENGINE == SE_DOTA
5.8 +SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, int, const char *, const char *, char *, int);
5.9 +SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, int, const char *);
5.10 +SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, int);
5.11 +SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, int, const CCommand &);
5.12 +SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, int);
5.13 +#else
5.14 SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char *, const char *, char *, int);
5.15 SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, const char *);
5.16 SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, edict_t *);
5.17 @@ -67,6 +74,7 @@
5.18 SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
5.19 #endif
5.20 SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
5.21 +#endif // SE_DOTA
5.22
5.23 #if SOURCE_ENGINE == SE_DOTA
5.24 SH_DECL_HOOK0_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0);
5.25 @@ -380,7 +388,11 @@
5.26 for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
5.27 {
5.28 pPlayer = &m_Players[m_AuthQueue[i]];
5.29 +#if SOURCE_ENGINE == SE_DOTA
5.30 + authstr = engine->GetPlayerNetworkIDString(pPlayer->m_iIndex - 1);
5.31 +#else
5.32 authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
5.33 +#endif
5.34 pPlayer->SetAuthString(authstr);
5.35
5.36 if (!pPlayer->IsAuthStringValidated())
5.37 @@ -457,9 +469,15 @@
5.38 }
5.39 }
5.40
5.41 +#if SOURCE_ENGINE == SE_DOTA
5.42 +bool PlayerManager::OnClientConnect(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
5.43 +{
5.44 + edict_t *pEntity = PEntityOfEntIndex(client);
5.45 +#else
5.46 bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
5.47 {
5.48 int client = IndexOfEdict(pEntity);
5.49 +#endif
5.50 CPlayer *pPlayer = &m_Players[client];
5.51 ++m_PlayersSinceActive;
5.52
5.53 @@ -503,7 +521,7 @@
5.54 m_AuthQueue[++m_AuthQueue[0]] = client;
5.55 }
5.56
5.57 - m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = client;
5.58 + m_UserIdLookUp[GetPlayerUserId(pEntity)] = client;
5.59 }
5.60 else
5.61 {
5.62 @@ -516,9 +534,16 @@
5.63 return true;
5.64 }
5.65
5.66 +#if SOURCE_ENGINE == SE_DOTA
5.67 +bool PlayerManager::OnClientConnect_Post(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
5.68 +{
5.69 + edict_t *pEntity = PEntityOfEntIndex(client);
5.70 +#else
5.71 bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
5.72 {
5.73 int client = IndexOfEdict(pEntity);
5.74 +#endif
5.75 +
5.76 bool orig_value = META_RESULT_ORIG_RET(bool);
5.77 CPlayer *pPlayer = &m_Players[client];
5.78
5.79 @@ -555,10 +580,17 @@
5.80 return true;
5.81 }
5.82
5.83 +#if SOURCE_ENGINE == SE_DOTA
5.84 +void PlayerManager::OnClientPutInServer(int client, const char *playername)
5.85 +{
5.86 + edict_t *pEntity = PEntityOfEntIndex(client);
5.87 +#else
5.88 void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
5.89 {
5.90 + int client = IndexOfEdict(pEntity);
5.91 +#endif
5.92 +
5.93 cell_t res;
5.94 - int client = IndexOfEdict(pEntity);
5.95 CPlayer *pPlayer = &m_Players[client];
5.96
5.97 /* If they're not connected, they're a bot */
5.98 @@ -566,7 +598,12 @@
5.99 {
5.100 /* Run manual connection routines */
5.101 char error[255];
5.102 - const char *authid = engine->GetPlayerNetworkIDString(pEntity);
5.103 + const char *authid;
5.104 +#if SOURCE_ENGINE == SE_DOTA
5.105 + authid = engine->GetPlayerNetworkIDString(client - 1);
5.106 +#else
5.107 + authid = engine->GetPlayerNetworkIDString(pEntity);
5.108 +#endif
5.109 pPlayer->SetAuthString(authid);
5.110 pPlayer->Authorize();
5.111 pPlayer->m_bFakeClient = true;
5.112 @@ -593,7 +630,7 @@
5.113 // This doesn't actually get incremented until OnClientConnect. Fake it to check.
5.114 int newCount = m_PlayersSinceActive + 1;
5.115
5.116 - int userId = engine->GetPlayerUserId(pEntity);
5.117 + int userId = GetPlayerUserId(pEntity);
5.118 #if (SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_LEFT4DEAD2)
5.119 static ConVar *tv_name = icvar->FindVar("tv_name");
5.120 #endif
5.121 @@ -717,10 +754,17 @@
5.122 m_PlayerCount = 0;
5.123 }
5.124
5.125 +#if SOURCE_ENGINE == SE_DOTA
5.126 +void PlayerManager::OnClientDisconnect(int client)
5.127 +{
5.128 + edict_t *pEntity = PEntityOfEntIndex(client);
5.129 +#else
5.130 void PlayerManager::OnClientDisconnect(edict_t *pEntity)
5.131 {
5.132 + int client = IndexOfEdict(pEntity);
5.133 +#endif
5.134 +
5.135 cell_t res;
5.136 - int client = IndexOfEdict(pEntity);
5.137 CPlayer *pPlayer = &m_Players[client];
5.138
5.139 if (pPlayer->IsConnected())
5.140 @@ -755,10 +799,17 @@
5.141 }
5.142 }
5.143
5.144 +#if SOURCE_ENGINE == SE_DOTA
5.145 +void PlayerManager::OnClientDisconnect_Post(int client)
5.146 +{
5.147 + edict_t *pEntity = PEntityOfEntIndex(client);
5.148 +#else
5.149 void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
5.150 {
5.151 + int client = IndexOfEdict(pEntity);
5.152 +#endif
5.153 +
5.154 cell_t res;
5.155 - int client = IndexOfEdict(pEntity);
5.156
5.157 m_cldisconnect_post->PushCell(client);
5.158 m_cldisconnect_post->Execute(&res, NULL);
5.159 @@ -790,7 +841,11 @@
5.160 buffer[len] = '\0';
5.161 }
5.162
5.163 +#if SOURCE_ENGINE == SE_DOTA
5.164 + engine->ClientPrintf(IndexOfEdict(e), buffer);
5.165 +#else
5.166 engine->ClientPrintf(e, buffer);
5.167 +#endif
5.168 }
5.169
5.170 void ListExtensionsToClient(CPlayer *player, const CCommand &args)
5.171 @@ -953,15 +1008,22 @@
5.172 }
5.173 }
5.174
5.175 -#if SOURCE_ENGINE >= SE_ORANGEBOX
5.176 +#if SOURCE_ENGINE == SE_DOTA
5.177 +void PlayerManager::OnClientCommand(int client, const CCommand &args)
5.178 +{
5.179 + edict_t *pEntity = PEntityOfEntIndex(client);
5.180 +#elif SOURCE_ENGINE >= SE_ORANGEBOX
5.181 void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
5.182 {
5.183 + int client = IndexOfEdict(pEntity);
5.184 #else
5.185 void PlayerManager::OnClientCommand(edict_t *pEntity)
5.186 {
5.187 CCommand args;
5.188 +
5.189 + int client = IndexOfEdict(pEntity);
5.190 #endif
5.191 - int client = IndexOfEdict(pEntity);
5.192 +
5.193 cell_t res = Pl_Continue;
5.194 CPlayer *pPlayer = &m_Players[client];
5.195
5.196 @@ -1070,10 +1132,17 @@
5.197 }
5.198 }
5.199
5.200 +#if SOURCE_ENGINE == SE_DOTA
5.201 +void PlayerManager::OnClientSettingsChanged(int client)
5.202 +{
5.203 + edict_t *pEntity = PEntityOfEntIndex(client);
5.204 +#else
5.205 void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
5.206 {
5.207 + int client = IndexOfEdict(pEntity);
5.208 +#endif
5.209 +
5.210 cell_t res;
5.211 - int client = IndexOfEdict(pEntity);
5.212 CPlayer *pPlayer = &m_Players[client];
5.213
5.214 if (!pPlayer->IsConnected())
5.215 @@ -1193,7 +1262,7 @@
5.216 CPlayer *player = GetPlayerByIndex(client);
5.217 if (player && player->IsConnected())
5.218 {
5.219 - int realUserId = engine->GetPlayerUserId(player->GetEdict());
5.220 + int realUserId = GetPlayerUserId(player->GetEdict());
5.221 if (realUserId == userid)
5.222 {
5.223 return client;
5.224 @@ -1210,7 +1279,7 @@
5.225 {
5.226 continue;
5.227 }
5.228 - if (engine->GetPlayerUserId(player->GetEdict()) == userid)
5.229 + if (GetPlayerUserId(player->GetEdict()) == userid)
5.230 {
5.231 m_UserIdLookUp[userid] = i;
5.232 return i;
5.233 @@ -1324,7 +1393,7 @@
5.234 }
5.235 }
5.236
5.237 - m_UserIdLookUp[engine->GetPlayerUserId(pPlayer->m_pEdict)] = 0;
5.238 + m_UserIdLookUp[GetPlayerUserId(pPlayer->m_pEdict)] = 0;
5.239 pPlayer->Disconnect();
5.240 }
5.241
5.242 @@ -1897,7 +1966,13 @@
5.243 m_SteamAccountID = (atoi(&pAuth[8]) | (atoi(&pAuth[10]) << 1));
5.244 }
5.245 #else
5.246 - unsigned long long *steamId = (unsigned long long *)engine->GetClientSteamID(m_pEdict);
5.247 + unsigned long long *steamId;
5.248 +#if SOURCE_ENGINE == SE_DOTA
5.249 + steamId = (unsigned long long *)engine->GetClientSteamID(m_iIndex);
5.250 +#else
5.251 + steamId = (unsigned long long *)engine->GetClientSteamID(m_pEdict);
5.252 +#endif
5.253 +
5.254 if (steamId)
5.255 {
5.256 m_SteamAccountID = (*steamId & 0xFFFFFFFF);
5.257 @@ -1911,6 +1986,11 @@
5.258 return m_pEdict;
5.259 }
5.260
5.261 +int CPlayer::GetIndex() const
5.262 +{
5.263 + return m_iIndex;
5.264 +}
5.265 +
5.266 bool CPlayer::IsInGame()
5.267 {
5.268 return m_IsInGame && (m_pEdict->GetUnknown() != NULL);
5.269 @@ -1936,7 +2016,11 @@
5.270 #if SOURCE_ENGINE >= SE_ORANGEBOX
5.271 if (g_Players.m_bAuthstringValidation && !g_HL2.IsLANServer())
5.272 {
5.273 +#if SOURCE_ENGINE == SE_DOTA
5.274 + return engine->IsClientFullyAuthenticated(m_iIndex);
5.275 +#else
5.276 return engine->IsClientFullyAuthenticated(m_pEdict);
5.277 +#endif
5.278 }
5.279 #endif
5.280
5.281 @@ -2130,7 +2214,7 @@
5.282 {
5.283 if (!g_Players.CheckSetAdminName(client, this, id))
5.284 {
5.285 - int userid = engine->GetPlayerUserId(m_pEdict);
5.286 + int userid = GetPlayerUserId(m_pEdict);
5.287 g_Timers.CreateTimer(&s_KickPlayerTimer, 0.1f, (void *)userid, 0);
5.288 }
5.289 return;
5.290 @@ -2169,7 +2253,7 @@
5.291 {
5.292 if (m_UserId == -1)
5.293 {
5.294 - m_UserId = engine->GetPlayerUserId(GetEdict());
5.295 + m_UserId = GetPlayerUserId(GetEdict());
5.296 }
5.297
5.298 return m_UserId;
6.1 --- a/core/PlayerManager.h Mon May 13 14:19:17 2013 -0400
6.2 +++ b/core/PlayerManager.h Mon May 13 15:18:12 2013 -0400
6.3 @@ -90,6 +90,7 @@
6.4 bool RunAdminCacheChecks();
6.5 void NotifyPostAdminChecks();
6.6 unsigned int GetSerial();
6.7 + int GetIndex() const;
6.8 public:
6.9 void DoBasicAdminChecks();
6.10 void MarkAsBeingKicked();
6.11 @@ -150,6 +151,16 @@
6.12 void ClearAdminId(AdminId id);
6.13 void ClearAllAdmins();
6.14 public:
6.15 +#if SOURCE_ENGINE == SE_DOTA
6.16 + bool OnClientConnect(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
6.17 + bool OnClientConnect_Post(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
6.18 + void OnClientPutInServer(int client, char const *playername);
6.19 + void OnClientDisconnect(int client);
6.20 + void OnClientDisconnect_Post(int client);
6.21 + void OnClientCommand(int client, const CCommand &args);
6.22 + void OnClientSettingsChanged(int client);
6.23 + //void OnClientSettingsChanged_Pre(int client);
6.24 +#else
6.25 bool OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
6.26 bool OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
6.27 void OnClientPutInServer(edict_t *pEntity, char const *playername);
6.28 @@ -162,6 +173,7 @@
6.29 #endif
6.30 void OnClientSettingsChanged(edict_t *pEntity);
6.31 //void OnClientSettingsChanged_Pre(edict_t *pEntity);
6.32 +#endif
6.33 public: //IPlayerManager
6.34 void AddClientListener(IClientListener *listener);
6.35 void RemoveClientListener(IClientListener *listener);
7.1 --- a/core/sm_stringutil.cpp Mon May 13 14:19:17 2013 -0400
7.2 +++ b/core/sm_stringutil.cpp Mon May 13 15:18:12 2013 -0400
7.3 @@ -1130,7 +1130,7 @@
7.4 {
7.5 auth = "STEAM_ID_PENDING";
7.6 }
7.7 - int userid = engine->GetPlayerUserId(player->GetEdict());
7.8 + int userid = GetPlayerUserId(player->GetEdict());
7.9 UTIL_Format(buffer,
7.10 sizeof(buffer),
7.11 "%s<%d><%s><>",
8.1 --- a/core/smn_console.cpp Mon May 13 14:19:17 2013 -0400
8.2 +++ b/core/smn_console.cpp Mon May 13 15:18:12 2013 -0400
8.3 @@ -878,7 +878,11 @@
8.4
8.5 if (index != 0)
8.6 {
8.7 +#if SOURCE_ENGINE == SE_DOTA
8.8 + engine->ClientPrintf(pPlayer->GetIndex(), buffer);
8.9 +#else
8.10 engine->ClientPrintf(pPlayer->GetEdict(), buffer);
8.11 +#endif
8.12 } else {
8.13 META_CONPRINT(buffer);
8.14 }
8.15 @@ -1077,7 +1081,13 @@
8.16 return 0;
8.17 }
8.18
8.19 - engine->ClientCommand(pPlayer->GetEdict(), "%s", buffer);
8.20 + engine->ClientCommand(
8.21 +#if SOURCE_ENGINE == SE_DOTA
8.22 + pPlayer->GetIndex(),
8.23 +#else
8.24 + pPlayer->GetEdict(),
8.25 +#endif
8.26 + "%s", buffer);
8.27
8.28 return 1;
8.29 }
8.30 @@ -1105,7 +1115,7 @@
8.31 }
8.32
8.33 #if SOURCE_ENGINE == SE_DOTA
8.34 - engine->ClientCommand(pPlayer->GetEdict(), "%s", buffer);
8.35 + engine->ClientCommand(pPlayer->GetIndex(), "%s", buffer);
8.36 #else
8.37 serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
8.38 #endif
8.39 @@ -1135,7 +1145,7 @@
8.40 return 0;
8.41 }
8.42
8.43 - g_HL2.AddToFakeCliCmdQueue(params[1], engine->GetPlayerUserId(pPlayer->GetEdict()), buffer);
8.44 + g_HL2.AddToFakeCliCmdQueue(params[1], GetPlayerUserId(pPlayer->GetEdict()), buffer);
8.45
8.46 return 1;
8.47 }
8.48 @@ -1182,7 +1192,11 @@
8.49 {
8.50 buffer[len++] = '\n';
8.51 buffer[len] = '\0';
8.52 +#if SOURCE_ENGINE == SE_DOTA
8.53 + engine->ClientPrintf(pPlayer->GetIndex(), buffer);
8.54 +#else
8.55 engine->ClientPrintf(pPlayer->GetEdict(), buffer);
8.56 +#endif
8.57 } else if (replyto == SM_REPLY_CHAT) {
8.58 if (len >= 191)
8.59 {
9.1 --- a/core/smn_halflife.cpp Mon May 13 14:19:17 2013 -0400
9.2 +++ b/core/smn_halflife.cpp Mon May 13 15:18:12 2013 -0400
9.3 @@ -102,6 +102,17 @@
9.4
9.5 pContext->LocalToString(params[1], &netname);
9.6
9.7 +#if SOURCE_ENGINE == SE_DOTA
9.8 + int index;
9.9 + engine->CreateFakeClient(&index, netname);
9.10 +
9.11 + if (index == -1)
9.12 + {
9.13 + return 0;
9.14 + }
9.15 +
9.16 + return index;
9.17 +#else
9.18 edict_t *pEdict = engine->CreateFakeClient(netname);
9.19
9.20 /* :TODO: does the engine fire forwards for us and whatnot? no idea... */
9.21 @@ -112,6 +123,7 @@
9.22 }
9.23
9.24 return IndexOfEdict(pEdict);
9.25 +#endif
9.26 }
9.27
9.28 static cell_t SetFakeClientConVar(IPluginContext *pContext, const cell_t *params)
9.29 @@ -138,7 +150,11 @@
9.30 pContext->LocalToString(params[2], &cvar);
9.31 pContext->LocalToString(params[3], &value);
9.32
9.33 +#if SOURCE_ENGINE == SE_DOTA
9.34 + engine->SetFakeClientConVarValue(pPlayer->GetIndex(), cvar, value);
9.35 +#else
9.36 engine->SetFakeClientConVarValue(pPlayer->GetEdict(), cvar, value);
9.37 +#endif
9.38
9.39 return 1;
9.40 }
10.1 --- a/core/smn_player.cpp Mon May 13 14:19:17 2013 -0400
10.2 +++ b/core/smn_player.cpp Mon May 13 15:18:12 2013 -0400
10.3 @@ -479,7 +479,7 @@
10.4 return pContext->ThrowNativeError("Client %d is not connected", client);
10.5 }
10.6
10.7 - return engine->GetPlayerUserId(pPlayer->GetEdict());
10.8 + return GetPlayerUserId(pPlayer->GetEdict());
10.9 }
10.10
10.11 static cell_t CanUserTarget(IPluginContext *pContext, const cell_t *params)
10.12 @@ -1118,7 +1118,11 @@
10.13 }
10.14
10.15 UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
10.16 +#if SOURCE_ENGINE == SE_DOTA
10.17 + engine->ClientPrintf(pPlayer->GetIndex(), message);
10.18 +#else
10.19 engine->ClientPrintf(pPlayer->GetEdict(), message);
10.20 +#endif
10.21 display_in_chat = true;
10.22 }
10.23 }
11.1 --- a/extensions/sdktools/extension.h Mon May 13 14:19:17 2013 -0400
11.2 +++ b/extensions/sdktools/extension.h Mon May 13 15:18:12 2013 -0400
11.3 @@ -93,7 +93,9 @@
11.4 public: // IVoiceServer
11.5 bool OnSetClientListening(int iReceiver, int iSender, bool bListen);
11.6 void VoiceInit();
11.7 -#if SOURCE_ENGINE >= SE_ORANGEBOX
11.8 +#if SOURCE_ENGINE == SE_DOTA
11.9 + void OnClientCommand(int client, const CCommand &args);
11.10 +#elif SOURCE_ENGINE >= SE_ORANGEBOX
11.11 void OnClientCommand(edict_t *pEntity, const CCommand &args);
11.12 #else
11.13 void OnClientCommand(edict_t *pEntity);
12.1 --- a/extensions/sdktools/vhelpers.cpp Mon May 13 14:19:17 2013 -0400
12.2 +++ b/extensions/sdktools/vhelpers.cpp Mon May 13 15:18:12 2013 -0400
12.3 @@ -217,7 +217,12 @@
12.4 QAngle eye_angles;
12.5
12.6 /* Get the private information we need */
12.7 +#if SOURCE_ENGINE == SE_DOTA
12.8 + serverClients->ClientEarPosition(IndexOfEdict(pEdict), &eye_position);
12.9 +#else
12.10 serverClients->ClientEarPosition(pEdict, &eye_position);
12.11 +#endif
12.12 +
12.13 if (!GetEyeAngles(pEntity, &eye_angles))
12.14 {
12.15 return -2;
13.1 --- a/extensions/sdktools/vnatives.cpp Mon May 13 14:19:17 2013 -0400
13.2 +++ b/extensions/sdktools/vnatives.cpp Mon May 13 15:18:12 2013 -0400
13.3 @@ -373,7 +373,11 @@
13.4 return pContext->ThrowNativeError("Entity %d is not valid", params[2]);
13.5 }
13.6
13.7 +#if SOURCE_ENGINE == SE_DOTA
13.8 + engine->SetView(params[1], params[2]);
13.9 +#else
13.10 engine->SetView(player->GetEdict(), pEdict);
13.11 +#endif
13.12
13.13 return 1;
13.14 }
13.15 @@ -566,7 +570,7 @@
13.16 if (should_slay)
13.17 {
13.18 #if SOURCE_ENGINE == SE_DOTA
13.19 - engine->ClientCommand(pEdict, "kill\n");
13.20 + engine->ClientCommand(params[1], "kill\n");
13.21 #else
13.22 pluginhelpers->ClientCommand(pEdict, "kill\n");
13.23 #endif
13.24 @@ -593,7 +597,11 @@
13.25 }
13.26
13.27 Vector pos;
13.28 +#if SOURCE_ENGINE == SE_DOTA
13.29 + serverClients->ClientEarPosition(params[1], &pos);
13.30 +#else
13.31 serverClients->ClientEarPosition(player->GetEdict(), &pos);
13.32 +#endif
13.33
13.34 cell_t *addr;
13.35 pContext->LocalToPhysAddr(params[2], &addr);
14.1 --- a/extensions/sdktools/voice.cpp Mon May 13 14:19:17 2013 -0400
14.2 +++ b/extensions/sdktools/voice.cpp Mon May 13 15:18:12 2013 -0400
14.3 @@ -58,7 +58,9 @@
14.4
14.5 SH_DECL_HOOK3(IVoiceServer, SetClientListening, SH_NOATTRIB, 0, bool, int, int, bool);
14.6
14.7 -#if SOURCE_ENGINE >= SE_ORANGEBOX
14.8 +#if SOURCE_ENGINE == SE_DOTA
14.9 +SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, int, const CCommand &);
14.10 +#elif SOURCE_ENGINE >= SE_ORANGEBOX
14.11 SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
14.12 #else
14.13 SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
14.14 @@ -91,15 +93,19 @@
14.15 SH_ADD_HOOK(IServerGameClients, ClientCommand, serverClients, SH_MEMBER(this, &SDKTools::OnClientCommand), true);
14.16 }
14.17
14.18 -#if SOURCE_ENGINE >= SE_ORANGEBOX
14.19 +#if SOURCE_ENGINE == SE_DOTA
14.20 +void SDKTools::OnClientCommand(int client, const CCommand &args)
14.21 +{
14.22 +#elif SOURCE_ENGINE >= SE_ORANGEBOX
14.23 void SDKTools::OnClientCommand(edict_t *pEntity, const CCommand &args)
14.24 {
14.25 + int client = IndexOfEdict(pEntity);
14.26 #else
14.27 void SDKTools::OnClientCommand(edict_t *pEntity)
14.28 {
14.29 CCommand args;
14.30 + int client = IndexOfEdict(pEntity);
14.31 #endif
14.32 - int client = IndexOfEdict(pEntity);
14.33
14.34 if ((args.ArgC() > 1) && (stricmp(args.Arg(0), "vban") == 0))
14.35 {
15.1 --- a/extensions/sdktools/vsound.cpp Mon May 13 14:19:17 2013 -0400
15.2 +++ b/extensions/sdktools/vsound.cpp Mon May 13 15:18:12 2013 -0400
15.3 @@ -521,7 +521,12 @@
15.4 return pContext->ThrowNativeError("Client index %d is not in game", client);
15.5 }
15.6
15.7 - engine->FadeClientVolume(player->GetEdict(),
15.8 + engine->FadeClientVolume(
15.9 +#if SOURCE_ENGINE == SE_DOTA
15.10 + player->GetIndex(),
15.11 +#else
15.12 + player->GetEdict(),
15.13 +#endif
15.14 sp_ctof(params[2]),
15.15 sp_ctof(params[3]),
15.16 sp_ctof(params[4]),
16.1 --- a/public/IPlayerHelpers.h Mon May 13 14:19:17 2013 -0400
16.2 +++ b/public/IPlayerHelpers.h Mon May 13 15:18:12 2013 -0400
16.3 @@ -41,7 +41,7 @@
16.4 #include <IAdminSystem.h>
16.5
16.6 #define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager"
16.7 -#define SMINTERFACE_PLAYERMANAGER_VERSION 17
16.8 +#define SMINTERFACE_PLAYERMANAGER_VERSION 18
16.9
16.10 struct edict_t;
16.11 class IPlayerInfo;
16.12 @@ -246,6 +246,13 @@
16.13 * @return Steam account ID or 0 if not available.
16.14 */
16.15 virtual unsigned int GetSteamAccountID(bool validated = true) =0;
16.16 +
16.17 + /**
16.18 + * @brief Returns the client's edict/entity index.
16.19 + *
16.20 + * @return Client's index.
16.21 + */
16.22 + virtual int GetIndex() const =0;
16.23 };
16.24
16.25 /**
17.1 --- a/public/compat_wrappers.h Mon May 13 14:19:17 2013 -0400
17.2 +++ b/public/compat_wrappers.h Mon May 13 15:18:12 2013 -0400
17.3 @@ -154,4 +154,26 @@
17.4 }
17.5 #endif //SOURCE_ENGINE >= SE_LEFT4DEAD
17.6
17.7 +#if SOURCE_ENGINE == SE_DOTA
17.8 + inline int GetPlayerUserId(edict_t *pEdict)
17.9 + {
17.10 + return engine->GetPlayerUserId(IndexOfEdict(pEdict) - 1);
17.11 + }
17.12 +
17.13 + inline int GetPlayerUserId(int client)
17.14 + {
17.15 + engine->GetPlayerUserId(client - 1);
17.16 + }
17.17 +#else
17.18 + inline int GetPlayerUserId(edict_t *pEdict)
17.19 + {
17.20 + return engine->GetPlayerUserId(pEdict);
17.21 + }
17.22 +
17.23 + inline int GetPlayerUserId(int client)
17.24 + {
17.25 + return engine->GetPlayerUserId(PEntityOfEntIndex(client));
17.26 + }
17.27 +#endif //SOURCE_ENGINE >= SE_DOTA
17.28 +
17.29 #endif //_INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_