Raised This Month: $ Target: $400
 0% 

Detect players origins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 09-05-2019 , 18:15   Re: Detect players origins
Reply With Quote #1

First time seeing client prethink without index...so its serverframe() ? Go with id there and loop
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-05-2019 , 18:39   Re: Detect players origins
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
 
public plugin_init() 
{     
    
set_task0.1 "FindPlayers" , .flags="b" );
}


public 
FindPlayers()
{
    new 
iPlayers32 ] , iNum iPlayer Float:fOrigin] , iEntity iEnemyCount szName32 ];
    
    
get_playersiPlayers iNum "ae" "CT" );

    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        
peviPlayer pev_origin fOrigin );
        
        
iEntity = -1;
        
iEnemyCount 0;
        
        while( ( 
iEntity engfuncEngFunc_FindEntityInSphere iEntity fOrigin 150.0 ) ) != )
        {
            if ( 
is_user_aliveiEntity ) && ( cs_get_user_teamiEntity ) == CS_TEAM_T ) )
                
iEnemyCount++;
        }
        
        if ( 
iEnemyCount >= )
        {
            
get_user_nameiPlayer szName charsmaxszName ) );
            
client_printprint_chat "%d enemies near %s" iEnemyCount szName );
        }
    }

__________________

Last edited by Bugsy; 09-07-2019 at 00:13.
Bugsy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-06-2019 , 06:38   Re: Detect players origins
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
 
public plugin_init() 
{     
    
set_task0.1 "FindPlayers" , .flags="b" );
}


public 
FindPlayers()
{
    new 
iPlayers32 ] , iNum iPlayer Float:fOrigin] , iEntity iEnemyCount szName32 ];
    
    
get_playersiPlayers iNum "ae" "CT" );

    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        
peviPlayer pev_origin fOrigin );
        
        
iEntity = -1;
        
iEnemyCount 0;
        
        while( ( 
iEntity engfuncEngFunc_FindEntityInSphere iEntity fOrigin 150.0 ) ) != )
        {
            if ( 
is_user_aliveiEntity ) && ( cs_get_user_teamiEntity ) == CS_TEAM_T ) )
                
iEnemyCount++;
        }
        
        if ( 
iEnemyCount >= )
        {
            
get_user_nameiPlayer szName charsmaxszName ) );
            
client_printprint_chat "%d enemies near %s" iEnemyCount szName );
        }
    }

The variables could be created globally to avoid creating every 10th of a second.
__________________
edon1337 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 17:19.


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