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

entity hook


Post New Thread Reply   
 
Thread Tools Display Modes
Teamkiller324
Senior Member
Join Date: Feb 2014
Location: Earth
Old 08-13-2020 , 00:45   Re: entity hook
Reply With Quote #11

PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    
PrintToServer("Debug: Checking if entity is item_healthkit_small");
    if (
StrEqual(classname"item_healthkit_small"))
        
SDKHook(entitySDKHook_SpawnPostHealthKit);


public 
void HealthKit(int entity)
{
    
char model[PLATFORM_MAX_PATH];
    
PrintToServer("Debug: Getting entity name..");
    
GetEntPropString(entityProp_Data"m_ModelName"modelsizeof(model));
    
PrintToServer("Debug: m_ModelName returned %s"model);
    
PrintToServer("Debug: Checking if entity is item_healthkit_small once again to make sure..");
    if(
StrEqual(model"item_healthkit_small"))
    {
        
SetEntityModel(entity"models/items/zelda/medkit_small.mdl");
        
PrintToServer("Debug: Set the model to \"models/items/zelda/medkit_small.mdl\"");
    }

Console:

Debug: Checking if entity is item_healthkit_small
Debug: Getting entity name..
Debug: m_ModelName returned models/items/medkit_small.mdl
Debug: Checking if entity is item_healthkit_small once again to make sure..
__________________

Last edited by Teamkiller324; 08-13-2020 at 00:46.
Teamkiller324 is offline
Teamkiller324
Senior Member
Join Date: Feb 2014
Location: Earth
Old 08-13-2020 , 00:56   Re: entity hook
Reply With Quote #12

Edited one bit (wich was obvious), the previous was just for testing
PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    
PrintToServer("Debug: Checking if entity is item_healthkit_small");
    if (
StrEqual(classname"item_healthkit_small"))
        
SDKHook(entitySDKHook_SpawnPostHealthKit);


public 
void HealthKit(int entity)
{
    
char model[PLATFORM_MAX_PATH];
    
PrintToServer("Debug: Getting entity name..");
    
GetEntPropString(entityProp_Data"m_ModelName"modelsizeof(model));
    
PrintToServer("Debug: m_ModelName returned %s"model);
    
PrintToServer("Debug: Checking if entity is item_healthkit_small once again to make sure..");
    if(
StrEqual(model"models/items/medkit_small.mdl"))
    {
        
SetEntityModel(entity"models/items/zelda/medkit_small.mdl");
        
PrintToServer("Debug: Set the model to \"models/items/zelda/medkit_small.mdl\"");
    }

Console:

Debug: Checking if entity is item_healthkit_small
Debug: Getting entity name..
Debug: m_ModelName returned models/items/medkit_small.mdl
Debug: Checking if entity is item_healthkit_small once again to make sure..
Debug: Set the model to "models/items/zelda/medkit_small.mdl"

models still not changed :/
__________________

Last edited by Teamkiller324; 08-13-2020 at 01:01.
Teamkiller324 is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 08-13-2020 , 03:10   Re: entity hook
Reply With Quote #13

Well, maybe get the position of the existing entity, than remove it and create/spawn your custom one.....
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Reply



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 22:37.


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