AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Make a player jump on a ball (NBA Jam Mod) (https://forums.alliedmods.net/showthread.php?t=153667)

mabaclu 03-27-2011 10:32

Make a player jump on a ball (NBA Jam Mod)
 
Hello,
I've finished a CS mod called NBAJam where people can play basketball. Players can dribble the ball by throwing it to the ground and jumping over it (ball hop).
The problem is that when I transfered the plugin from my local dedicated server to a public one I noticed that sometimes (maybe 1 in each 6 dribbles) the player isn't able to jump over the ball.
I've stolen the jump code from a bunnyhop plugin:
PHP Code:

if ( !(flags FL_ONGROUND) )
                return 
PLUGIN_CONTINUE
static iOwneriOwner pevg_iBallpev_iuser1 );
                
                new 
Float:velocity[3]
                
entity_get_vector(idEV_VEC_velocityvelocity)
                
velocity[2] += 250.0
                entity_set_vector
(idEV_VEC_velocityvelocity)
                
entity_set_int(idEV_INT_gaitsequence6)    // Play the Jump Animation 

I don't know if this is a lag problem but please help me to solve it. If you didn't understand what I wrote please PM me and I'll give you my server IP so you can test it yourself. Thanks.

mabaclu 04-11-2011 09:26

Re: Make a player jump on a ball (NBA Jam Mod)
 
bump

kotinha 04-12-2011 07:06

Re: Make a player jump on a ball (NBA Jam Mod)
 
Help him, this mod looks nice, I want to play it :grrr:

One 04-12-2011 09:09

Re: Make a player jump on a ball (NBA Jam Mod)
 
r u using client_prethink?

mabaclu 04-12-2011 11:14

Re: Make a player jump on a ball (NBA Jam Mod)
 
I have already used client_prethink but then I changed to:
register_forward(FM_PlayerPreThink, "PlayerPreThink", 0)

And it still didn't work.

One 04-12-2011 12:04

Re: Make a player jump on a ball (NBA Jam Mod)
 
try it with Ham_Player_Jump.

idk if this helps but i had the same problem with prethink.

i hope it helps.

mabaclu 04-12-2011 12:09

Re: Make a player jump on a ball (NBA Jam Mod)
 
Thanks, I'm going to try it now. Anyway I must say that I've made some more tests in my dedicated server and I had the problem. So it seems the bug also occurs in my local server.

mabaclu 04-12-2011 12:37

Re: Make a player jump on a ball (NBA Jam Mod)
 
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 06-25-2012 17:33

Re: Make a player jump on a ball (NBA Jam Mod)
 
bump


All times are GMT -4. The time now is 14:38.

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