AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to check is player falling (https://forums.alliedmods.net/showthread.php?t=249261)

Decak 10-03-2014 10:10

How to check is player falling
 
Hello.I have a 1 simple question.How to check if a player falling while he jumping?? Example:
I jumped , and now, I'm going up, and then, I start falling. I need time while player falling , if someone know how to check is player falling, please, help :) Goodbye.

Kuma77 10-03-2014 10:50

Re: How to check is player falling
 
sorry i was know how to get speed falling i mean ( when player fall down what is his speed .. ! ) but i forget that 'couse was'nt my code , so thats mean this guys can help you

klippy 10-03-2014 11:54

Re: How to check is player falling
 
Check if
PHP Code:

new FloatfFallVelocity;
pev(indexpev_flFallVelocityfFallVelocity); 

is greater than 0.0. Or, you could use the code below
PHP Code:

new FloatfVelocity[3];
pev(indexpev_velocityfVelocity); 

then check if fVelocity[2] is lesser than 0.0.

HamletEagle 10-03-2014 11:56

Re: How to check is player falling
 
If you only need the time, you may try this:
1. Hook Ham_Jump and cache get_gametime value.
2. Enable a touch forward between the player and the worldspawn.
3. In the Ham forward above check if the player is on ground( FL_ONGROUND ), then use get_gametime again.
4. Disable the Ham_Touch forward.
5. The time while the player was in the air is the difference between them.

I don't quite understood what you want, but you may also check m_flFallVelocity offset.

Decak 10-03-2014 12:43

Re: How to check is player falling
 
Thanks you gays, a pogotovo tebi klippy bog ti pomogo hahah :D

Strick3n 10-03-2014 16:17

Re: How to check is player falling
 
Quote:

Originally Posted by Decak (Post 2206572)
Thanks you gays, a pogotovo tebi klippy bog ti pomogo hahah :D

hahahahaha

Strick3n 10-03-2014 16:28

Re: How to check is player falling
 
you can check v3x's plugin
https://forums.alliedmods.net/showthread.php?t=23824

hornet 10-03-2014 23:55

Re: How to check is player falling
 
Quote:

Originally Posted by Strick3n (Post 2206655)

Don't use that plugin for this - it's old, and it's very inefficient + badly coded.

HamletEagle 10-04-2014 09:41

Re: How to check is player falling
 
Quote:

Originally Posted by hornet (Post 2206779)
Don't use that plugin for this - it's old, and it's very inefficient + badly coded.

What you would suggest as an alternative ? I'm thinking of hooking TakeDamage, checking if player is falling and setting the damage to 0.0

aron9forever 10-04-2014 12:55

Re: How to check is player falling
 
PHP Code:

public client_PreThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE
    
    
if(entity_get_float(idEV_FL_flFallVelocity) >= FALL_VELOCITY) {
      
falling[id] = true;
    } 
    else {
      
falling[id] = false;
    }
    
    return 
PLUGIN_CONTINUE
}

#define FALL_VELOCITY 350.0 

only workz on 800grav srv


All times are GMT -4. The time now is 17:41.

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