void OnAmxxAttach() { initialze_offsets(); initialize_glb_offsets(); MF_AddNatives(engfunc_natives); MF_AddNatives(dllfunc_natives); MF_AddNatives(pev_natives); MF_AddNatives(forward_natives); MF_AddNatives(pdata_natives); MF_AddNatives(tr_Natives); MF_AddNatives(glb_natives); MF_AddNatives(ext2_natives); MF_AddNatives(misc_natives); g_kvd_glb.kvd.szClassName = const_cast<char *>(g_kvd_glb.cls.chars()); g_kvd_glb.kvd.szKeyName = const_cast<char *>(g_kvd_glb.key.chars()); g_kvd_glb.kvd.szValue = const_cast<char *>(g_kvd_glb.val.chars()); g_kvd_glb.kvd.fHandled = 0; ConfigManager = MF_GetConfigManager(); char error[256]; error[0] = '\0'; if (!ConfigManager->LoadGameConfigFile("common.games", &CommonConfig, error, sizeof(error)) && error[0] != '\0') { MF_Log("Could not read common.games gamedata: %s", error); MF_Log("get/set/find_ent_data* natives have been disabled"); return; } MF_AddNatives(pdata_gc_natives); }
void OnAmxxAttach() { MF_AddNatives(g_BaseSqlNatives); MF_AddNatives(g_ThreadSqlNatives); g_MysqlFuncs.prev = (SqlFunctions *)MF_RegisterFunctionEx(&g_MysqlFuncs, SQL_DRIVER_FUNC); if (!MF_RequestFunction("GetDbDriver") && !MF_FindLibrary("SQLITE", LibType_Library)) { MF_AddNatives(g_OldCompatNatives); MF_AddLibraries("dbi", LibType_Class, &g_ident); } }
void OnAmxxAttach() { MF_AddNatives(g_BaseCurlNatives); MF_AddNatives(g_ThreadCurlNatives); long flags = CURL_GLOBAL_NOTHING; #ifdef _WIN32 flags = CURL_GLOBAL_WIN32; #endif CURLcode code = curl_global_init(flags); if (code != CURLE_OK) { /* TODO report error */ } }
void OnAmxxAttach(void) { // Assert that the enum is aligned properly with the table assert(strcmp(hooklist[Ham_FVecVisible].name, "fvecvisible")==0); assert(strcmp(hooklist[Ham_Player_UpdateClientData].name, "player_updateclientdata")==0); assert(strcmp(hooklist[Ham_Item_AddToPlayer].name, "item_addtoplayer")==0); assert(strcmp(hooklist[Ham_Weapon_ExtractAmmo].name, "weapon_extractammo")==0); assert(strcmp(hooklist[Ham_TS_BreakableRespawn].name, "ts_breakablerespawn")==0); assert(strcmp(hooklist[Ham_NS_UpdateOnRemove].name, "ns_updateonremove")==0); assert(strcmp(hooklist[Ham_TS_ShouldCollide].name, "ts_shouldcollide")==0); assert(strcmp(hooklist[Ham_GetDeathActivity].name, "getdeathactivity")==0); assert(strcmp(hooklist[Ham_StopFollowing].name, "stopfollowing")==0); assert(strcmp(hooklist[Ham_CS_Player_OnTouchingWeapon].name, "cstrike_player_ontouchingweapon")==0); assert(strcmp(hooklist[Ham_DOD_Weapon_Special].name, "dod_weapon_special")==0); assert(strcmp(hooklist[Ham_TFC_RadiusDamage2].name, "tfc_radiusdamage2")==0); assert(strcmp(hooklist[Ham_ESF_Weapon_HolsterMeleed].name, "esf_weapon_holsterwhenmeleed")==0); assert(strcmp(hooklist[Ham_NS_Weapon_GetDeployTime].name, "ns_weapon_getdeploytime")==0); assert(strcmp(hooklist[Ham_SC_MedicCallSound].name, "sc_mediccallsound")==0); assert(strcmp(hooklist[Ham_SC_Player_CanTouchPlayer].name, "sc_player_cantouchplayer")==0); assert(strcmp(hooklist[Ham_SC_Weapon_ChangeWeaponSkin].name, "sc_weapon_changeweaponskin")==0); assert(strcmp(hooklist[Ham_SC_Player_IsConnected].name, "sc_player_isconnected")==0); MF_AddNatives(pdata_natives_safe); if (ReadConfig() > 0) { if (Offsets.IsValid()) { MF_AddNatives(RegisterNatives); MF_AddNatives(ReturnNatives); MF_AddNatives(pdata_natives); } else { #ifdef _WIN32 MF_Log("Error: pev and base not set for section \"%s windows\", cannot register natives.", MF_GetModname()); #elif defined(__linux__) MF_Log("Error: pev and base not set for section \"%s linux\", cannot register natives.", MF_GetModname()); #elif defined(__APPLE__) MF_Log("Error: pev and base not set for section \"%s mac\", cannot register natives.", MF_GetModname()); #endif } } else { MF_Log("Error: Cannot read config file, natives not registered!"); } }
void OnAmxxAttach() { if (loadDatabase()) { MF_AddNatives(GeoipNatives); NativesRegistered = true; } REG_SVR_COMMAND("geoip", OnGeoipCommand); }
void OnAmxxAttach() { initialze_offsets(); initialize_glb_offsets(); MF_AddNatives(engfunc_natives); MF_AddNatives(dllfunc_natives); MF_AddNatives(pev_natives); MF_AddNatives(forward_natives); MF_AddNatives(pdata_natives); MF_AddNatives(tr_Natives); MF_AddNatives(glb_natives); MF_AddNatives(ext2_natives); MF_AddNatives(misc_natives); g_kvd_2.szClassName = ""; g_kvd_2.szKeyName = ""; g_kvd_2.szValue = ""; g_kvd_glb.kvd = &g_kvd_2; }
void OnAmxxAttach() { initialze_offsets(); initialize_glb_offsets(); MF_AddNatives(engfunc_natives); MF_AddNatives(dllfunc_natives); MF_AddNatives(pev_natives); MF_AddNatives(forward_natives); MF_AddNatives(pdata_natives); MF_AddNatives(tr_Natives); MF_AddNatives(glb_natives); MF_AddNatives(ext2_natives); MF_AddNatives(misc_natives); g_kvd_glb.kvd.szClassName = const_cast<char *>(g_kvd_glb.cls.chars()); g_kvd_glb.kvd.szKeyName = const_cast<char *>(g_kvd_glb.key.chars()); g_kvd_glb.kvd.szValue = const_cast<char *>(g_kvd_glb.val.chars()); g_kvd_glb.kvd.fHandled = 0; }
void OnAmxxAttach() { MF_AddNatives(sockets_natives); // And, if win32, we have to specially start up the winsock environment #ifdef _WIN32 short wVersionRequested; WSADATA wsaData; wVersionRequested = MAKEWORD (1, 1); if (WSAStartup (wVersionRequested, &wsaData) != 0) { MF_Log("Sockets Module: Error while starting up winsock environment.!"); } #endif return; }
void Rage::OnAmxxAttach(PFN_REQ_FNPTR reqFnptrFunc) { static bool attached = false; if(!attached) { attached = true; Global::librariesManager.load_libraries_attach(); g_engfuncs.pfnAddServerCommand("rage",&Rage::OnCommandRage); MF_AddNatives(Rage::Exports); } Global::modulesManager.AmxxAttach(reqFnptrFunc); Global::handlerCreatorManager.AmxxAttach(reqFnptrFunc); }
void OnAmxxAttach() { MF_AddNatives(CstrikeNatives); InitializeHacks(); // cs_create_entity() CS_CreateNamedEntity = reinterpret_cast<CreateNamedEntityFunc>(UTIL_FindAddressFromEntry(CS_IDENT_CREATENAMEDENTITY, CS_IDENT_HIDDEN_STATE)); if (CS_CreateNamedEntity <= 0) { MF_Log("CREATE_NAMED_ENITTY is not available - native cs_create_entity() has been disabled"); } // cs_find_ent_by_class() CS_UTIL_FindEntityByString = reinterpret_cast<UTIL_FindEntityByStringFunc>(UTIL_FindAddressFromEntry(CS_IDENT_UTIL_FINDENTITYBYSTRING, CS_IDENT_HIDDEN_STATE)); if (CS_UTIL_FindEntityByString <= 0) { MF_Log("UTIL_FindEntByString is not available - native cs_find_ent_by_class() has been disabled"); } }
void AddNatives_Weapons() { MF_AddNatives(weapon_natives); }
void OnAmxxAttach() { // Adding the natives MF_AddNatives(esf_Exports); }
void OnAmxxAttach() { MF_AddNatives(regex_Natives); }
void AddNatives_Player() { MF_AddNatives(player_natives); }
void AddNatives_Particles() { MF_AddNatives(particle_natives); }
void OnAmxxAttach() { initialze_offsets(); initialize_glb_offsets(); MF_AddNatives(engfunc_natives); MF_AddNatives(dllfunc_natives); MF_AddNatives(pev_natives); MF_AddNatives(forward_natives); MF_AddNatives(pdata_natives); MF_AddNatives(tr_Natives); MF_AddNatives(glb_natives); MF_AddNatives(ext2_natives); MF_AddNatives(misc_natives); MF_AddNatives(pdata_entities_natives); MF_AddNatives(pdata_gamerules_natives); g_kvd_glb.kvd.szClassName = const_cast<char *>(g_kvd_glb.cls.chars()); g_kvd_glb.kvd.szKeyName = const_cast<char *>(g_kvd_glb.key.chars()); g_kvd_glb.kvd.szValue = const_cast<char *>(g_kvd_glb.val.chars()); g_kvd_glb.kvd.fHandled = 0; ConfigManager = MF_GetConfigManager(); char error[256] = ""; if (!ConfigManager->LoadGameConfigFile("common.games", &CommonConfig, error, sizeof(error)) && error[0] != '\0') { MF_Log("get/set_ent_data* natives have been disabled because common.games gamedata could not be read: %s", error); return; } *error = '\0'; if (!ConfigManager->LoadGameConfigFile("common.games/gamerules.games", &GamerulesConfig, error, sizeof(error)) && error[0] != '\0') { MF_Log("get/set_gamerules_* natives have been disabled because common.games/gamerules.games gamedata could not be read: %s", error); return; } void *address = nullptr; if (!CommonConfig->GetAddress("g_pGameRules", &address) || !address) { MF_Log("get/set_gamerules_* natives have been disabled because g_pGameRules address could not be found. "); return; } #if defined(KE_WINDOWS) GameRulesAddress = *reinterpret_cast<void***>(address); #else GameRulesAddress = reinterpret_cast<void**>(address); #endif }
void OnGeoipCommand() { const auto cmd = CMD_ARGV(1); if (!strcmp(cmd, "version")) { if (!HandleDB.filename) { MF_PrintSrvConsole("\n Database is not loaded.\n"); return; } const auto meta_dump = "\n" " Database metadata\n" " Node count: %i\n" " Record size: %i bits\n" " IP version: IPv%i\n" " Binary format: %i.%i\n" " Build epoch: %llu (%s)\n" " Type: %s\n" " Languages: "; char date[40]; strftime(date, sizeof date, "%Y-%m-%d %H:%M:%S UTC", gmtime(reinterpret_cast<const time_t *>(&HandleDB.metadata.build_epoch))); fprintf(stdout, meta_dump, HandleDB.metadata.node_count, HandleDB.metadata.record_size, HandleDB.metadata.ip_version, HandleDB.metadata.binary_format_major_version, HandleDB.metadata.binary_format_minor_version, HandleDB.metadata.build_epoch, date, HandleDB.metadata.database_type); for (size_t i = 0; i < HandleDB.metadata.languages.count; ++i) { fprintf(stdout, "%s", HandleDB.metadata.languages.names[i]); if (i < HandleDB.metadata.languages.count - 1) { fprintf(stdout, " "); } } fprintf(stdout, "\n"); fprintf(stdout, " Description:\n"); for (size_t i = 0; i < HandleDB.metadata.description.count; ++i) { fprintf(stdout, " %s: %s\n", HandleDB.metadata.description.descriptions[i]->language, HandleDB.metadata.description.descriptions[i]->description); } fprintf(stdout, "\n"); } else if (!strcmp(cmd, "dump")) { if (!HandleDB.filename) { MF_PrintSrvConsole("\n Database is not loaded.\n\n"); return; } const auto num_args = CMD_ARGC(); if (num_args < 3) { MF_PrintSrvConsole("\n An IP address must be provided.\n\n"); return; } const auto ip = stripPort(const_cast<char *>(CMD_ARGV(2))); auto gai_error = 0; auto mmdb_error = 0; auto result = MMDB_lookup_string(&HandleDB, ip, &gai_error, &mmdb_error); if (gai_error != 0 || mmdb_error != MMDB_SUCCESS || !result.found_entry) { MF_PrintSrvConsole("\n Either look up failed or no found result.\n\n"); return; } MMDB_entry_data_list_s *entry_data_list = nullptr; int status; if ((status = MMDB_get_entry_data_list(&result.entry, &entry_data_list)) != MMDB_SUCCESS || entry_data_list == nullptr) { MF_PrintSrvConsole("\n Could not retrieve data list - %s.\n\n", MMDB_strerror(status)); return; } const char *file = nullptr; FILE *fp = nullptr; if (num_args > 3) { file = CMD_ARGV(3); fp = fopen(MF_BuildPathname("%s", file), "w"); } if (!fp) { file = nullptr; fp = stdout; } fprintf(fp, "\n"); MMDB_dump_entry_data_list(fp, entry_data_list, 2); fprintf(fp, "\n"); if (file) { fclose(fp); } MMDB_free_entry_data_list(entry_data_list); } else if (!strcmp(cmd, "reload")) { const auto isDatabaseLoaded = HandleDB.filename != nullptr; if (isDatabaseLoaded) { MMDB_close(&HandleDB); } if (loadDatabase() && !NativesRegistered) { MF_AddNatives(GeoipNatives); NativesRegistered = true; } } else { MF_PrintSrvConsole("\n"); MF_PrintSrvConsole(" Usage: geoip <command> [argument]\n"); MF_PrintSrvConsole(" Commands:\n"); MF_PrintSrvConsole(" version - display geoip database metadata\n"); MF_PrintSrvConsole(" reload - reload geoip database\n"); MF_PrintSrvConsole(" dump <ip> [output file] - dump all data from an IP address formatted in a JSON-ish fashion.\n"); MF_PrintSrvConsole(" An output file is mod-based and if not provided, it will print in the console.\n"); MF_PrintSrvConsole("\n"); } }
void OnAmxxAttach() { MF_AddNatives(fun_Exports); }
void OnAmxxAttach() { MF_AddNatives(CstrikeNatives); InitializeHacks(); }
void AddNatives_PlayerMemory() { MF_AddNatives(player_memory_natives); }
void OnAmxxAttach() { MF_AddNatives( sypb_natives ); }