Hello,
I am currently working on a plugin which allows you to set custom clip sizes (the one you "use").
For that, I am using DHooks to hook CBaseCombatWeapon::GetMaxClip1.
It works mostly (the ammo is correctly overriden), but my main problem is that ALL weapons (primary, secondary, knife) become invisible when the plugin is active.
Upon unloading, they become fully visible again.
Relevant code:
PHP Code:
Handle gameConf = LoadGameConfigFile("clip_manager.games");
int offsetMax = GameConfGetOffset(gameConf, "GetMaxClip1");
delete gameConf;
g_hMaxClip1 = DHookCreate(offsetMax, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetClip1);
[..]
public void OnEntityCreated(int entity, const char[] classname)
{
if(StrContains(classname, "knife") == -1 && StrContains(classname, "grenade") == -1)
{
DHookEntity(g_hMaxClip1, true, entity, OnHookRemoved);
}
}
public MRESReturn OnGetClip1(int pThis, Handle hReturn)
{
DHookSetReturn(hReturn, 200);
return MRES_Supercede;
}
I already tried EntityRenderMode to NORMAL, but that doesn't change anything.
In the disassembly I have seen that the original function accesses the weapon script file, maybe I forgot to initialize something?
Any help would be appreciated!
</span>
__________________
Stopped hosting servers as of November 2018, no longer active around here.