It's still not working.
Here's the ball brain (coded by xPaw):
PHP Code:
// BALL BRAIN :)
////////////////////////////////////////////////////////////
public FwdThinkBall( iEntity ) {
if( !is_valid_ent( g_iBall ) )
return PLUGIN_HANDLED;
entity_set_float( iEntity, EV_FL_nextthink, halflife_time( ) + 0.001 ); // o original dizia 0.05
static Float:vOrigin[ 3 ], Float:vBallVelocity[ 3 ];
entity_get_vector( iEntity, EV_VEC_origin, vOrigin );
entity_get_vector( iEntity, EV_VEC_velocity, vBallVelocity );
static iOwner; iOwner = pev( iEntity, pev_iuser1 );
static iSolid; iSolid = pev( iEntity, pev_solid );
// Trail --- >
static Float:flGametime, Float:flLastThink;
flGametime = get_gametime( );
if( flLastThink < flGametime ) {
if( floatround( vector_length( vBallVelocity ) ) > 10 ) {
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_KILLBEAM );
write_short( g_iBall );
message_end( );
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_BEAMFOLLOW );
write_short( g_iBall );
write_short( g_iTrailSprite );
write_byte( 10 );
write_byte( 10 );
write_byte( 0 );
write_byte( 50 );
write_byte( 255 );
write_byte( 200 );
message_end( );
}
flLastThink = flGametime + 3.0;
}
// Trail --- <
if( iOwner > 0 ) {
static Float:vOwnerOrigin[ 3 ];
entity_get_vector( iOwner, EV_VEC_origin, vOwnerOrigin );
static const Float:vVelocity[ 3 ] = { 1.0, 1.0, 0.0 };
if( !is_user_alive( iOwner ) ) {
entity_set_int( iEntity, EV_INT_iuser1, 0 );
vOwnerOrigin[ 2 ] += 5.0;
entity_set_origin( iEntity, vOwnerOrigin );
entity_set_vector( iEntity, EV_VEC_velocity, vVelocity );
return PLUGIN_CONTINUE;
}
if( iSolid != SOLID_NOT )
set_pev( iEntity, pev_solid, SOLID_NOT );
static Float:vAngles[ 3 ], Float:vReturn[ 3 ];
entity_get_vector( iOwner, EV_VEC_v_angle, vAngles );
vReturn[ 0 ] = ( floatcos( vAngles[ 1 ], degrees ) * 55.0 ) + vOwnerOrigin[ 0 ];
vReturn[ 1 ] = ( floatsin( vAngles[ 1 ], degrees ) * 55.0 ) + vOwnerOrigin[ 1 ];
vReturn[ 2 ] = vOwnerOrigin[ 2 ];
vReturn[ 2 ] -= ( entity_get_int( iOwner, EV_INT_flags ) & FL_DUCKING ) ? 10 : 30;
entity_set_vector( iEntity, EV_VEC_velocity, vVelocity );
entity_set_origin( iEntity, vReturn );
} else {
if( iSolid != SOLID_BBOX )
set_pev( iEntity, pev_solid, SOLID_BBOX );
static Float:flLastVerticalOrigin;
if( vBallVelocity[ 2 ] == 0.0 ) {
static iCounts;
if( flLastVerticalOrigin > vOrigin[ 2 ] ) {
iCounts++;
if( iCounts > 10 ) {
iCounts = 0;
UpdateBall( 0 );
}
} else {
iCounts = 0;
if( PointContents( vOrigin ) != CONTENTS_EMPTY )
UpdateBall( 0 );
}
flLastVerticalOrigin = vOrigin[ 2 ];
}
}
return PLUGIN_CONTINUE;
}
__________________