View Single Post
mabaclu
Senior Member
Join Date: Jun 2010
Location: Portugal
Old 04-12-2011 , 12:37   Re: Make a player jump on a ball (NBA Jam Mod)
Reply With Quote #8

It's still not working.

Here's the ball brain (coded by xPaw):
PHP Code:
// BALL BRAIN :)
////////////////////////////////////////////////////////////
public FwdThinkBalliEntity ) {
if( !
is_valid_entg_iBall ) )
    return 
PLUGIN_HANDLED;

entity_set_floatiEntityEV_FL_nextthinkhalflife_time( ) + 0.001 ); // o original dizia 0.05

static Float:vOrigin], Float:vBallVelocity];
entity_get_vectoriEntityEV_VEC_originvOrigin );
entity_get_vectoriEntityEV_VEC_velocityvBallVelocity );

static 
iOwneriOwner peviEntitypev_iuser1 );
static 
iSolidiSolid peviEntitypev_solid );

// Trail --- >
static Float:flGametimeFloat:flLastThink;
flGametime get_gametime( );

if( 
flLastThink flGametime ) {
    if( 
floatroundvector_lengthvBallVelocity ) ) > 10 ) {
        
message_beginMSG_BROADCASTSVC_TEMPENTITY );
        
write_byteTE_KILLBEAM );
        
write_shortg_iBall );
        
message_end( );
        
        
message_beginMSG_BROADCASTSVC_TEMPENTITY );
        
write_byteTE_BEAMFOLLOW );
        
write_shortg_iBall );
        
write_shortg_iTrailSprite );
        
write_byte10 );
        
write_byte10 );
        
write_byte);
        
write_byte50 );
        
write_byte255 );
        
write_byte200 );
        
message_end( );
    }
    
    
flLastThink flGametime 3.0;
}
// Trail --- <

if( iOwner ) {
    static 
Float:vOwnerOrigin];
    
entity_get_vectoriOwnerEV_VEC_originvOwnerOrigin );
    
    static const 
Float:vVelocity] = { 1.01.00.0 };
    
    if( !
is_user_aliveiOwner ) ) {
        
entity_set_intiEntityEV_INT_iuser1);
        
        
vOwnerOrigin] += 5.0;
        
        
entity_set_originiEntityvOwnerOrigin );
        
entity_set_vectoriEntityEV_VEC_velocityvVelocity );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
iSolid != SOLID_NOT )
        
set_peviEntitypev_solidSOLID_NOT );
    
    static 
Float:vAngles], Float:vReturn];
    
entity_get_vectoriOwnerEV_VEC_v_anglevAngles );
    
    
vReturn] = ( floatcosvAngles], degrees ) * 55.0 ) + vOwnerOrigin];
    
vReturn] = ( floatsinvAngles], degrees ) * 55.0 ) + vOwnerOrigin];
    
vReturn] = vOwnerOrigin];
    
vReturn] -= ( entity_get_intiOwnerEV_INT_flags ) & FL_DUCKING ) ? 10 30;
    
    
entity_set_vectoriEntityEV_VEC_velocityvVelocity );
    
entity_set_originiEntityvReturn );
    } else {
    if( 
iSolid != SOLID_BBOX )
        
set_peviEntitypev_solidSOLID_BBOX );
    
    static 
Float:flLastVerticalOrigin;
    
    if( 
vBallVelocity] == 0.0 ) {
        static 
iCounts;
        
        if( 
flLastVerticalOrigin vOrigin] ) {
            
iCounts++;
            
            if( 
iCounts 10 ) {
                
iCounts 0;
                
                
UpdateBall);
            }
            } else {
            
iCounts 0;
            
            if( 
PointContentsvOrigin ) != CONTENTS_EMPTY )
                
UpdateBall);
        }
        
        
flLastVerticalOrigin vOrigin];
    }
}

return 
PLUGIN_CONTINUE;

__________________
mabaclu is offline