Raised This Month: $ Target: $400
 0% 

How to check if enemy was killed trough walls?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pob18
Member
Join Date: Jun 2014
Old 07-01-2014 , 10:15   How to check if enemy was killed trough walls?
Reply With Quote #1

Okay, so I have this code and I want to add more stuff!
Check if the player killed the enemy trough a wall, is it possible?

PHP Code:
#include <amxmodx>
#include <fun>
#include <dhudmessage>

new nKiller

public plugin_init()
{
    
register_event("DeathMsg""hook_death""a""1>0")     
}

public 
hook_death()
{
    
nKiller read_data(1)

// CHECK WALL?
// DO STUFF...

    
if ( (read_data(3) == 1) && (read_data(5) == 0) )
    {
        
screenFade()
        
set_dhudmessage(1001000, -1.00.1511.01.00.10.1)
        
show_dhudmessage(nKiller"HEADSHOT")
    }
    else
        
screenFade()
}

public 
screenFade()
{
    
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, nKiller)
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(0x0000)
    
write_byte(255)
    
write_byte(0)
    
write_byte(0)
    
write_byte(100)
    
message_end()


Last edited by pob18; 07-01-2014 at 10:16.
pob18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 11:19   Re: How to check if enemy was killed trough walls?
Reply With Quote #2

You can use the is_visible native. Search the internet, you will find info.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
pob18
Member
Join Date: Jun 2014
Old 07-01-2014 , 11:36   Re: How to check if enemy was killed trough walls?
Reply With Quote #3

I searched but nothing found that can help me resolve/make this
pob18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 12:23   Re: How to check if enemy was killed trough walls?
Reply With Quote #4

http://amxmodx.org/doc/index.html?pa...is_visible.htm
http://www.amx-x.ru/viewtopic.php?f=8&t=9682
Simpl, you have to include engine and the check should look like this:
PHP Code:
if(is_visible(nKillerread_data(2))){} 
This checks if the victim was visible for the killer during the kill.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
pob18
Member
Join Date: Jun 2014
Old 07-01-2014 , 13:57   Re: How to check if enemy was killed trough walls?
Reply With Quote #5

What I'm doing wrong? If the enemy kills me trough a wall, the message displays "not visible", but if is visible the message stills the same.

PHP Code:
public hook_death()
{
    if(!
is_visible(nKillerread_data(2)))
    {
        
client_print(0,print_chat,"not visible")
    
    }  
    
    if(
is_visible(nKillerread_data(2)))
    {
        
client_print(0,print_chat,"visible")
    
    }  

    if ( (
read_data(3) == 1) && (read_data(5) == 0) )
    {
        
screenFade()
        
set_dhudmessage(RGB, -1.00.1511.01.00.10.1)
        
show_dhudmessage(nKiller"headshot")
    }
    else
        
screenFade()

pob18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 14:03   Re: How to check if enemy was killed trough walls?
Reply With Quote #6

I can't see anything wrong with the code. Just a note, use else, because with "else" you won't force the engine to check again the conditions. Also, you have to know that you have to be FULLY visible, otherwise you are still invisible.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
pob18
Member
Join Date: Jun 2014
Old 07-01-2014 , 14:06   Re: How to check if enemy was killed trough walls?
Reply With Quote #7

But what I need, is when you kill the enemy trought a wall (not visible) print message "not visible", else if visible (not trought wall) print "visible"
pob18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 14:08   Re: How to check if enemy was killed trough walls?
Reply With Quote #8

I understand this. But, as far as I know, you are still invisible if part of you is visible. You have to be the whole visible, so the engine will think you for visible.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
pob18
Member
Join Date: Jun 2014
Old 07-01-2014 , 14:10   Re: How to check if enemy was killed trough walls?
Reply With Quote #9

I don't understand
If possible to make a function, just when you kill someone trough a wall like a wallhack, do some stuff then?
pob18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 14:30   Re: How to check if enemy was killed trough walls?
Reply With Quote #10

This is your function. All I wanted to say is that you have to be FULLY visible, so is_visible will return possitive result (-> you are visible). If only some part of you is visible, then you are still not visible, and the message will be
"not visible".
__________________
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 21:13.


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