Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01989d3851 |
@@ -36,11 +36,7 @@
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
SH_DECL_HOOK2_void(ICvar, RegisterConCommand, SH_NOATTRIB, 0, ConCommandBase *, bool);
|
||||
#else
|
||||
SH_DECL_HOOK1_void(ICvar, RegisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
|
||||
#endif
|
||||
#else
|
||||
SH_DECL_HOOK1_void(ICvar, RegisterConCommandBase, SH_NOATTRIB, 0, ConCommandBase *);
|
||||
#endif
|
||||
@@ -82,11 +78,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
void LinkConCommandBase(ConCommandBase *pBase, bool unknown)
|
||||
#else
|
||||
void LinkConCommandBase(ConCommandBase *pBase)
|
||||
#endif
|
||||
{
|
||||
IConCommandLinkListener *listener = IConCommandLinkListener::head;
|
||||
while (listener)
|
||||
|
||||
@@ -356,6 +356,27 @@ static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
|
||||
return sp_ftoc(value);
|
||||
}
|
||||
|
||||
static cell_t sm_GetClientIClient(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
int client = params[1];
|
||||
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
if (!pPlayer)
|
||||
{
|
||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||
}
|
||||
else if (!pPlayer->IsConnected())
|
||||
{
|
||||
return pContext->ThrowNativeError("Client %d is not connected", client);
|
||||
}
|
||||
else if (pPlayer->IsFakeClient())
|
||||
{
|
||||
return pContext->ThrowNativeError("Client %d is a bot", client);
|
||||
}
|
||||
|
||||
return (cell_t)pPlayer->GetIClient();
|
||||
}
|
||||
|
||||
static cell_t RunAdminCacheChecks(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
int client = params[1];
|
||||
@@ -392,6 +413,7 @@ REGISTER_NATIVES(playernatives)
|
||||
{"GetClientAvgChoke", GetAvgChoke},
|
||||
{"GetClientAvgData", GetAvgData},
|
||||
{"GetClientAvgPackets", GetAvgPackets},
|
||||
{"GetClientIClient", sm_GetClientIClient },
|
||||
{"RunAdminCacheChecks", RunAdminCacheChecks},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -51,7 +51,6 @@ IGameConfig *g_pGameConf = NULL;
|
||||
IGameEventManager2 *gameevents = NULL;
|
||||
bool hooked_everything = false;
|
||||
int g_msgHintText = -1;
|
||||
CGlobalVars *gpGlobals;
|
||||
|
||||
SMEXT_LINK(&g_CStrike);
|
||||
|
||||
@@ -108,7 +107,6 @@ bool CStrike::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool
|
||||
{
|
||||
GET_V_IFACE_CURRENT(GetEngineFactory, gameevents, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2);
|
||||
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||
gpGlobals = ismm->GetCGlobals();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,6 @@ private:
|
||||
extern IBinTools *g_pBinTools;
|
||||
extern IGameConfig *g_pGameConf;
|
||||
extern ISDKTools *g_pSDKTools;
|
||||
extern CGlobalVars *gpGlobals;
|
||||
extern int g_msgHintText;
|
||||
extern bool g_pIgnoreTerminateDetour;
|
||||
extern bool g_pIgnoreCSWeaponDropDetour;
|
||||
|
||||
@@ -58,19 +58,7 @@ void TimeLeftEvents::FireGameEvent(IGameEvent *event)
|
||||
if (get_new_timeleft_offset || !round_end_found)
|
||||
{
|
||||
get_new_timeleft_offset = false;
|
||||
|
||||
float flGameStartTime = gpGlobals->curtime;
|
||||
uintptr_t gamerules = (uintptr_t)g_pSDKTools->GetGameRules();
|
||||
if (gamerules)
|
||||
{
|
||||
sm_sendprop_info_t info;
|
||||
if (gamehelpers->FindSendPropInfo("CCSGameRulesProxy", "m_flGameStartTime", &info))
|
||||
{
|
||||
flGameStartTime = *(float *)(gamerules + info.actual_offset);
|
||||
}
|
||||
}
|
||||
|
||||
timersys->NotifyOfGameStart(flGameStartTime - gpGlobals->curtime);
|
||||
timersys->NotifyOfGameStart();
|
||||
timersys->MapTimeLeftChanged();
|
||||
}
|
||||
round_end_found = false;
|
||||
|
||||
@@ -52,6 +52,7 @@ void EntityOutputManager::Shutdown()
|
||||
return;
|
||||
}
|
||||
|
||||
EntityOutputs->Destroy();
|
||||
ClassNames->Destroy();
|
||||
fireOutputDetour->Destroy();
|
||||
}
|
||||
@@ -65,6 +66,7 @@ void EntityOutputManager::Init()
|
||||
return;
|
||||
}
|
||||
|
||||
EntityOutputs = adtfactory->CreateBasicTrie();
|
||||
ClassNames = adtfactory->CreateBasicTrie();
|
||||
}
|
||||
|
||||
@@ -118,30 +120,45 @@ bool EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
|
||||
return true;
|
||||
}
|
||||
|
||||
char sOutput[20];
|
||||
ke::SafeSprintf(sOutput, sizeof(sOutput), "%p", pOutput);
|
||||
|
||||
// attempt to directly lookup a hook using the pOutput pointer
|
||||
OutputNameStruct *pOutputName = NULL;
|
||||
|
||||
const char *classname = gamehelpers->GetEntityClassname(pCaller);
|
||||
if (!classname)
|
||||
bool fastLookup = false;
|
||||
|
||||
// Fast lookup failed - check the slow way for hooks that haven't fired yet
|
||||
if ((fastLookup = EntityOutputs->Retrieve(sOutput, (void **)&pOutputName)) == false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
const char *classname = gamehelpers->GetEntityClassname(pCaller);
|
||||
if (!classname)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *outputname = FindOutputName(pOutput, pCaller);
|
||||
if (!outputname)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
const char *outputname = FindOutputName(pOutput, pCaller);
|
||||
if (!outputname)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
pOutputName = FindOutputPointer(classname, outputname, false);
|
||||
pOutputName = FindOutputPointer(classname, outputname, false);
|
||||
|
||||
if (!pOutputName)
|
||||
{
|
||||
return true;
|
||||
if (!pOutputName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pOutputName->hooks.empty())
|
||||
{
|
||||
if (!fastLookup)
|
||||
{
|
||||
// hook exists on this classname and output - map it into our quick find trie
|
||||
EntityOutputs->Insert(sOutput, pOutputName);
|
||||
}
|
||||
|
||||
SourceHook::List<omg_hooks *>::iterator _iter;
|
||||
|
||||
omg_hooks *hook;
|
||||
|
||||
@@ -121,6 +121,8 @@ private:
|
||||
|
||||
const char *FindOutputName(void *pOutput, CBaseEntity *pCaller);
|
||||
|
||||
//Maps CEntityOutput * to a OutputNameStruct
|
||||
IBasicTrie *EntityOutputs;
|
||||
// Maps classname to a ClassNameStruct
|
||||
IBasicTrie *ClassNames;
|
||||
|
||||
|
||||
@@ -741,6 +741,15 @@ native float GetClientAvgData(int client, NetFlow flow);
|
||||
*/
|
||||
native float GetClientAvgPackets(int client, NetFlow flow);
|
||||
|
||||
/**
|
||||
* Returns the client's baseserver IClient pointer.
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @return IClient address.
|
||||
* @error Invalid client index, client not connected, or fake client.
|
||||
*/
|
||||
native Address GetClientIClient(int client);
|
||||
|
||||
/**
|
||||
* Translates an userid index to the real player index.
|
||||
*
|
||||
|
||||
@@ -615,10 +615,7 @@ native int FormatNativeString(int out_param,
|
||||
*
|
||||
* @param data Data passed to the RequestFrame native.
|
||||
*/
|
||||
typeset RequestFrameCallback {
|
||||
function void ();
|
||||
function void (any data);
|
||||
}
|
||||
typedef RequestFrameCallback = function void (any data);
|
||||
|
||||
/**
|
||||
* Creates a single use Next Frame hook.
|
||||
|
||||
Reference in New Issue
Block a user