- Ошибка
-
L 04/28/2023 - 21:23:58: [ReAPI] ReHlds: isn't available
L 04/28/2023 - 21:23:58: [AMXX] Displaying debug trace (plugin "Customs\unreal_unprecacher.amxx", version "1.3")
L 04/28/2023 - 21:23:58: [AMXX] Run time error 10: native error (native "rh_get_mapname")
L 04/28/2023 - 21:23:58: [AMXX] [0] unreal_unprecacher.sma::plugin_precache (line 78)
L 04/28/2023 - 21:23:58: [Customs\unreal_unprecacher.amxx] performance issue. Function plugin_precache executed more than 88.7ms.
- ОС
- Windows
- Amx Mod X
-
AMX Mod X 1.10.0.5461 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Dec 6 2021 17:37:35
Built from: https://github.com/alliedmodders/amxmodx/commit/ec82e3f3
Build ID: 5461:ec82e3f3
Core mode: JIT+ASM32
- Билд
-
Protocol version 48
Exe version 1.0.0.3 (czero)
Exe build: 19:53:27 Aug 3 2020 (8684)
- ReGamedll
-
ReGameDLL version: 5.21.0.576-dev
Build date: 08:32:08 Mar 11 2023
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/8ff30b4
- Версия Metamod
-
Metamod v1.21p38 2018/02/11 (5:13)
by Will Day
http://www.metamod.org/
Patch: Metamod-P (mm-p) v38
by Jussi Kivilinna
http://metamod-p.sourceforge.net/
compiled: Feb 11 2018, 10:55:08 EET (optimized)
- Список метамодулей
-
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] AMX Mod X RUN - amxmodx_mm.dll v1.10.0. ini Start ANY
[ 2] YaPB RUN - yapb.dll v4.2.711 ini Chlvl ANY
[ 3] HitBox Fix RUN - hitbox_fix_mm.dl v1.1.2 ini Start ANY
[ 4] okapi RUN - okapi_amxx.dll v1.0 pl1 ANY ANY
[ 5] Orpheu RUN - orpheu_amxx.dll v2.6.3 pl1 ANY ANY
[ 6] ReAPI RUN - reapi_amxx.dll v5.22.0. pl1 ANY Never
[ 7] MetaDrawer RUN - metadrawer_amxx. v1.0 pl1 ANY ANY
[ 8] FakeMeta RUN - fakemeta_amxx.dl v1.10.0. pl1 ANY ANY
[ 9] CStrike RUN - cstrike_amxx.dll v1.10.0. pl1 ANY ANY
[10] Ham Sandwich RUN - hamsandwich_amxx v1.10.0. pl1 ANY ANY
[11] CSX RUN - csx_amxx.dll v1.10.0. pl1 ANY ANY
[12] Engine RUN - engine_amxx.dll v1.10.0. pl1 ANY ANY
[13] Fun RUN - fun_amxx.dll v1.10.0. pl1 ANY ANY
13 plugins, 13 running
- Список плагинов
-
Currently loaded plugins:
id name version author url file status
[ 1] 0 Admin Base 1.10.0.546 AMXX Dev Team admin.amxx running
[ 2] 1 Admin Commands 1.10.0.546 AMXX Dev Team admincmd.am running
[ 3] 2 Admin Help 1.10.0.546 AMXX Dev Team adminhelp.a running
[ 4] 3 Slots Reservation 1.10.0.546 AMXX Dev Team adminslots. running
[ 5] 4 Multi-Lingual System 1.10.0.546 AMXX Dev Team multilingua running
[ 6] 5 Menus Front-End 1.10.0.546 AMXX Dev Team menufront.a running
[ 7] 6 Commands Menu 1.10.0.546 AMXX Dev Team cmdmenu.amx running
[ 8] 7 Players Menu 1.10.0.546 AMXX Dev Team plmenu.amxx running
[ 9] 8 Teleport Menu 1.10.0.546 AMXX Dev Team telemenu.am running
[ 10] 9 Maps Menu 1.10.0.546 AMXX Dev Team mapsmenu.am running
[ 11] 10 Plugin Menu 1.10.0.546 AMXX Dev Team pluginmenu. running
[ 12] 11 Admin Chat 1.10.0.546 AMXX Dev Team adminchat.a running
[ 13] 12 Anti Flood 1.10.0.546 AMXX Dev Team antiflood.a running
[ 14] 13 Scrolling Message 1.10.0.546 AMXX Dev Team scrollmsg.a running
[ 15] 14 Info. Messages 1.10.0.546 AMXX Dev Team imessage.am running
[ 16] 15 Admin Votes 1.10.0.546 AMXX Dev Team adminvote.a running
[ 17] 16 NextMap 1.10.0.546 AMXX Dev Team nextmap.amx running
[ 18] 17 TimeLeft 1.10.0.546 AMXX Dev Team timeleft.am running
[ 19] 18 Pause Plugins 1.10.0.546 AMXX Dev Team pausecfg.am running
[ 20] 19 Stats Configuration 1.10.0.546 AMXX Dev Team statscfg.am running
[ 21] 20 Restrict Weapons 1.10.0.546 AMXX Dev Team restmenu.am running
[ 22] 21 StatsX 1.10.0.546 AMXX Dev Team statsx.amxx running
[ 23] 22 CS Misc. Stats 1.10.0.546 AMXX Dev Team miscstats.a running
[ 24] 23 CS Stats Logging 1.10.0.546 AMXX Dev Team stats_loggi running
[ 25] 24 Metadrawer Draw Radar 1.0 Agung unknown MetaDrawer\ running
[ 26] 25 Metadrawer Draw Entity 1.0 Agung unknown MetaDrawer\ running
[ 27] 26 4-4 RoF Mod 1.0 hellmonja unknown Customs\44_ running
[ 28] 27 Advanced Weapon Tracer 1.3.0 ConnorMcLeod unknown Customs\adv running
[ 29] 28 Anti Fast Silencer 0.0.4 ConnorMcLeod unknown Customs\ant running
[ 30] 29 Anti He Bug 1.1 Numb unknown Customs\ant running
[ 31] 30 Reloaded Weapons On Ne 2.1.0 ConnorMcLeod unknown Customs\aut running
[ 32] 31 BackWeapon 3 0.0.6 ConnorMcLeod unknown Customs\bac running
[ 33] 32 Bad Camper 1.4 beta Brad Jones unknown Customs\bad running
[ 34] 33 Bad Spawns Preventer 1.2 xPaw unknown Customs\Bad running
[ 35] 34 Bot Features 0.9 Vaqtincha Customs\Bot running
[ 36] 35 Bomb has been defused 1.1 xPaw unknown Customs\Bom running
[ 37] 36 Bloody Corpses 2.0 se7h/BlackCat unknown Customs\blo running
[ 38] 37 Block Use Sound 1.0 OciXCrom unknown Customs\crx running
[ 39] 38 Bubble Trails 0.0.1 ConnorMcLeod unknown Customs\bub running
[ 40] 39 C4 Taker 1.10 hellmonja & Haml unknown Customs\c4_ running
[ 41] 40 c4 timer 1.1 cheap_suit unknown Customs\c4t running
[ 42] 41 Bomb/Death/CSS Radar 1.2 eDark & Numb Customs\css running
[ 43] 42 FlashBang Color Fix 1.0.1 GlaDiuS | [PRinc unknown Customs\Fla debug
[ 44] 43 Default FOV 0.0.1 ConnorMcLeod unknown Customs\def running
[ 45] 44 Drop Nvg 3.1 tuty unknown Customs\dro running
[ 46] 45 Pop Grenades 1.0 EFFx/HamletEagle unknown Customs\Gre running
[ 47] 46 hl_weapon_physics 0.6 Turanga_Leela unknown Customs\hl_ running
[ 48] 47 Lie Flat 1.1 Nomexous unknown Customs\lie running
[ 49] 48 UnrealUnprecacher 1.3 Karaulov Customs\unr debug
[ 50] 49 Random Buy 1.1 ConnorMcLeod, he unknown Customs\ran running
[ 51] 50 Ultimate Fire in the H 2.0 OciXCrom unknown Customs\crx running
[ 52] 51 ServerName 0.1 Vaqtincha Customs\Ser running
[ 53] 52 Spawn Protection 1.0.1 OciXCrom unknown Customs\crx running
[ 54] 53 [SCM] Entity Editor 1.3.1 schmurgel1983 unknown Customs\TSC running
[ 55] 54 [CZ] Team Semiclip 3.3.1 schmurgel1983 unknown Customs\TSC running
[ 56] 55 Water Fall Damage 0.10 Avalanche unknown Customs\wat running
[ 57] 56 WarmUP Pro 5.6 Beta ReymonARG unknown Customs\war running
[ 58] 57 Weapon Lights 0.7.1 HiSS & Arkshine unknown Customs\wea running
[ 59] 58 CSGO: Death and Money 2.0.1 Digi, ConnorMcle unknown CSWS/csgo_d debug
[ 60] 59 Weapon Price Editor 1.1 hellmonja unknown CSWS/weapon debug
60 plugins, 60 running
- Автор плагина
- karaulov
- Версия плагина
- 1.3
- Исходный код
-
#include <amxmodx>
#include <amxmisc>
#include <reapi>
// set model
#include <engine>
// hook setmodel
#include <fakemeta>
#define PLUGIN "UnrealUnprecacher"
#define AUTHOR "Karaulov"
#define VERSION "1.3"
// Uncomment next line for disable using 'DEFAULT RESOURCE' for unprecache
// But then it can cause crash with some plugins that used this files.
//#define FORCE_SKIP_RESOURECES
// Comment this to decrease server CPU usage.
// But then it can cause crash with some plugins that used this files.
#define REPLACE_SOUND_NATIVE
// Comment this to decrease server CPU usage.
// But then it can cause crash with some plugins that used this files.
#define REPLACE_MODEL_NATIVE
new g_iPrecacheResourcesCount = 0;
new g_iUnprecacheCount = 0;
new g_iReplaceResourcesCount = 0;
new Trie:g_sReplaceResourcesList;
// For support all plugins
new const DEFAULT_MODEL_PATH[] = "models/pshell.mdl"
new const DEFAULT_SPRITE_PATH[] = "sprites/shadow_circle.spr"
new const DEFAULT_SOUND_PATH[] = "common/null.wav"
new const DEFAULT_DECAL_NAME[] = "{ammo"
new g_bUploadUnprecache = false;
new g_bUploadPrecache = false;
new HookChain:g_hcRH_PF_precache_generic_I;
new HookChain:g_hcRH_PF_precache_model_I;
new HookChain:g_hcRH_PF_precache_sound_I;
new HookChain:g_hcRH_SV_AddResource;
new HookChain:g_hcRH_SV_StartSound;
new HookChain:g_hcRG_CBasePlayerWeapon_DefaultDeploy;
new g_hFM_SetModel;
new g_hFM_ModelIndex;
new g_hFM_SetClientKeyValue;
new g_hFM_ClientUserInfoChanged;
new g_hFM_EmitAmbientSound;
new g_hCorpseMsg;
new g_hHOOK_ClCorpse;
public plugin_precache()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
create_cvar(PLUGIN, VERSION, (FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED));
g_sReplaceResourcesList = TrieCreate();
new configsDir[PLATFORM_MAX_PATH];
get_configsdir(configsDir, charsmax(configsDir));
new mapName[MAX_RESOURCE_PATH_LENGTH];
rh_get_mapname(mapName,charsmax(mapName));
new configMapPath[PLATFORM_MAX_PATH];
register_srvcmd("add_replace_sound","replace_list_sound",ADMIN_RCON,"Unprecache resources.");
register_srvcmd("add_replace_generic","replace_list_generic",ADMIN_RCON,"Unprecache resources.");
register_srvcmd("add_replace_model","replace_list_model",ADMIN_RCON,"Unprecache resources.");
register_srvcmd("show_replace_list","show_replace_list",ADMIN_RCON,"Print list of unprecached resources.");
g_hcRH_SV_AddResource = RegisterHookChain(RH_SV_AddResource, "RH_SV_AddResource_pre", 0);
g_bUploadUnprecache = true;
server_cmd("exec %s/plugins/%s/unprecache_list.cfg",configsDir,PLUGIN);
server_exec();
formatex(configMapPath,charsmax(configMapPath),"%s/plugins/%s/maps/%s/unprecache_list.cfg",configsDir,PLUGIN,mapName);
if (file_exists(configMapPath))
{
server_cmd("exec %s",configMapPath);
server_exec();
}
g_bUploadUnprecache = false;
register_srvcmd("add_precache_sound","add_precache_sound",ADMIN_RCON,"Precache sound.");
register_srvcmd("add_precache_generic","add_precache_generic",ADMIN_RCON,"Precache generic.");
register_srvcmd("add_precache_model","add_precache_model",ADMIN_RCON,"Precache model.");
g_bUploadPrecache = true;
server_cmd("exec %s/plugins/%s/precache_list.cfg",configsDir,PLUGIN);
server_exec();
formatex(configMapPath,charsmax(configMapPath),"%s/plugins/%s/maps/%s/precache_list.cfg",configsDir,PLUGIN,mapName);
if (file_exists(configMapPath))
{
server_cmd("exec %s",configMapPath);
server_exec();
}
g_bUploadPrecache = false;
g_hcRH_PF_precache_generic_I = RegisterHookChain(RH_PF_precache_generic_I, "RH_PF_precache_generic_I_pre", 0);
g_hcRH_PF_precache_model_I = RegisterHookChain(RH_PF_precache_model_I, "RH_PF_precache_model_I_pre", 0);
g_hcRH_PF_precache_sound_I = RegisterHookChain(RH_PF_precache_sound_I, "RH_PF_precache_sound_I_pre", 0);
new plugid = get_plugin(-1);
if (plugid > 2)
{
log_amx("[%s %s] plugin number is %i, please move this plugin above another plugins!", PLUGIN, VERSION, plugid);
}
// Fix sounds
g_hcRH_SV_StartSound = RegisterHookChain(RH_SV_StartSound, "RH_SV_StartSound_pre",0);
g_hFM_EmitAmbientSound = register_forward(FM_EmitAmbientSound, "FM_EmitAmbientSound_pre", 0)
// Fix models
g_hCorpseMsg = get_user_msgid("ClCorpse")
g_hHOOK_ClCorpse = register_message(g_hCorpseMsg, "ClCorpse_pre")
g_hFM_SetModel = register_forward(FM_SetModel, "FM_SetModel_pre", 0)
g_hFM_ModelIndex = register_forward(FM_ModelIndex, "FM_ModelIndex_pre", 0)
g_hFM_SetClientKeyValue = register_forward(FM_SetClientKeyValue, "FM_SetClientKeyValue_pre", 0)
g_hFM_ClientUserInfoChanged = register_forward(FM_ClientUserInfoChanged, "FM_ClientUserInfoChanged_pre", 0)
// Fix weapon models
g_hcRG_CBasePlayerWeapon_DefaultDeploy = RegisterHookChain(RG_CBasePlayerWeapon_DefaultDeploy, "CBasePlayerWeapon_DefaultDeploy_Pre");
}
public plugin_end()
{
DisableHookChain(g_hcRH_SV_AddResource);
DisableHookChain(g_hcRH_PF_precache_generic_I);
DisableHookChain(g_hcRH_PF_precache_model_I);
DisableHookChain(g_hcRH_PF_precache_sound_I);
DisableHookChain(g_hcRH_SV_StartSound);
DisableHookChain(g_hcRG_CBasePlayerWeapon_DefaultDeploy);
unregister_forward(FM_EmitAmbientSound,g_hFM_EmitAmbientSound);
unregister_forward(FM_SetModel,g_hFM_SetModel);
unregister_forward(FM_ModelIndex,g_hFM_ModelIndex);
unregister_forward(FM_SetClientKeyValue,g_hFM_SetClientKeyValue);
unregister_forward(FM_ClientUserInfoChanged,g_hFM_ClientUserInfoChanged);
unregister_message(g_hCorpseMsg,g_hHOOK_ClCorpse);
TrieDestroy(g_sReplaceResourcesList);
}
public add_precache_sound()
{
if(!g_bUploadPrecache)
{
return;
}
new arg1[MAX_RESOURCE_PATH_LENGTH];
read_argv(1,arg1,charsmax(arg1));
precache_sound(arg1);
}
public add_precache_generic()
{
if(!g_bUploadPrecache)
{
return;
}
new arg1[MAX_RESOURCE_PATH_LENGTH];
read_argv(1,arg1,charsmax(arg1));
if (arg1[0] != '{')
precache_generic(arg1);
}
public add_precache_model()
{
if(!g_bUploadPrecache)
{
return;
}
new arg1[MAX_RESOURCE_PATH_LENGTH];
read_argv(1,arg1,charsmax(arg1));
if (arg1[0] != '{')
precache_model(arg1);
}
public replace_list_sound()
{
if (!g_bUploadUnprecache)
{
return;
}
new arg1[MAX_RESOURCE_PATH_LENGTH],arg2[MAX_RESOURCE_PATH_LENGTH];
read_argv(1,arg1,charsmax(arg1));
if (read_argc() > 2)
{
read_argv(2,arg2,charsmax(arg2));
}
else
{
arg2[0] = EOS;
}
TrieSetString(g_sReplaceResourcesList, arg1, arg2);
g_iReplaceResourcesCount++;
if (strlen(arg2) > 0)
{
precache_sound(arg2);
}
}
public replace_list_model()
{
if (!g_bUploadUnprecache)
{
return;
}
new arg1[MAX_RESOURCE_PATH_LENGTH],arg2[MAX_RESOURCE_PATH_LENGTH];
read_argv(1,arg1,charsmax(arg1));
if (read_argc() > 2)
{
read_argv(2,arg2,charsmax(arg2));
}
else
{
arg2[0] = EOS;
}
TrieSetString(g_sReplaceResourcesList, arg1, arg2);
g_iReplaceResourcesCount++;
if (strlen(arg2) > 0)
{
precache_model(arg2);
}
}
public replace_list_generic()
{
if (!g_bUploadUnprecache)
{
return;
}
new arg1[MAX_RESOURCE_PATH_LENGTH],arg2[MAX_RESOURCE_PATH_LENGTH];
read_argv(1,arg1,charsmax(arg1));
if (read_argc() > 2)
{
read_argv(2,arg2,charsmax(arg2));
}
else
{
arg2[0] = EOS;
}
TrieSetString(g_sReplaceResourcesList, arg1, arg2);
g_iReplaceResourcesCount++;
if (strlen(arg2) > 0)
{
precache_generic(arg2);
}
}
public show_replace_list()
{
server_print("[%s %s] Added precached resources: %i.",PLUGIN,VERSION, g_iPrecacheResourcesCount);
server_print("[%s %s] Added replaced resources: %i.",PLUGIN,VERSION, g_iReplaceResourcesCount);
server_print("[%s %s] Total of unprecache resources: %i.",PLUGIN,VERSION, g_iUnprecacheCount);
new TrieIter:hIter = TrieIterCreate(g_sReplaceResourcesList);
// first destroy all the forwards
while (!TrieIterEnded(hIter))
{
new key[128];
new value[128];
TrieIterGetKey(hIter, key, charsmax(key));
TrieIterGetString(hIter, value, charsmax(value));
server_print("[%s=%s]",key,value);
TrieIterNext(hIter);
}
TrieIterDestroy(hIter);
}
public pfn_keyvalue(ent)
{
new entName[512];
new keyName[512];
new valueName[MAX_RESOURCE_PATH_LENGTH];
copy_keyvalue(entName,charsmax(entName),keyName,charsmax(keyName),valueName,charsmax(valueName));
if(TrieKeyExists(g_sReplaceResourcesList, valueName))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, valueName, tmpResource, charsmax(tmpResource));
DispatchKeyValue(keyName, tmpResource);
}
}
public RH_PF_precache_generic_I_pre(const res[])
{
if(TrieKeyExists(g_sReplaceResourcesList, res))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, res, tmpResource, charsmax(tmpResource));
g_iUnprecacheCount++;
if (strlen(tmpResource) == 0)
{
#if defined FORCE_SKIP_RESOURECES
SetHookChainReturn(ATYPE_INTEGER, 0);
return HC_BREAK;
#else
SetHookChainArg(1, ATYPE_STRING, DEFAULT_SOUND_PATH);
#endif
}
else
{
SetHookChainArg(1, ATYPE_STRING, tmpResource);
}
}
return HC_CONTINUE;
}
public RH_PF_precache_model_I_pre(const res[])
{
if(TrieKeyExists(g_sReplaceResourcesList, res))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, res, tmpResource, charsmax(tmpResource));
g_iUnprecacheCount++;
if (strlen(tmpResource) == 0)
{
#if defined FORCE_SKIP_RESOURECES
SetHookChainReturn(ATYPE_INTEGER, 0);
return HC_BREAK;
#else
if (res[0] == 's')
{
SetHookChainArg(1, ATYPE_STRING, DEFAULT_SPRITE_PATH);
}
else
{
SetHookChainArg(1, ATYPE_STRING, DEFAULT_MODEL_PATH);
}
#endif
}
else
{
SetHookChainArg(1, ATYPE_STRING, tmpResource);
}
}
return HC_CONTINUE;
}
public RH_PF_precache_sound_I_pre(const res[])
{
if(TrieKeyExists(g_sReplaceResourcesList, res))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, res, tmpResource, charsmax(tmpResource));
g_iUnprecacheCount++;
if (strlen(tmpResource) == 0)
{
#if defined FORCE_SKIP_RESOURECES
SetHookChainReturn(ATYPE_INTEGER, 0);
return HC_BREAK;
#else
SetHookChainArg(1, ATYPE_STRING, DEFAULT_SOUND_PATH);
#endif
}
else
{
SetHookChainArg(1, ATYPE_STRING, tmpResource);
}
}
return HC_CONTINUE;
}
public RH_SV_AddResource_pre(ResourceType_t:type, const filename[], size, flags, index)
{
if(TrieKeyExists(g_sReplaceResourcesList, filename))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, filename, tmpResource, charsmax(tmpResource));
g_iUnprecacheCount++;
if (strlen(tmpResource) == 0)
{
#if defined FORCE_SKIP_RESOURECES
SetHookChainReturn(ATYPE_INTEGER, 0);
return HC_BREAK;
#else
if (type == t_sound)
{
SetHookChainArg(2, ATYPE_STRING, DEFAULT_SOUND_PATH);
}
else if (type == t_model || type == t_world)
{
if (filename[0] == 's')
{
SetHookChainArg(2, ATYPE_STRING, DEFAULT_SPRITE_PATH);
}
else
{
SetHookChainArg(2, ATYPE_STRING, DEFAULT_MODEL_PATH);
}
}
else if (type == t_generic)
{
SetHookChainArg(2, ATYPE_STRING, DEFAULT_SOUND_PATH);
}
else if (type == t_decal || type == t_skin)
{
SetHookChainArg(2, ATYPE_STRING, DEFAULT_DECAL_NAME);
}
#endif
}
else
{
new soundTest[MAX_RESOURCE_PATH_LENGTH + 7];
formatex("sound/%s",charsmax(soundTest),filename);
new fileLen = file_size(tmpResource);
if (fileLen == 0)
{
fileLen = file_size(soundTest);
}
SetHookChainArg(3, ATYPE_INTEGER, file_size(tmpResource));
SetHookChainArg(2, ATYPE_STRING, tmpResource);
}
}
return HC_CONTINUE;
}
public RH_SV_StartSound_pre(const recipients, const entity, const channel, const sample[], const volume, const Float:attenuation, const fFlags, const pitch)
{
#if defined REPLACE_SOUND_NATIVE
if(TrieKeyExists(g_sReplaceResourcesList, sample))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, sample, tmpResource, charsmax(tmpResource));
if (strlen(tmpResource) != 0)
{
SetHookChainArg(4,ATYPE_STRING,tmpResource)
}
else
{
#if defined FORCE_SKIP_RESOURECES
return HC_BREAK;
#else
SetHookChainArg(4,ATYPE_STRING,DEFAULT_SOUND_PATH)
#endif
}
}
#endif
return HC_CONTINUE;
}
public FM_EmitAmbientSound_pre(const entity, const Float:Origin[3], const sample[], const Float:volume, const Float:attenuation, const fFlags, const pitch)
{
#if defined REPLACE_SOUND_NATIVE
if(TrieKeyExists(g_sReplaceResourcesList, sample))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, sample, tmpResource, charsmax(tmpResource));
if (strlen(tmpResource) != 0)
{
engfunc(EngFunc_EmitAmbientSound, entity, Origin, tmpResource, volume, attenuation, fFlags, pitch);
return FMRES_SUPERCEDE;
}
else
{
#if defined FORCE_SKIP_RESOURECES
return FMRES_SUPERCEDE;
#else
engfunc(EngFunc_EmitAmbientSound, entity, Origin, DEFAULT_SOUND_PATH, volume, attenuation, fFlags, pitch);
return FMRES_SUPERCEDE;
#endif
}
}
#endif
return FMRES_IGNORED;
}
public FM_SetModel_pre(const ent, const model[])
{
#if defined REPLACE_MODEL_NATIVE
if (!pev_valid(ent))
return FMRES_IGNORED;
if(TrieKeyExists(g_sReplaceResourcesList, model))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, model, tmpResource, charsmax(tmpResource));
if (strlen(tmpResource) != 0)
{
engfunc(EngFunc_SetModel, ent, tmpResource);
}
else
{
#if defined FORCE_SKIP_RESOURECES
return FMRES_SUPERCEDE;
#else
engfunc(EngFunc_SetModel, ent, DEFAULT_MODEL_PATH);
#endif
}
return FMRES_SUPERCEDE;
}
#endif
return FMRES_IGNORED;
}
public FM_ModelIndex_pre(const model[])
{
#if defined REPLACE_MODEL_NATIVE
if(TrieKeyExists(g_sReplaceResourcesList, model))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, model, tmpResource, charsmax(tmpResource));
if (strlen(tmpResource) != 0)
{
forward_return(FMV_CELL, engfunc(EngFunc_ModelIndex, tmpResource));
}
else
{
#if defined FORCE_SKIP_RESOURECES
forward_return(FMV_CELL, 0);
return FMRES_SUPERCEDE;
#else
forward_return(FMV_CELL, engfunc(EngFunc_ModelIndex, DEFAULT_MODEL_PATH));
#endif
}
return FMRES_SUPERCEDE;
}
#endif
return FMRES_IGNORED;
}
public CBasePlayerWeapon_DefaultDeploy_Pre(const pItem, szViewModel[], szWeaponModel[], iAnim, szAnimExt[], skiplocal)
{
#if defined REPLACE_MODEL_NATIVE
if (is_nullent(pItem))
return HC_CONTINUE;
if(TrieKeyExists(g_sReplaceResourcesList, szViewModel))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, szViewModel, tmpResource, charsmax(tmpResource));
if (strlen(tmpResource) == 0)
{
SetHookChainArg(2, ATYPE_STRING, DEFAULT_MODEL_PATH);
}
else
{
SetHookChainArg(2, ATYPE_STRING, tmpResource);
}
}
if(TrieKeyExists(g_sReplaceResourcesList, szWeaponModel))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, szWeaponModel, tmpResource, charsmax(tmpResource));
if (strlen(tmpResource) == 0)
{
SetHookChainArg(3, ATYPE_STRING, DEFAULT_MODEL_PATH);
}
else
{
SetHookChainArg(3, ATYPE_STRING, tmpResource);
}
}
#endif
return HC_CONTINUE;
}
public ClCorpse_pre()
{
#if defined REPLACE_MODEL_NATIVE
new id = get_msg_arg_int(12);
if(id < 1 || id > MAX_PLAYERS || !is_user_connected(id))
{
return;
}
new modelName[MAX_RESOURCE_PATH_LENGTH];
get_user_info(id, "model", modelName, charsmax(modelName));
new fullModelName[MAX_RESOURCE_PATH_LENGTH];
formatex(fullModelName,charsmax(fullModelName),"models/player/%s/%s.mdl",modelName,modelName);
if(TrieKeyExists(g_sReplaceResourcesList, fullModelName))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, fullModelName, tmpResource, charsmax(tmpResource));
if (strlen(tmpResource) == 0)
{
set_msg_arg_string(1, DEFAULT_MODEL_PATH);
}
else
{
set_msg_arg_string(1, tmpResource);
}
}
#endif
}
public FM_SetClientKeyValue_pre(id, infobuffer[], key[], value[])
{
#if defined REPLACE_MODEL_NATIVE
if( equal(key, "model") )
{
new fullModelName[MAX_RESOURCE_PATH_LENGTH];
formatex(fullModelName,charsmax(fullModelName),"models/player/%s/%s.mdl",value,value);
if(TrieKeyExists(g_sReplaceResourcesList, fullModelName))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, fullModelName, tmpResource, charsmax(tmpResource));
if (strlen(tmpResource) == 0)
{
set_user_info(id, key, DEFAULT_MODEL_PATH);
set_entvar(id,var_modelindex, engfunc(EngFunc_ModelIndex, DEFAULT_MODEL_PATH));
return FMRES_SUPERCEDE;
}
else
{
set_user_info(id, key, tmpResource);
set_entvar(id,var_modelindex, engfunc(EngFunc_ModelIndex, tmpResource));
return FMRES_SUPERCEDE;
}
}
}
#endif
return FMRES_IGNORED;
}
public FM_ClientUserInfoChanged_pre(const id)
{
#if defined REPLACE_MODEL_NATIVE
if(!is_user_alive(id))
{
return FMRES_IGNORED
}
new modelName[MAX_RESOURCE_PATH_LENGTH];
get_user_info(id, "model", modelName, charsmax(modelName));
new fullModelName[MAX_RESOURCE_PATH_LENGTH];
formatex(fullModelName,charsmax(fullModelName),"models/player/%s/%s.mdl",modelName,modelName);
if(TrieKeyExists(g_sReplaceResourcesList, fullModelName))
{
new tmpResource[128];
TrieGetString(g_sReplaceResourcesList, fullModelName, tmpResource, charsmax(tmpResource));
if (strlen(tmpResource) == 0)
{
set_user_info(id, "model", DEFAULT_MODEL_PATH);
set_entvar(id,var_modelindex, engfunc(EngFunc_ModelIndex, DEFAULT_MODEL_PATH));
return FMRES_SUPERCEDE;
}
else
{
set_user_info(id, "model", tmpResource);
set_entvar(id,var_modelindex, engfunc(EngFunc_ModelIndex, tmpResource));
return FMRES_SUPERCEDE;
}
}
#endif
return FMRES_IGNORED;
}
I have added the files like this in "unprecache_list.cfg" :
add_replace_model models/w_shield.mdl
add_replace_model models/p_shield.mdl
add_replace_model models/w_shield.mdl
add_replace_model models/p_shield.mdl
В этой теме было размещено решение! Перейти к решению.