Raised This Month: $ Target: $400
 0% 

Solved Detect distance between Players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-08-2019 , 16:45   Re: Detect distance between Players
Reply With Quote #1

PHP Code:
public client_PreThink(id)
{
    if(!
is_user_alive(id)) return;
    static 
Float:myOrigin], Float:hisOrigin], players[32], szName[32], playeripnumFloat:fDistance;
    
pevidpev_originmyOrigin )

    
get_players(playerspnum"ah");
    for(
pnumi++)
    {
        
player players[i];

        if(
player == id) continue;
        
pev(playerpev_originhisOrigin)
        
fDistance get_distance_fmyOriginhisOrigin)

        if( 
fDistance <= 62.0)
        {
            
get_user_name(playerszName31);
            
client_print(id print_center"Distance to player entity(%s): %.2f"szNamefDistance)
        }

    }

using static instead of new much better in a forward called each fps.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-11-2019 at 10:31.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 17:17.


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