Hello.
I have a custom player model, which ideally wouldn't show a knife (i want the weapon to be transparent). See img below.
My previous strategy was to replace the knife with a small black dot, which worked till some SM versions ago.
My actual strategy is the following, which doesn't work:
Code:
public Action:Command_test(client, args) //..
{
for(new h = 1; h <= MaxClients; h++)
{
if(IsClientInGame(h))
{
SDKHookEx(h, SDKHook_PostThinkPost, OnPostThinkPost);
//SetEntProp(client, Prop_Send, "m_nRenderFX", RENDERFX_NONE);
//SetEntProp(client, Prop_Send, "m_nRenderMode", RENDER_NONE);
}
}
removeKnife();
}
public removeKnife(){
new entity = MaxClients+1;
while( (entity = FindEntityByClassname2(entity, "weaponworldmodel")) != -1 )
{
SetEntProp(entity, Prop_Send, "m_nModelIndex", 0);
}
PrintToChatAll("removido weaponworldmodel");
}
FindEntityByClassname2(sStartEnt, String:szClassname[])
{
while (sStartEnt > -1 && !IsValidEntity(sStartEnt)) sStartEnt--;
return FindEntityByClassname(sStartEnt, szClassname);
}
public OnPostThinkPost(client)
{
//SetEntProp(client, Prop_Send, "m_iPrimaryAddon", CSAddon_NONE);
//SetEntProp(client, Prop_Send, "m_iSecondaryAddon", CSAddon_NONE);
SetEntProp(client, Prop_Send, "m_iAddonBits", CSAddon_NONE);
}
I mean, it DOES remove the knife, but also corrupts the custom model somehow, making it buggy, showing the "ragdoll" stance randomly...
I also tried this (this one does nothing
) :
Code:
public PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client=GetClientOfUserId(GetEventInt(event, "userid"))
SetEntityRenderFx(client,RENDERFX_DISTORT)
new KnifeEnt=GetPlayerWeaponSlot(client,_:2)
if(KnifeEnt!=-1){
SetEntityRenderFx(KnifeEnt,RENDERFX_DISTORT)
SetEntProp(KnifeEnt, Prop_Send, "m_nModelIndex", 0) }
}
So the question: is there a way to hide the knife, without corrupting the custom player model ? why does removing the knife corrupts it anyway?
Thanks as always for your help
Merry christmas
http://************/image/kazzfvgnb/