View Single Post
Nail
BANNED
Join Date: May 2008
Location: PetrovЪ GradЪ
Old 05-09-2011 , 06:22   Re: [Tutorial] Creating brush entities
Reply With Quote #43

I created Func_button
PHP Code:
    new entindex CreateEntityByName("func_button");
    
PrecacheModel("models/props/cs_office/vending_machine.mdl"true);
    if (
entindex != -1)
    {
        
DispatchKeyValue(entindex"pushdir""0 90 0");
        
DispatchKeyValue(entindex"speed""500");
        
DispatchKeyValue(entindex"spawnflags""64");
        
DispatchKeyValue(entindex"OnPressed""!self,Use,,-1,-1");
        
DispatchKeyValue(entindex"Press""!self,Kill,,-1,-1");
        
DispatchKeyValue(entindex"OnPressed""!self,Kill,,-1,-1");
        
DispatchKeyValue(entindex"OnIn""!self,Kill,,-1,-1");
        
DispatchKeyValue(entindex"OnOut""!self,Kill,,-1,-1");
        
DispatchKeyValue(entindex"OnPlayerUse""!self,Kill,,-1,-1");
        
HookSingleEntityOutput(entindex"OnPressed"buttUsetrue);
    }

    
DispatchSpawn(entindex);
    
ActivateEntity(entindex);

    
TeleportEntity(entindexendnormalNULL_VECTOR);
    
    
SetEntityModel(entindex"models/props/cs_office/vending_machine.mdl");

    new 
Float:minbounds[3] = {-100.0, -100.00.0};
    new 
Float:maxbounds[3] = {100.0100.0200.0};
    
SetEntPropVector(entindexProp_Send"m_vecMins"minbounds);
    
SetEntPropVector(entindexProp_Send"m_vecMaxs"maxbounds);
    
    
SetEntProp(entindexProp_Send"m_nSolidType"2);

    new 
enteffects GetEntProp(entindexProp_Send"m_fEffects");
    
enteffects |= 32;
    
SetEntProp(entindexProp_Send"m_fEffects"enteffects); 
But OnPressed, OnIn, OnPlayerUse does not work, why can this be?
Nail is offline