AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   CS GO: Remove Knife ! (https://forums.alliedmods.net/showthread.php?t=276628)

arbol 12-24-2015 20:11

CS GO: Remove Knife !
 
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 :P ) :
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/
https://forums.alliedmods.net/data:i...AAAElFTkSuQmCC

Dr. Greg House 12-24-2015 20:27

Re: CS GO: Remove Knife !
 
Is there a way to hide the knife,
without corrupting our model?
The blessing comes in a disguise,
transparency you should now toggle!

arbol 12-24-2015 21:47

Re: CS GO: Remove Knife !
 
Thanks for your reply, although i cannot decipher exactly what you mean.

Should i toggle transparency ? when ?

I appreciate your help.
Merry Christmas !

bally 12-25-2015 18:48

Re: CS GO: Remove Knife !
 
Quote:

Originally Posted by arbol (Post 2376016)
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


arbol 12-27-2015 11:14

Re: CS GO: Remove Knife !
 
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 !

Addicted. 12-27-2015 14:25

Re: CS GO: Remove Knife !
 
Your image doesn't work.

apocalyptic 01-13-2016 00:21

Re: CS GO: Remove Knife !
 
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


All times are GMT -4. The time now is 03:59.

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