Raised This Month: $ Target: $400
 0% 

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


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 13:27.


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