Raised This Month: $ Target: $400
 0% 

_BBOX crashes server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DavidLin
Member
Join Date: Jan 2016
Old 01-14-2016 , 11:32   _BBOX crashes server
Reply With Quote #1

When entity is tossed up ( above player ) the server crashes without any errors, when I changed entity solid type to _TRIGGER it works fine but I can't pick it up or do damage to it.

PHP Code:
public throwstickid ) {
        new 
Float:Origin], Float:Velocity], Float:Angles], Float:FAngles];
        
entity_get_vectoridEV_VEC_originOrigin );
        
velocity_by_aimid64Angles )
        
vector_to_angleAnglesFAngles );

        
FAngles] = 0.0;
        
Origin] += Angles];
        
Origin] += Angles];
        
Origin] += Angles];

        new 
entity_stick create_entity"info_target" );
        
entity_set_stringentity_stickEV_SZ_classnameentity_name );
        
entity_set_vectorentity_stickEV_VEC_anglesFAngles );
        
entity_set_intentity_stickEV_INT_solidSOLID_BBOX );
        
entity_set_intentity_stickEV_INT_movetypeMOVETYPE_TOSS );
        
entity_set_originentity_stickOrigin );
        
entity_set_modelentity_stickgModel );
        
entity_set_sizeentity_stickminModelmaxModel );
        
entity_set_floatentity_stickEV_FL_takedamage1.0 );
        
entity_set_floatentity_stickEV_FL_gravity0.8 ); 
        
entity_set_floatentity_stickEV_FL_healthget_pcvar_floatstick_health ) );
        
set_peventity_stickpev_iuser2id );

        
entity_set_intentity_stickEV_INT_renderfxkRenderFxGlowShell );
        
entity_set_vectorentity_stickEV_VEC_rendercolorFloat:{ 221.0173.0237.0 } );

        
velocity_by_aimid600Velocity );
        
entity_set_vectorentity_stickEV_VEC_velocityVelocity );
        
has_stickid ] = false;


Last edited by DavidLin; 01-14-2016 at 11:33.
DavidLin is offline
DavidLin
Member
Join Date: Jan 2016
Old 01-14-2016 , 13:04   Re: _BBOX crashes server
Reply With Quote #2

So I discovered if an entity was thrown above it takes damage when it falls and this crashes server because of fall damage, is it possible to disable fall damage for an entity ?

EDIT: it crashes from knife kill too

Last edited by DavidLin; 01-14-2016 at 13:06.
DavidLin is offline
Hunter4all
Junior Member
Join Date: Aug 2010
Old 05-27-2016 , 02:38   Re: _BBOX crashes server
Reply With Quote #3

ok so i have the same problem too..

Server crashes when an entity is killed with a knife.
but with any other weapons it doesnt crash.
Can someone explain me why ?
Hunter4all is offline
Whitez
Member
Join Date: Apr 2016
Location: London, UK
Old 05-27-2016 , 17:17   Re: _BBOX crashes server
Reply With Quote #4

Register TakeDamage and check for entity class name
The code to disable damage from falling can be found somewhere around the forum
Whitez is offline
SpannerSpammer
Member
Join Date: Mar 2006
Old 05-28-2016 , 11:37   Re: _BBOX crashes server
Reply With Quote #5

The problem when you create a custom entity in goldsrc and enable takedamage is
that the engine will automatically kill the entity when it's health is less than zero.

You DO NOT want this to happen, you want to fully control when your
custom entity gets removed. To do this you need to set a health mask with
a high enough value that no weapon/explosive in-game can easily destroy it.

Code:
#define HEALTH_MASK  1000000.0
.
.
entity_set_float( entity_stick, EV_FL_health, HEALTH_MASK );
Then, check the health in some function, usually it's think function or a hooked
Takedamage function and then evaluate whether or not you need to kill the entity.
If you do, then perform whatever code cleanup required and then kill the entity.

Code:
public StickThink( ent )
{
    static Float:flHealth;
    flHealth = get_pcvar_float( stick_health );
    if ( flHealth < 1.0 ) flHealth = 1.0;       // idiot proof your HP value
    if ( flHealth > 500.0 ) flHealth = 500.0;

    if ( entity_get_float( ent, EV_FL_health ) <= (HEALTH_MASK - flHealth) )
    {
        // do any code cleanup here
        //
        // new id = entity_get_int( ent, EV_INT_iuser2 );
        // if ( SomeIsValidPlayerIDFunction(id) )   
        //        client_print( id, print_chat, "Your stick was destroyed" );

        remove_entity( ent );
        return PLUGIN_CONTINUE;
    }
    .
    .
    .
    return PLUGIN_CONTINUE;
}
One last thing: If you use CVARs or load settings from a configuration file, don't
plug these values directly into your code. You need to idiot proof these values
before plugging them in, because an invalid setting can sometimes have unpredictable
results, like crashing the server.
__________________
[NeoTF|DEV]SpannerSpammer-[AoE]-
NeoTF Development Team.
http://steamcommunity.com/groups/neotf
SpannerSpammer 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 23:13.


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