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

How to check if the entity is the ground.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-26-2016 , 16:23   How to check if the entity is the ground.
Reply With Quote #1

I made this forward and I want to make the charge fail at every entity it interacts with.

register_touch("*", "player", "FailCharge"); // Charger has failed unfortunately...

I want to perform a check that if the player is touching the ground rather than a wall or something, it will not end the charge.
eyal282 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-26-2016 , 18:07   Re: How to check if the entity is the ground.
Reply With Quote #2

Ever heard of Ham_touch. ?
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-27-2016 , 01:01   Re: How to check if the entity is the ground.
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
Ever heard of Ham_touch. ?
No idea of difference.
eyal282 is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 10-27-2016 , 06:12   Re: How to check if the entity is the ground.
Reply With Quote #4

check pev_flags for FL_ONGROUND
jimaway is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-27-2016 , 07:30   Re: How to check if the entity is the ground.
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define TOUCHING_GROUND (1<<9)

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Touch"player""fw_player_touch_post"true)
}

public 
fw_player_touch_post(playerother)
{
    if(!
is_user_alive(player))
        return;

          
//method 1.
    
if(pev(playerpev_flags) & TOUCHING_GROUND)
    {
        
// continue the code...
    
}
    
    
// sec method but im not so sure, ithink the ground name is worldspawn
    
new sCname[32]
    
pev(otherpev_classnamesCnamecharsmax(sCname))
    if(
equal(sCname"worldspawn"))
    {
            
/// . ... . . .. 
    
}

code never tested...

Last edited by Natsheh; 10-27-2016 at 07:33.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-27-2016 , 09:40   Re: How to check if the entity is the ground.
Reply With Quote #6

Not what I need.

( I don't recall what you wrote so I'll edit in minutes )

The first one is checking if the entity is touching the ground, I want something to happen when entity touches anything that is not the ground, while it doesn't matter if the entity is on the ground.

Edit:

Huh, okay I'll try worldspawn.

Last edited by eyal282; 10-27-2016 at 09:41.
eyal282 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 09:52.


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