Raised This Month: $51 Target: $400
 12% 

how to execute a function if player is in air?


Post New Thread Reply   
 
Thread Tools Display Modes
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-02-2020 , 12:27   Re: how to execute a function if player is in air?
Reply With Quote #31

I already did that, I posted code to.
supertrio17 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-02-2020 , 20:01   Re: how to execute a function if player is in air?
Reply With Quote #32

Not perfect but it may work for you. When transitioning from flat land to a slope you are technically in the for a split second and it will trigger the function. Also, if someone spams the jump button it may not always catch it.
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

const GroundFlags = ( FL_ONGROUND FL_PARTIALGROUND FL_INWATER FL_CONVEYOR FL_FLOAT FL_FLY );

new 
g_CurrentFlagsMAX_PLAYERS ];

public 
plugin_init() 
{
    
RegisterHamHam_Spawn "player" "HamSpawn" true );
    
    
set_task0.1 "CheckPlayers" , .flags="b" );
}

PlayerInAirid )
{
    
client_printid print_chat "I am in the air" );
}

public 
HamSpawniPlayer )
{
    if ( 
is_user_aliveiPlayer ) )
    {
        
g_CurrentFlagsiPlayer ] &= ~GroundFlags ;
    }
}

public 
CheckPlayers()
{
    static 
iPlayers32 ] , iNum iPlayer iFlags;
    
    
get_playersiPlayers iNum "a" );
    
    for ( 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        
iFlags peviPlayer pev_flags );
        
        if ( ( 
g_CurrentFlagsiPlayer ] & GroundFlags ) && !( iFlags GroundFlags ) )
        {
            
PlayerInAiriPlayer );    
        }
        
        
g_CurrentFlagsiPlayer ] = iFlags;
    }

__________________

Last edited by Bugsy; 06-02-2020 at 20:03.
Bugsy 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 14:18.


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