Raised This Month: $ Target: $400
 0% 

[tf2] replace medikits models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jockersoft
Member
Join Date: Aug 2008
Old 05-06-2010 , 11:30   [tf2] replace medikits models
Reply With Quote #1

any idea why the following code correctly replaces the health kits models with the halloween ones, but only the item_healthkit_full gives heath to the player?
When you walk over the small and medium ones nothing happens.

PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>

#define MDL_KIT_FULL "models/props_halloween/pumpkin_loot.mdl"
#define MDL_KIT_MEDIUM "models/props_halloween/halloween_medkit_medium.mdl"
#define MDL_KIT_SMALL "models/props_halloween/halloween_medkit_small.mdl"

public OnPluginStart()
{
    
PrecacheModel(MDL_KIT_FULLtrue);
    
PrecacheModel(MDL_KIT_MEDIUMtrue);
    
PrecacheModel(MDL_KIT_SMALLtrue);
}

public 
OnEntityCreated(entity, const String:classname[])
{
    if(
StrEqual(classname"item_healthkit_full"))
        
SDKHook(entitySDKHook_SetTransmitOnEntitySpawned_Full);
    else if(
StrEqual(classname"item_healthkit_medium"))
        
SDKHook(entitySDKHook_SetTransmitOnEntitySpawned_Medium);
    else if(
StrEqual(classname"item_healthkit_small"))
        
SDKHook(entitySDKHook_SetTransmitOnEntitySpawned_Small);
}

public 
OnEntitySpawned_Full(entity)
{
    
SetEntityModel(entityMDL_KIT_FULL);
}

public 
OnEntitySpawned_Medium(entity)
{
    
SetEntityModel(entityMDL_KIT_MEDIUM);
}

public 
OnEntitySpawned_Small(entity)
{
    
SetEntityModel(entityMDL_KIT_SMALL);

i also tried using
PHP Code:
HookEntityOutput("item_healthkit_small",  "OnPlayerTouch",     EntityOutput_HealthKit); 
but EntityOutput_HealthKit doesn't get called
jockersoft is offline
rotab
Junior Member
Join Date: Dec 2005
Location: Sweden
Old 05-07-2010 , 13:24   Re: [tf2] replace medikits models
Reply With Quote #2

This is how i'm replacing small ammopacks with full ones.

PHP Code:
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
ent = -1;
    while((
ent FindEntityByClassname(ent"item_ammopack_small")) != -1)
    {
        new 
Float:Pos[3];
        
GetEntPropVector (entProp_Data"m_vecOrigin"Pos);
        
AcceptEntityInput(ent"Kill");
        
        
//create naow!
        
new ammopack CreateEntityByName("item_ammopack_full");
        
TeleportEntity(ammopackPosNULL_VECTORNULL_VECTOR);
        
DispatchSpawn(ammopack);
        
    }


Last edited by rotab; 05-07-2010 at 13:27.
rotab 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 00:30.


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