Updated for latest hl2sdk-dota changes.
This commit is contained in:
parent
e8dc1480eb
commit
614967ccc1
@ -286,7 +286,7 @@ void ChatTriggers::OnSayCommand_Post()
|
||||
int client = g_ConCmds.GetCommandClient();
|
||||
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientCommand(PEntityOfEntIndex(client), "%s", m_ToExecute);
|
||||
engine->ClientCommand(client, "%s", m_ToExecute);
|
||||
#else
|
||||
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
|
||||
#endif
|
||||
|
@ -539,7 +539,9 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
|
||||
return true;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE != SE_DOTA
|
||||
edict_t *pEdict = PEntityOfEntIndex(client);
|
||||
#endif
|
||||
|
||||
/* If we got here, the command failed... */
|
||||
char buffer[128];
|
||||
@ -553,7 +555,11 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
|
||||
{
|
||||
char fullbuffer[192];
|
||||
UTIL_Format(fullbuffer, sizeof(fullbuffer), "[SM] %s.\n", buffer);
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientPrintf(client, fullbuffer);
|
||||
#else
|
||||
engine->ClientPrintf(pEdict, fullbuffer);
|
||||
#endif
|
||||
}
|
||||
else if (replyto == SM_REPLY_CHAT)
|
||||
{
|
||||
|
@ -611,7 +611,11 @@ QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char
|
||||
/* Call StartQueryCvarValue() in either the IVEngineServer or IServerPluginHelpers depending on situation */
|
||||
if (m_bIsDLLQueryHooked)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
cookie = engine->StartQueryCvarValue(IndexOfEdict(pPlayer), name);
|
||||
#else
|
||||
cookie = engine->StartQueryCvarValue(pPlayer, name);
|
||||
#endif
|
||||
}
|
||||
#if SOURCE_ENGINE != SE_DOTA
|
||||
else if (m_bIsVSPQueryHooked)
|
||||
|
@ -300,7 +300,11 @@ bool CHalfLife2::IsOriginalEngine()
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
return engine->GetChangeAccessor( IndexOfEdict((const edict_t *)this) );
|
||||
#else
|
||||
return engine->GetChangeAccessor( (const edict_t *)this );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -792,7 +796,7 @@ void CHalfLife2::ProcessFakeCliCmdQueue()
|
||||
{
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(pFake->client);
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientCommand(pPlayer->GetEdict(), "%s", pFake->cmd.c_str());
|
||||
engine->ClientCommand(pPlayer->GetIndex(), "%s", pFake->cmd.c_str());
|
||||
#else
|
||||
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), pFake->cmd.c_str());
|
||||
#endif
|
||||
|
@ -58,6 +58,13 @@ const unsigned int *g_NumPlayersToAuth = NULL;
|
||||
int lifestate_offset = -1;
|
||||
List<ICommandTargetProcessor *> target_processors;
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, int, const char *, const char *, char *, int);
|
||||
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, int, const char *);
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, int);
|
||||
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, int, const CCommand &);
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, int);
|
||||
#else
|
||||
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char *, const char *, char *, int);
|
||||
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, const char *);
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, edict_t *);
|
||||
@ -67,6 +74,7 @@ SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *,
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
|
||||
#endif
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
|
||||
#endif // SE_DOTA
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
SH_DECL_HOOK0_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0);
|
||||
@ -380,7 +388,11 @@ void PlayerManager::RunAuthChecks()
|
||||
for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
|
||||
{
|
||||
pPlayer = &m_Players[m_AuthQueue[i]];
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_iIndex - 1);
|
||||
#else
|
||||
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
|
||||
#endif
|
||||
pPlayer->SetAuthString(authstr);
|
||||
|
||||
if (!pPlayer->IsAuthStringValidated())
|
||||
@ -457,9 +469,15 @@ void PlayerManager::RunAuthChecks()
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
bool PlayerManager::OnClientConnect(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||
{
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
++m_PlayersSinceActive;
|
||||
|
||||
@ -503,7 +521,7 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
m_AuthQueue[++m_AuthQueue[0]] = client;
|
||||
}
|
||||
|
||||
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = client;
|
||||
m_UserIdLookUp[GetPlayerUserId(pEntity)] = client;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -516,9 +534,16 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
return true;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
bool PlayerManager::OnClientConnect_Post(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||
{
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
bool orig_value = META_RESULT_ORIG_RET(bool);
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
@ -555,10 +580,17 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
|
||||
return true;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientPutInServer(int client, const char *playername)
|
||||
{
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
|
||||
{
|
||||
cell_t res;
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
cell_t res;
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
/* If they're not connected, they're a bot */
|
||||
@ -566,7 +598,12 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
{
|
||||
/* Run manual connection routines */
|
||||
char error[255];
|
||||
const char *authid = engine->GetPlayerNetworkIDString(pEntity);
|
||||
const char *authid;
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
authid = engine->GetPlayerNetworkIDString(client - 1);
|
||||
#else
|
||||
authid = engine->GetPlayerNetworkIDString(pEntity);
|
||||
#endif
|
||||
pPlayer->SetAuthString(authid);
|
||||
pPlayer->Authorize();
|
||||
pPlayer->m_bFakeClient = true;
|
||||
@ -593,7 +630,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
// This doesn't actually get incremented until OnClientConnect. Fake it to check.
|
||||
int newCount = m_PlayersSinceActive + 1;
|
||||
|
||||
int userId = engine->GetPlayerUserId(pEntity);
|
||||
int userId = GetPlayerUserId(pEntity);
|
||||
#if (SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
static ConVar *tv_name = icvar->FindVar("tv_name");
|
||||
#endif
|
||||
@ -717,10 +754,17 @@ void PlayerManager::OnSourceModLevelEnd()
|
||||
m_PlayerCount = 0;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientDisconnect(int client)
|
||||
{
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
||||
{
|
||||
cell_t res;
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
cell_t res;
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
if (pPlayer->IsConnected())
|
||||
@ -755,10 +799,17 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientDisconnect_Post(int client)
|
||||
{
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
||||
{
|
||||
cell_t res;
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
cell_t res;
|
||||
|
||||
m_cldisconnect_post->PushCell(client);
|
||||
m_cldisconnect_post->Execute(&res, NULL);
|
||||
@ -790,7 +841,11 @@ void ClientConsolePrint(edict_t *e, const char *fmt, ...)
|
||||
buffer[len] = '\0';
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientPrintf(IndexOfEdict(e), buffer);
|
||||
#else
|
||||
engine->ClientPrintf(e, buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ListExtensionsToClient(CPlayer *player, const CCommand &args)
|
||||
@ -953,15 +1008,22 @@ void ListPluginsToClient(CPlayer *player, const CCommand &args)
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientCommand(int client, const CCommand &args)
|
||||
{
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#else
|
||||
void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
{
|
||||
CCommand args;
|
||||
#endif
|
||||
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
cell_t res = Pl_Continue;
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
@ -1070,10 +1132,17 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientSettingsChanged(int client)
|
||||
{
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
||||
{
|
||||
cell_t res;
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
cell_t res;
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
if (!pPlayer->IsConnected())
|
||||
@ -1193,7 +1262,7 @@ int PlayerManager::GetClientOfUserId(int userid)
|
||||
CPlayer *player = GetPlayerByIndex(client);
|
||||
if (player && player->IsConnected())
|
||||
{
|
||||
int realUserId = engine->GetPlayerUserId(player->GetEdict());
|
||||
int realUserId = GetPlayerUserId(player->GetEdict());
|
||||
if (realUserId == userid)
|
||||
{
|
||||
return client;
|
||||
@ -1210,7 +1279,7 @@ int PlayerManager::GetClientOfUserId(int userid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (engine->GetPlayerUserId(player->GetEdict()) == userid)
|
||||
if (GetPlayerUserId(player->GetEdict()) == userid)
|
||||
{
|
||||
m_UserIdLookUp[userid] = i;
|
||||
return i;
|
||||
@ -1324,7 +1393,7 @@ void PlayerManager::InvalidatePlayer(CPlayer *pPlayer)
|
||||
}
|
||||
}
|
||||
|
||||
m_UserIdLookUp[engine->GetPlayerUserId(pPlayer->m_pEdict)] = 0;
|
||||
m_UserIdLookUp[GetPlayerUserId(pPlayer->m_pEdict)] = 0;
|
||||
pPlayer->Disconnect();
|
||||
}
|
||||
|
||||
@ -1897,7 +1966,13 @@ unsigned int CPlayer::GetSteamAccountID(bool validated)
|
||||
m_SteamAccountID = (atoi(&pAuth[8]) | (atoi(&pAuth[10]) << 1));
|
||||
}
|
||||
#else
|
||||
unsigned long long *steamId = (unsigned long long *)engine->GetClientSteamID(m_pEdict);
|
||||
unsigned long long *steamId;
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
steamId = (unsigned long long *)engine->GetClientSteamID(m_iIndex);
|
||||
#else
|
||||
steamId = (unsigned long long *)engine->GetClientSteamID(m_pEdict);
|
||||
#endif
|
||||
|
||||
if (steamId)
|
||||
{
|
||||
m_SteamAccountID = (*steamId & 0xFFFFFFFF);
|
||||
@ -1911,6 +1986,11 @@ edict_t *CPlayer::GetEdict()
|
||||
return m_pEdict;
|
||||
}
|
||||
|
||||
int CPlayer::GetIndex() const
|
||||
{
|
||||
return m_iIndex;
|
||||
}
|
||||
|
||||
bool CPlayer::IsInGame()
|
||||
{
|
||||
return m_IsInGame && (m_pEdict->GetUnknown() != NULL);
|
||||
@ -1936,7 +2016,11 @@ bool CPlayer::IsAuthStringValidated()
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
if (g_Players.m_bAuthstringValidation && !g_HL2.IsLANServer())
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
return engine->IsClientFullyAuthenticated(m_iIndex);
|
||||
#else
|
||||
return engine->IsClientFullyAuthenticated(m_pEdict);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2130,7 +2214,7 @@ void CPlayer::DoBasicAdminChecks()
|
||||
{
|
||||
if (!g_Players.CheckSetAdminName(client, this, id))
|
||||
{
|
||||
int userid = engine->GetPlayerUserId(m_pEdict);
|
||||
int userid = GetPlayerUserId(m_pEdict);
|
||||
g_Timers.CreateTimer(&s_KickPlayerTimer, 0.1f, (void *)userid, 0);
|
||||
}
|
||||
return;
|
||||
@ -2169,7 +2253,7 @@ int CPlayer::GetUserId()
|
||||
{
|
||||
if (m_UserId == -1)
|
||||
{
|
||||
m_UserId = engine->GetPlayerUserId(GetEdict());
|
||||
m_UserId = GetPlayerUserId(GetEdict());
|
||||
}
|
||||
|
||||
return m_UserId;
|
||||
|
@ -90,6 +90,7 @@ public:
|
||||
bool RunAdminCacheChecks();
|
||||
void NotifyPostAdminChecks();
|
||||
unsigned int GetSerial();
|
||||
int GetIndex() const;
|
||||
public:
|
||||
void DoBasicAdminChecks();
|
||||
void MarkAsBeingKicked();
|
||||
@ -150,6 +151,16 @@ public:
|
||||
void ClearAdminId(AdminId id);
|
||||
void ClearAllAdmins();
|
||||
public:
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
bool OnClientConnect(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
|
||||
bool OnClientConnect_Post(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
|
||||
void OnClientPutInServer(int client, char const *playername);
|
||||
void OnClientDisconnect(int client);
|
||||
void OnClientDisconnect_Post(int client);
|
||||
void OnClientCommand(int client, const CCommand &args);
|
||||
void OnClientSettingsChanged(int client);
|
||||
//void OnClientSettingsChanged_Pre(int client);
|
||||
#else
|
||||
bool OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
|
||||
bool OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
|
||||
void OnClientPutInServer(edict_t *pEntity, char const *playername);
|
||||
@ -162,6 +173,7 @@ public:
|
||||
#endif
|
||||
void OnClientSettingsChanged(edict_t *pEntity);
|
||||
//void OnClientSettingsChanged_Pre(edict_t *pEntity);
|
||||
#endif
|
||||
public: //IPlayerManager
|
||||
void AddClientListener(IClientListener *listener);
|
||||
void RemoveClientListener(IClientListener *listener);
|
||||
|
@ -1130,7 +1130,7 @@ reswitch:
|
||||
{
|
||||
auth = "STEAM_ID_PENDING";
|
||||
}
|
||||
int userid = engine->GetPlayerUserId(player->GetEdict());
|
||||
int userid = GetPlayerUserId(player->GetEdict());
|
||||
UTIL_Format(buffer,
|
||||
sizeof(buffer),
|
||||
"%s<%d><%s><>",
|
||||
|
@ -878,7 +878,11 @@ static cell_t sm_PrintToConsole(IPluginContext *pCtx, const cell_t *params)
|
||||
|
||||
if (index != 0)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientPrintf(pPlayer->GetIndex(), buffer);
|
||||
#else
|
||||
engine->ClientPrintf(pPlayer->GetEdict(), buffer);
|
||||
#endif
|
||||
} else {
|
||||
META_CONPRINT(buffer);
|
||||
}
|
||||
@ -1077,7 +1081,13 @@ static cell_t sm_ClientCommand(IPluginContext *pContext, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
engine->ClientCommand(pPlayer->GetEdict(), "%s", buffer);
|
||||
engine->ClientCommand(
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
pPlayer->GetIndex(),
|
||||
#else
|
||||
pPlayer->GetEdict(),
|
||||
#endif
|
||||
"%s", buffer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1105,7 +1115,7 @@ static cell_t FakeClientCommand(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientCommand(pPlayer->GetEdict(), "%s", buffer);
|
||||
engine->ClientCommand(pPlayer->GetIndex(), "%s", buffer);
|
||||
#else
|
||||
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
|
||||
#endif
|
||||
@ -1135,7 +1145,7 @@ static cell_t FakeClientCommandEx(IPluginContext *pContext, const cell_t *params
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_HL2.AddToFakeCliCmdQueue(params[1], engine->GetPlayerUserId(pPlayer->GetEdict()), buffer);
|
||||
g_HL2.AddToFakeCliCmdQueue(params[1], GetPlayerUserId(pPlayer->GetEdict()), buffer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1182,7 +1192,11 @@ static cell_t ReplyToCommand(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
buffer[len++] = '\n';
|
||||
buffer[len] = '\0';
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientPrintf(pPlayer->GetIndex(), buffer);
|
||||
#else
|
||||
engine->ClientPrintf(pPlayer->GetEdict(), buffer);
|
||||
#endif
|
||||
} else if (replyto == SM_REPLY_CHAT) {
|
||||
if (len >= 191)
|
||||
{
|
||||
|
@ -102,6 +102,17 @@ static cell_t CreateFakeClient(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
pContext->LocalToString(params[1], &netname);
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
int index;
|
||||
engine->CreateFakeClient(&index, netname);
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return index;
|
||||
#else
|
||||
edict_t *pEdict = engine->CreateFakeClient(netname);
|
||||
|
||||
/* :TODO: does the engine fire forwards for us and whatnot? no idea... */
|
||||
@ -112,6 +123,7 @@ static cell_t CreateFakeClient(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
return IndexOfEdict(pEdict);
|
||||
#endif
|
||||
}
|
||||
|
||||
static cell_t SetFakeClientConVar(IPluginContext *pContext, const cell_t *params)
|
||||
@ -138,7 +150,11 @@ static cell_t SetFakeClientConVar(IPluginContext *pContext, const cell_t *params
|
||||
pContext->LocalToString(params[2], &cvar);
|
||||
pContext->LocalToString(params[3], &value);
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->SetFakeClientConVarValue(pPlayer->GetIndex(), cvar, value);
|
||||
#else
|
||||
engine->SetFakeClientConVarValue(pPlayer->GetEdict(), cvar, value);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ static cell_t GetClientUserId(IPluginContext *pContext, const cell_t *params)
|
||||
return pContext->ThrowNativeError("Client %d is not connected", client);
|
||||
}
|
||||
|
||||
return engine->GetPlayerUserId(pPlayer->GetEdict());
|
||||
return GetPlayerUserId(pPlayer->GetEdict());
|
||||
}
|
||||
|
||||
static cell_t CanUserTarget(IPluginContext *pContext, const cell_t *params)
|
||||
@ -1118,7 +1118,11 @@ static cell_t _ShowActivity(IPluginContext *pContext,
|
||||
}
|
||||
|
||||
UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientPrintf(pPlayer->GetIndex(), message);
|
||||
#else
|
||||
engine->ClientPrintf(pPlayer->GetEdict(), message);
|
||||
#endif
|
||||
display_in_chat = true;
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,9 @@ public: //IClientListner
|
||||
public: // IVoiceServer
|
||||
bool OnSetClientListening(int iReceiver, int iSender, bool bListen);
|
||||
void VoiceInit();
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void OnClientCommand(int client, const CCommand &args);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void OnClientCommand(edict_t *pEntity, const CCommand &args);
|
||||
#else
|
||||
void OnClientCommand(edict_t *pEntity);
|
||||
|
@ -217,7 +217,12 @@ int GetClientAimTarget(edict_t *pEdict, bool only_players)
|
||||
QAngle eye_angles;
|
||||
|
||||
/* Get the private information we need */
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
serverClients->ClientEarPosition(IndexOfEdict(pEdict), &eye_position);
|
||||
#else
|
||||
serverClients->ClientEarPosition(pEdict, &eye_position);
|
||||
#endif
|
||||
|
||||
if (!GetEyeAngles(pEntity, &eye_angles))
|
||||
{
|
||||
return -2;
|
||||
|
@ -373,7 +373,11 @@ static cell_t SetClientViewEntity(IPluginContext *pContext, const cell_t *params
|
||||
return pContext->ThrowNativeError("Entity %d is not valid", params[2]);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->SetView(params[1], params[2]);
|
||||
#else
|
||||
engine->SetView(player->GetEdict(), pEdict);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -566,7 +570,7 @@ static cell_t SlapPlayer(IPluginContext *pContext, const cell_t *params)
|
||||
if (should_slay)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientCommand(pEdict, "kill\n");
|
||||
engine->ClientCommand(params[1], "kill\n");
|
||||
#else
|
||||
pluginhelpers->ClientCommand(pEdict, "kill\n");
|
||||
#endif
|
||||
@ -593,7 +597,11 @@ static cell_t GetClientEyePosition(IPluginContext *pContext, const cell_t *param
|
||||
}
|
||||
|
||||
Vector pos;
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
serverClients->ClientEarPosition(params[1], &pos);
|
||||
#else
|
||||
serverClients->ClientEarPosition(player->GetEdict(), &pos);
|
||||
#endif
|
||||
|
||||
cell_t *addr;
|
||||
pContext->LocalToPhysAddr(params[2], &addr);
|
||||
|
@ -58,7 +58,9 @@ bool g_ClientMutes[65][65];
|
||||
|
||||
SH_DECL_HOOK3(IVoiceServer, SetClientListening, SH_NOATTRIB, 0, bool, int, int, bool);
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, int, const CCommand &);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
|
||||
#else
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
|
||||
@ -91,15 +93,19 @@ void SDKTools::VoiceInit()
|
||||
SH_ADD_HOOK(IServerGameClients, ClientCommand, serverClients, SH_MEMBER(this, &SDKTools::OnClientCommand), true);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void SDKTools::OnClientCommand(int client, const CCommand &args)
|
||||
{
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void SDKTools::OnClientCommand(edict_t *pEntity, const CCommand &args)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#else
|
||||
void SDKTools::OnClientCommand(edict_t *pEntity)
|
||||
{
|
||||
CCommand args;
|
||||
#endif
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
if ((args.ArgC() > 1) && (stricmp(args.Arg(0), "vban") == 0))
|
||||
{
|
||||
|
@ -521,7 +521,12 @@ static cell_t FadeClientVolume(IPluginContext *pContext, const cell_t *params)
|
||||
return pContext->ThrowNativeError("Client index %d is not in game", client);
|
||||
}
|
||||
|
||||
engine->FadeClientVolume(player->GetEdict(),
|
||||
engine->FadeClientVolume(
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
player->GetIndex(),
|
||||
#else
|
||||
player->GetEdict(),
|
||||
#endif
|
||||
sp_ctof(params[2]),
|
||||
sp_ctof(params[3]),
|
||||
sp_ctof(params[4]),
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <IAdminSystem.h>
|
||||
|
||||
#define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager"
|
||||
#define SMINTERFACE_PLAYERMANAGER_VERSION 17
|
||||
#define SMINTERFACE_PLAYERMANAGER_VERSION 18
|
||||
|
||||
struct edict_t;
|
||||
class IPlayerInfo;
|
||||
@ -246,6 +246,13 @@ namespace SourceMod
|
||||
* @return Steam account ID or 0 if not available.
|
||||
*/
|
||||
virtual unsigned int GetSteamAccountID(bool validated = true) =0;
|
||||
|
||||
/**
|
||||
* @brief Returns the client's edict/entity index.
|
||||
*
|
||||
* @return Client's index.
|
||||
*/
|
||||
virtual int GetIndex() const =0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -154,4 +154,26 @@
|
||||
}
|
||||
#endif //SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
inline int GetPlayerUserId(edict_t *pEdict)
|
||||
{
|
||||
return engine->GetPlayerUserId(IndexOfEdict(pEdict) - 1);
|
||||
}
|
||||
|
||||
inline int GetPlayerUserId(int client)
|
||||
{
|
||||
engine->GetPlayerUserId(client - 1);
|
||||
}
|
||||
#else
|
||||
inline int GetPlayerUserId(edict_t *pEdict)
|
||||
{
|
||||
return engine->GetPlayerUserId(pEdict);
|
||||
}
|
||||
|
||||
inline int GetPlayerUserId(int client)
|
||||
{
|
||||
return engine->GetPlayerUserId(PEntityOfEntIndex(client));
|
||||
}
|
||||
#endif //SOURCE_ENGINE >= SE_DOTA
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_
|
||||
|
Loading…
Reference in New Issue
Block a user