View Single Post
Author Message
BeNq!
Senior Member
Join Date: Mar 2009
Old 11-06-2021 , 12:38   Molotov w_ model problem
Reply With Quote #1

Hello,

I have a problem with the molotov w_ model. I'm used this code:

Code:
public void OnEntityCreated( int entity, const char[] classname )
{
	if( IsValidEntity( entity ) ) 
		SDKHook( entity, SDKHook_SpawnPost, OnEntitySpawned );
}

public void OnEntitySpawned( int entity )
{
	char class_name[ 64 ];
	GetEntityClassname( entity, class_name, 64 );
	
	int owner = GetEntPropEnt( entity, Prop_Data, "m_hOwnerEntity" );
	
	if( StrContains( class_name, "projectile" ) != -1 && IsValidEntity( entity ) && IsValidClient( owner ) )
	{
		if( StrContains( class_name, "hegrenade" ) != -1 )
		{			
			SetEntityModel( entity, "models/testmodel/w_red.mdl" );
			PrintToChatAll( "test red %i", entity );
		}
		else if( StrContains( class_name, "decoy" ) != -1 )
		{
			SetEntityModel( entity, "models/testmodel/w_blue.mdl" );
		}
		else if( StrContains( class_name, "incgrenade" ) != -1 )
		{
			SetEntityModel( entity, "models/testmodel/w_orange.mdl");
			PrintToChatAll( "test orange %i", entity );
		}
		
		else if( StrContains( class_name, "molotov" ) != -1 )
		{
			SetEntityModel( entity, "models/testmodel/w_yellow.mdl");
			PrintToChatAll( "test yellow %i", entity );
		}
	}
}
What's problem? Grenade i.e. hegren and decoy works ( model works ) but incegrenade and molotov is showing original model ( models don't change ). Where did I go wrong? Maybe it is impossible to change the model of incendiary grenades?
BeNq! is offline