Raised This Month: $ Target: $400
 0% 

[HELP] Get Enemy origin in Radius


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
m4m3ts
Senior Member
Join Date: Jun 2012
Old 11-15-2013 , 02:16   [HELP] Get Enemy origin in Radius
Reply With Quote #1

i trying to detect zombie around me, when i shooting.
i put the code on fw_TraceAttack, i using "print_chat" to test counting wrong or not.

i'm using this method to count zombie around me

PHP Code:
public fw_TraceAttack(iEntiAttackerFloat:flDamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(iAttacker))
        return
    if(
get_user_weapon(iAttacker) != CSW_M249)
        return
    
    new 
NearestZombie 0
    
for(new 0<= get_maxplayers(); i++)
    {
        if(
is_user_alive(i) && entity_range(iAttackeri) < 400.0 && zp_get_user_zombie(i))
        
NearestZombie ++
    }
    
    if(
NearestZombie == 0client_print(iAttackerprint_chat"0 Zombie Near You !")
    if(
NearestZombie == 1client_print(iAttackerprint_chat"1 Zombie Near You !")
    if(
NearestZombie == 2client_print(iAttackerprint_chat"2 Zombie Near You !")
    if(
NearestZombie == 3client_print(iAttackerprint_chat"3 Zombie Near You !")
    if(
NearestZombie == 4client_print(iAttackerprint_chat"4 Zombie Near You !")

it works well to detect zombie, but my question is:
how to get each zombie origin near me & count it ??


i try this but not work
Code:
new vOrigin[3]
pev(NearestZombie, pev_origin, vOrigin)
-----------------------------------------------
Note:

but when i change to this.
it's not work, counting zombie is wrong.

PHP Code:
public fw_TraceAttack(iEntiAttackerFloat:flDamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(iAttacker))
        return
    if(
get_user_weapon(iAttacker) != CSW_M249)
        return
    
    for(new 
0<= get_maxplayers(); i++)
    {
        if(!
is_user_alive(i))
            continue
        if(
entity_range(iAttackeri) > 400.0)
            continue
        if(!
zp_get_user_zombie(i))
            continue
            
        if(
== 0client_print(iAttackerprint_chat"0 Zombie Near You !")
        if(
== 1client_print(iAttackerprint_chat"1 Zombie Near You !")
        if(
== 2client_print(iAttackerprint_chat"2 Zombie Near You !")
        if(
== 3client_print(iAttackerprint_chat"3 Zombie Near You !")
        if(
== 4client_print(iAttackerprint_chat"4 Zombie Near You !")
    }


Last edited by m4m3ts; 11-15-2013 at 04:04.
m4m3ts is offline
 



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


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