Raised This Month: $ Target: $400
 0% 

Teammate in range - help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-17-2008 , 08:47   Re: Teammate in range - help
Reply With Quote #2

This is a function that will help you find the closest teammate ->

PHP Code:
stock find_closest_team_mate(player,Float:radius)
{
    new 
id = -1
    
new Float:origin[3]
    new 
close = -1Float:minim 8908298.0
    pev
(player,pev_origin,origin)

    while ((
id engfunc(EngFunc_FindEntityInSphereidoriginradius)))
    {
        if (!
is_user_alive(id))
            continue
        if (!(
cs_get_user_team(id) == cs_get_user_team(player)))
            continue
        new 
Float:origin2[3]
        
pev(id,pev_origin,origin2)
        new 
Float:distanceFloat:difference[3]
        
xs_vec_sub(origin,origin2,difference)
        
distance xs_vec_len(difference)
        if (
distance minim)
        {
            
minim distance
            close 
id
        
}
    }

    return 
close    

Not tested but should work!
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 08-17-2008 at 08:55.
ot_207 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 03:06.


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