Raised This Month: $12 Target: $400
 3% 

CS GO: Remove Knife !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
arbol
Junior Member
Join Date: Sep 2013
Location: Argentina
Old 12-24-2015 , 20:11   CS GO: Remove Knife !
Reply With Quote #1

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/

Last edited by arbol; 12-24-2015 at 20:20.
arbol is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 12-24-2015 , 20:27   Re: CS GO: Remove Knife !
Reply With Quote #2

Is there a way to hide the knife,
without corrupting our model?
The blessing comes in a disguise,
transparency you should now toggle!
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.
Dr. Greg House is offline
arbol
Junior Member
Join Date: Sep 2013
Location: Argentina
Old 12-24-2015 , 21:47   Re: CS GO: Remove Knife !
Reply With Quote #3

Thanks for your reply, although i cannot decipher exactly what you mean.

Should i toggle transparency ? when ?

I appreciate your help.
Merry Christmas !
arbol is offline
bally
Senior Member
Join Date: Aug 2015
Old 12-25-2015 , 18:48   Re: CS GO: Remove Knife !
Reply With Quote #4

Quote:
Originally Posted by arbol View Post
Thanks for your reply, although i cannot decipher exactly what you mean.

Should i toggle transparency ? when ?

I appreciate your help.
Merry Christmas !
Olá,
PHP Code:
SetEntityRenderColor(int entityint rint gint bint a
__________________
Perhaps my lack of faith was my undoing,
bally is offline
arbol
Junior Member
Join Date: Sep 2013
Location: Argentina
Old 12-27-2015 , 11:14   Re: CS GO: Remove Knife !
Reply With Quote #5

Hi, I tried removing it by doing:
Code:
 public removeKnife(){
new entity = MaxClients+1;
while( (entity = FindEntityByClassname2(entity, &quot;weaponworldmodel&quot;)) != -1 )     {
       PrintToChatAll(&quot;ent_prev %d&quot; , entity);         
SetEntityRenderColor(entity, 0, 0, 0, 0);         
PrintToChatAll(&quot;ent %d&quot; , entity);     
}     
PrintToChatAll(&quot;removido weaponworldmodel&quot;); 
}
_
It didn't work. Next i tried this: After removing with the classic , working way:
Code:
 public removeKnife(){
 new entity = MaxClients+1;      
while( (entity = FindEntityByClassname2(entity, &quot;weaponworldmodel&quot;)) != -1 )     
{         
PrintToChatAll(&quot;ent_prev %d&quot; , entity);         
SetEntProp(entity, Prop_Send, &quot;m_nModelIndex&quot;, 0);         
PrintToChatAll(&quot;ent %d&quot; , entity);     
}     
PrintToChatAll(&quot;removido weaponworldmodel&quot;); 
}
_
Then, after invoking the removeKnife() function, i toggled invisibility to all players for a moment, then returned to visibility:
Code:
 for (new i = 1; i<MAXPLAYERS ; i++){
    if (!IsClientInGame(i) || (IsFakeClient(i))) continue;
    SetEntityRenderColor(i, 0, 0, 0, 0);
    SetEntityRenderColor(i, 255, 255, 255, 255);
    PrintToChat(i, &quot;handld.&quot;);
  }
It removed knife but still corrupts the custom player model. More help is appreciated please !
arbol is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 12-27-2015 , 14:25   Re: CS GO: Remove Knife !
Reply With Quote #6

Your image doesn't work.
Addicted. is offline
apocalyptic
Senior Member
Join Date: Feb 2013
Location: China
Old 01-13-2016 , 00:21   Re: CS GO: Remove Knife !
Reply With Quote #7

I don't know what do you mean "still corrupts the custom player model", but Bacardi provided us:
PHP Code:
public OnPluginStart()
{
   
RegConsoleCmd("sm_test"test);
}

public 
Action:test(userargs)
{
    new 
entity MaxClients+1;
    while( (
entity FindEntityByClassname(entity"weaponworldmodel")) != -)
    {
        
SetEntProp(entityProp_Send"m_nModelIndex"0);
    }

This can make all weapon models invisible, whatever it's in a player's hand or on a player's back.
But I need to make some specific weapons invisible, for example: only all terrorists' knives are invisible, but CTs' knives are normal.
"weaponworldmodel" entities have no "owner" so I cannot find out who owns it.
I need help too.
https://forums.alliedmods.net/showthread.php?t=272100
apocalyptic is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:37.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode