Raised This Month: $ Target: $400
 0% 

How to check an entity in water?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LudaGe
Senior Member
Join Date: May 2010
Location: World so cold
Old 02-19-2015 , 08:09   How to check an entity in water?
Reply With Quote #1

Hi all, someone knows how check an entity (No player) in water?
i tried this...
PHP Code:
// the entity is a grenade...

if ((pev(entitypev_flags) & FL_INWATER))

// and this too
if(get_pdata_int(entity96) & (1<<8) && pev(entitypev_waterlevel) >= 

// and:
if(get_entity_flags(entity) & FL_INWATER
But nothing works...

Last edited by LudaGe; 02-19-2015 at 08:14.
LudaGe is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-19-2015 , 10:52   Re: How to check an entity in water?
Reply With Quote #2

PHP Code:
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_touch("func_water""player""player_touch_water")
}

public 
player_touch_water(touchedtoucher)
{
    
// code...

# Requirement ( Engine )

@Jhob94
- he can just replace the player with the entity name that he want to check!

Last edited by Natsheh; 02-20-2015 at 14:39.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 02-19-2015 , 11:40   Re: How to check an entity in water?
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
PHP Code:
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_touch("func_water""player""player_touch_water")
}

public 
player_touch_water(touchedtoucher)
{
    
// code...

# Requirement ( Engine )
He said no player.

register_touch("func_water", "your_entity_classname", "EntityTouchWaterFunction")
__________________
Jhob94 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 02-19-2015 , 12:23   Re: How to check an entity in water?
Reply With Quote #4

Quote:
Originally Posted by Jhob94 View Post
He said no player.

register_touch("func_water", "your_entity_classname", "EntityTouchWaterFunction")
But that's a forward that is called on each frame while the entity is in the water. I guess he only wats to check on some exact moment if the entity is in water. And with pev_flags() should work... OP, you can probably show us how you do it? So there may be anything else wrong, not the check.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
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 12:56.


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