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_CurrentFlags[ MAX_PLAYERS + 1 ];
public plugin_init()
{
RegisterHam( Ham_Spawn , "player" , "HamSpawn" , true );
set_task( 0.1 , "CheckPlayers" , .flags="b" );
}
PlayerInAir( id )
{
client_print( id , print_chat , "I am in the air" );
}
public HamSpawn( iPlayer )
{
if ( is_user_alive( iPlayer ) )
{
g_CurrentFlags[ iPlayer ] &= ~GroundFlags ;
}
}
public CheckPlayers()
{
static iPlayers[ 32 ] , iNum , iPlayer , i , iFlags;
get_players( iPlayers , iNum , "a" );
for ( i = 0 ; i < iNum ; i++ )
{
iPlayer = iPlayers[ i ];
iFlags = pev( iPlayer , pev_flags );
if ( ( g_CurrentFlags[ iPlayer ] & GroundFlags ) && !( iFlags & GroundFlags ) )
{
PlayerInAir( iPlayer );
}
g_CurrentFlags[ iPlayer ] = iFlags;
}
}
__________________