void CClassInterfaceValue :: findOffset ( ) { //if (!m_offset) //{ ServerClass *sc = UTIL_FindServerClass(m_class); if ( sc ) { UTIL_FindSendPropInfo(sc,m_value,&m_offset); } #ifdef _DEBUG else { CBotGlobals::botMessage(NULL,1,"Warning: Couldn't find CLASS %s",m_class); return; } #endif if ( m_offset > 0 ) m_offset += m_preoffset; #ifdef _DEBUG else { CBotGlobals::botMessage(NULL,1,"Warning: Couldn't find getprop %s for class %s",m_value,m_class); } #endif }
cell_t GetSendTableByNetclass(IPluginContext *pContext, const cell_t *params) { char *title; pContext->LocalToString(params[1], &title); ServerClass *sc = UTIL_FindServerClass(title); if (sc == NULL) { META_CONPRINTF("Could not open find netclass \"%s\"\n", title); return BAD_HANDLE; } return g_pHandleSys->CreateHandle(g_SendTableHandle, sc->m_pTable, pContext->GetIdentity(), myself->GetIdentity(), NULL); }
void UpdateValveGlobals() { s_pGameRules = nullptr; const char *pszNetClass = g_pGameConf->GetKeyValue("GameRulesProxy"); const char *pszDTName = g_pGameConf->GetKeyValue("GameRulesDataTable"); if (pszNetClass && pszDTName) { sm_sendprop_info_t info; ServerClass *sc = UTIL_FindServerClass(pszNetClass); if (sc && UTIL_FindDataTable(sc->m_pTable, pszDTName, &info)) { auto proxyFn = info.prop->GetDataTableProxyFn(); if (proxyFn) { CSendProxyRecipients recp; s_pGameRules = proxyFn(nullptr, nullptr, nullptr, &recp, 0); } } } }
bool TF2Tools::SDK_OnLoad(char *error, size_t maxlength, bool late) { if (strcmp(g_pSM->GetGameFolderName(), "tf") != 0) { UTIL_Format(error, maxlength, "Cannot Load TF2 Extension on mods other than TF2"); return false; } ServerClass *sc = UTIL_FindServerClass("CTFPlayer"); if (sc == NULL) { UTIL_Format(error, maxlength, "Could not find CTFPlayer server class"); return false; } playerSharedOffset = new sm_sendprop_info_t; if (!UTIL_FindDataTable(sc->m_pTable, "DT_TFPlayerShared", playerSharedOffset, 0)) { UTIL_Format(error, maxlength, "Could not find DT_TFPlayerShared data table"); return false; } sharesys->AddDependency(myself, "bintools.ext", true, true); sharesys->AddDependency(myself, "sdkhooks.ext", true, true); sharesys->AddDependency(myself, "sdktools.ext", false, true); char conf_error[255] = ""; if (!gameconfs->LoadGameConfigFile("sm-tf2.games", &g_pGameConf, conf_error, sizeof(conf_error))) { if (conf_error[0]) { UTIL_Format(error, maxlength, "Could not read sm-tf2.games.txt: %s", conf_error); } return false; } CDetourManager::Init(g_pSM->GetScriptingEngine(), g_pGameConf); sharesys->AddNatives(myself, g_TFNatives); sharesys->RegisterLibrary(myself, "tf2"); plsys->AddPluginsListener(this); playerhelpers->RegisterCommandTargetProcessor(this); g_critForward = forwards->CreateForward("TF2_CalcIsAttackCritical", ET_Hook, 4, NULL, Param_Cell, Param_Cell, Param_String, Param_CellByRef); g_addCondForward = forwards->CreateForward("TF2_OnConditionAdded", ET_Ignore, 2, NULL, Param_Cell, Param_Cell); g_removeCondForward = forwards->CreateForward("TF2_OnConditionRemoved", ET_Ignore, 2, NULL, Param_Cell, Param_Cell); g_waitingPlayersStartForward = forwards->CreateForward("TF2_OnWaitingForPlayersStart", ET_Ignore, 0, NULL); g_waitingPlayersEndForward = forwards->CreateForward("TF2_OnWaitingForPlayersEnd", ET_Ignore, 0, NULL); g_teleportForward = forwards->CreateForward("TF2_OnPlayerTeleport", ET_Hook, 3, NULL, Param_Cell, Param_Cell, Param_CellByRef); g_pCVar = icvar; m_CritDetoursEnabled = false; m_CondChecksEnabled = false; m_RulesDetoursEnabled = false; m_TeleportDetourEnabled = false; g_HolidayManager.OnSDKLoad(late); return true; }