Dunno if this can work :
Reference :
http://forums.alliedmods.net/showthread.php?t=114407
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
const Float:PLAYER_FATAL_FALL_SPEED = 980.0 // approx 60 feet
const Float:PLAYER_MAX_SAFE_FALL_SPEED = 500.0 // approx 20 feet
#define DAMAGE_FOR_FALL_SPEED 100.0 / ( PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED ) // damage per unit per second.
const Float:PLAYER_MIN_BOUNCE_SPEED = 200.0
const Float:PLAYER_FALL_PUNCH_THRESHHOLD = 350.0 // won't punch player's screen/make scrape noise unless player falling at least this fast.
const XO_PLAYER = 5
const m_flFallVelocity = 251
public plugin_init()
{
register_plugin("Landing check damage", "0.1", "ConnorMcLeod")
RegisterHam(Ham_Player_PostThink, "CBasePlayer_PostThink")
}
// check to see if player landed hard enough to make a sound
// falling farther than half of the maximum safe distance, but not as far a max safe distance will
// play a bootscrape sound, and no damage will be inflicted. Fallling a distance shorter than half
// of maximum safe distance will make no sound. Falling farther than max safe distance will play a
// fallpain sound, and damage will be inflicted based on how far the player fell
public CBasePlayer_PostThink( id )
{
if( is_user_alive(id) && pev(id, pev_flags) & FL_ONGROUND )
{
new Float:flFallVelocity = get_pdata_float(id, m_flFallVelocity, XO_PLAYER)
if( flFallVelocity )
{
new iGroundEntity = pev(id, pev_groundentity)
new Float:flFallDamage
if ( flFallVelocity >= PLAYER_FALL_PUNCH_THRESHHOLD && pev(id, pev_watertype) != CONTENTS_WATER && flFallVelocity > PLAYER_MAX_SAFE_FALL_SPEED )
{
flFallDamage = DAMAGE_FOR_FALL_SPEED * ( flFallVelocity - PLAYER_MAX_SAFE_FALL_SPEED )
}
if( flFallDamage )
{
// player has landed on entity %d (iGroundEntity) (can be 0, lets check if it is a player) and is gonna take %f damage (set m_flFallVelocity to 0 if you want to remove fall damage)
}
else
{
// player has landed on entity %d (iGroundEntity) (can be 0, lets check if it is a player) and is not gonna take any damage (raise m_flFallVelocity if you want to add damage)
}
}
}
}
__________________