Raised This Month: $ Target: $400
 0% 

Detecting falling without damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 11-05-2011 , 11:45   Detecting falling without damage
Reply With Quote #1

Is there any way to detect if a player landed on another player without taking damage from the fall?
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-05-2011 , 11:48   Re: Detecting falling without damage
Reply With Quote #2

you mean "even when he doesn't take damage" or "only when he doesn't take damage" ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-05-2011 , 12:02   Re: Detecting falling without damage
Reply With Quote #3

Probably a better way but could be accomplished with this, though not perfectly. Check health when player first off ground and again when landing, you would need checking if injured while in air by weapon. Can also take a look at jim_yangs post under mine.

http://forums.alliedmods.net/showpos...73&postcount=7
__________________

Last edited by Bugsy; 11-05-2011 at 12:06.
Bugsy is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 11-05-2011 , 14:12   Re: Detecting falling without damage
Reply With Quote #4

Don't know if this can help:

http://forums.alliedmods.net/showthread.php?p=915157

or this

http://forums.alliedmods.net/showthread.php?p=722032
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.

Last edited by bibu; 11-05-2011 at 14:13.
bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-05-2011 , 15:34   Re: Detecting falling without damage
Reply With Quote #5

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_PostThinkid )
{
    if( 
is_user_alive(id) && pev(idpev_flags) & FL_ONGROUND )
    {
        new 
Float:flFallVelocity get_pdata_float(idm_flFallVelocityXO_PLAYER)
        if( 
flFallVelocity )
        {
            new 
iGroundEntity pev(idpev_groundentity)
            new 
Float:flFallDamage
            
if ( flFallVelocity >= PLAYER_FALL_PUNCH_THRESHHOLD && pev(idpev_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)
            
}
        }
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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:16.


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