Raised This Month: $32 Target: $400
 8% 

[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 , 09: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);
	}
}
__________________
Do not Private Message @me
Bacardi is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-12-2017 , 15: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
Member
Join Date: Jan 2012
Location: Germany
Old 11-12-2017 , 17: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
Old 11-12-2017 , 17: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 , 18: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 18:18.
rodrigo286 is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-13-2017 , 10: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 , 15: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 15:47.
rodrigo286 is offline
Qes
AlliedModders Donor
Join Date: Jul 2014
Old 03-02-2018 , 06:34   Re: [CSGO] Hide and Show player weapon world model (weapon on hands)
Reply With Quote #8

How I can hide world weapon on give player? (not all players)
Qes 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 05:00.


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