Raised This Month: $134 Target: $400
 33% 

[CSGO] Hide and Show player weapon world model (weapon on hands)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-05-2017 , 10:49   [CSGO] Hide and Show player weapon world model (weapon on hands)
Reply With Quote #1

Snip

Hide player weapon from hands.


PHP Code:
/*
 * Replace weapon weaponworldmodel-entity model with null model (csgo)
 *
*/
stock bool weaponworldmodel_hide(int weapon)
{
    
// Hide player weaponworldmodel with null model
    
int model PrecacheModel("models/props_doors/null.mdl");

    if(
model == 0)
    {
        
LogError("weaponworldmodel_hide(weapon) - error precache model 'models/props_doors/null.mdl'");
        return 
false//error
    
}


    
int weaponworldmodel GetEntPropEnt(weaponProp_Send"m_hWeaponWorldModel");

    if(
weaponworldmodel == -1)
    {
        return 
false;
    }

    
SetEntProp(weaponworldmodelProp_Send"m_nModelIndex"model);
    return 
true;
}


/*
 * Set weapon weaponworlmodel-entity model back with weapon worldmodel index
 *
*/
stock bool weaponworldmodel_show(int weapon)
{
    
// Show player weaponworldmodel model
    
int weaponworldmodel GetEntPropEnt(weaponProp_Send"m_hWeaponWorldModel");

    if(
weaponworldmodel == -1)
    {
        return 
false;
    }


    
int model GetEntProp(weaponProp_Send"m_iWorldModelIndex");

    if(
model <= 0)
    {
        
LogError("weaponworldmodel_show(weapon) - error invalid model index");
        return 
false//error
    
}

    
SetEntProp(weaponworldmodelProp_Send"m_nModelIndex"model);

    return 
true;





How to use quick
Code:
hide_all_players_weapon()
{
	int entity = -1;
	while( (entity = FindEntityByClassname(entity, "weapon_*")) != -1 )
	{
		weaponworldmodel_hide(entity);
	}
}
__________________
Bacardi is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-12-2017 , 16:30   Re: [CSGO] Hide and Show player weapon world model (weapon on hands)
Reply With Quote #2

Thanks Barcardi, works perfectly.

Any way to hide viewmodel also?

I found some ways but any works correctly with customs arms model.

Thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
Ermert1992
Junior Member
Join Date: Jan 2012
Location: Germany
Old 11-12-2017 , 18:33   Re: [CSGO] Hide and Show player weapon world model (weapon on hands)
Reply With Quote #3

I've searched this and now i have it! Thank you!
Ermert1992 is offline
Mitchell
~lick~
Join Date: Mar 2010
Location: noitacoL:
Old 11-12-2017 , 18:34   Re: [CSGO] Hide and Show player weapon world model (weapon on hands)
Reply With Quote #4

Quote:
Originally Posted by rodrigo286 View Post
Thanks Barcardi, works perfectly.

Any way to hide viewmodel also?

I found some ways but any works correctly with customs arms model.

Thanks.
SetEntProp(client, Prop_Send, "m_bDrawViewmodel", false);
__________________
Mitchell is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-12-2017 , 19:17   Re: [CSGO] Hide and Show player weapon world model (weapon on hands)
Reply With Quote #5

Quote:
Originally Posted by Mitchell View Post
SetEntProp(client, Prop_Send, "m_bDrawViewmodel", false);
Thanks for help but this remove knife and custom zombie arms, i need remove only weapon model.

Screenshot:



My code:

PHP Code:
    SDKHook(clientSDKHook_WeaponCanUseOnWeaponCanUse);
    
DisarmPlayer(client);
    
GivePlayerItem(client"weapon_knife");
    
int weaponIndex GetEntPropEnt(clientProp_Send"m_hMyWeapons"client);
    while((
weaponIndex FindEntityByClassname(weaponIndex"weapon_*")) != -){weaponworldmodel_hide(weaponIndex);}
    
SetEntProp(clientProp_Send"m_bDrawViewmodel"false); 
Thanks for all help.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM

Last edited by rodrigo286; 11-12-2017 at 19:18.
rodrigo286 is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-13-2017 , 11:47   Re: [CSGO] Hide and Show player weapon world model (weapon on hands)
Reply With Quote #6

To work with this snip:

https://forums.alliedmods.net/showpo...29&postcount=1

Arms also include animations, i try import animations from other old hand skin but dont work property.

Any way if no need arms with animation?

Thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-13-2017 , 16:34   Re: [CSGO] Hide and Show player weapon world model (weapon on hands)
Reply With Quote #7

I edit stock ct knife model and made invisible version and get this.

It does not look very good, because the hand still holds the invisible knife.

I exists way to make hands open like left hand.

PHP Code:
public OnConfigsExecuted()
{
    
g_iSMGModel PrecacheModel("models/weapons/rodrigo286/v_inv_stock_knife/v_inv_stock_knife.mdl");

PHP Code:
public OnClientWeaponSwitchPost(clientwpnid)
{
    
decl String:szWpn[64];
    
GetEntityClassname(wpnid,szWpn,sizeof(szWpn));

    if(
StrEqual(szWpn"weapon_knife")){
        
SetEntProp(wpnidProp_Send"m_nModelIndex"0);
        
SetEntProp(clientProp_Send"m_nModelIndex"PrecacheModel("models/player/custom_player/kuristaja/walker/walkerv2.mdl"));
        
SetEntProp(g_PVMid[client], Prop_Send"m_nModelIndex"g_iSMGModel);
        
SetEntPropString(clientProp_Send"m_szArmsModel""models/player/custom_player/kuristaja/walker/walker_arms.mdl");
    }



Thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM

Last edited by rodrigo286; 11-13-2017 at 16:47.
rodrigo286 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 06:22.


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