Raised This Month: $ Target: $400
 0% 

[HELP] Get Enemy origin in Radius


Post New Thread Reply   
 
Thread Tools Display Modes
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
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-15-2013 , 04:05   Re: [HELP] Get Enemy origin in Radius
Reply With Quote #2

Quote:
how to get each zombie origin near me & count it ??
You do it already in the first code.
__________________
Arkshine is offline
m4m3ts
Senior Member
Join Date: Jun 2012
Old 11-15-2013 , 04:57   Re: [HELP] Get Enemy origin in Radius
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
You do it already in the first code.
that only count zombie near me, not get origin of each zombie that near me.
m4m3ts is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 11-15-2013 , 05:04   Re: [HELP] Get Enemy origin in Radius
Reply With Quote #4

PHP Code:
new vOrigin[3]
pev(NearestZombiepev_originvOrigin
-->
PHP Code:
new Float:vOrigin[3]
pev(NearestZombiepev_originvOrigin
PHP Code:
for(new 0<= get_maxplayers(); i++) 
-->
PHP Code:
for(new 1<= get_maxplayers(); i++) 
__________________
alan_el_more 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 23:23.


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