Raised This Month: $ Target: $400
 0% 

First time landing (pev_flags) bug


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-30-2018 , 17:54   First time landing (pev_flags) bug
Reply With Quote #1

First of all, I know you'll ask why I didn't do any debugging, well, how am I supposed to?
Basically, this code checks 2 things:
- Player has landed on ground / in water, if so, stop changing his velocity
- Player's velocity[2] < 0.0, means he's still in the air

The problem is that sometimes even after I have landed on the ground, my velocity keeps getting changed (so check #2 gets executed)

Any ideas?
PHP Code:
public client_PreThinkid )
{
    if( ! 
is_user_aliveid ) )
    return 
PLUGIN_CONTINUE;
    
    if( 
g_bIsPlayerInParachuteid ] )
    {
        new 
Float:fVelocity]; 
        
pevidpev_velocityfVelocity ); 
        
        if( ! 
g_bLandedPlayerid ] && ( ( pevidpev_flags ) & FL_ONGROUND ) || ( pevidpev_flags ) & FL_INWATER ) ) ) // player has landed on ground/ in water
        
{
            
g_bIsPlayerInParachuteid ] = false// not in parachute anymore
            
set_pevidpev_sequencedetach );
            
set_pevidpev_movetypeMOVETYPE_WALK );
            
            
client_cmdid"spk sound/%s"g_iSoundsLanding_Sound ] ); // emit landing sound
            
            
g_bLandedPlayerid ] = true;
        }

        if( 
fVelocity] < 0.0 // still in air
        
{
            
fVelocity] = g_fCachedParachuteVelocity;
            
set_pevidpev_velocityfVelocity );
        } 
    }
    return 
PLUGIN_CONTINUE;

__________________
edon1337 is offline
 



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 12:28.


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