Raised This Month: $ Target: $400
 0% 

get_distance_f problem [ solved ]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 10-17-2014 , 15:37   get_distance_f problem [ solved ]
Reply With Quote #1

Hi, we meet again.
I have this little problem.

This is my code

PHP Code:
/* Plugin generated by AMXX-Studio */

    #include < amxmodx >
    #include < engine >
    #include < fun >
    
    #pragma semicolon 1
    
    
new const
        
PLUGIN_NAME[ ]         = "Blank Spawns",
        
PLUGIN_VERSION[ ]     = "1.0";
    
    new const
        
PLUGIN_TAG[ ]        = "|Plugin Tag:";
        
    
enum _:iSpawns
    
{
        
NULL,
        
TERO,
        
CT
    
}
    
    new 
Float:g_fOriginsiSpawns ][ 64 ][ ];
    new 
g_iSpawnsiSpawns ];
    
    
    new 
bool:g_bUserIsBlanked33 ];
            
public 
plugin_init( )
{
    
register_plugin
    
(
        
PLUGIN_NAME,
        
PLUGIN_VERSION,
        
"Askhanar"
    
);
    
    
GetSpawnsOrigins( );
    
// Add your code here...
    
}

public 
client_PreThinkid )
{
    if( !
is_user_aliveid ) )
        return;
        
    static 
Float:fOrigin];
    
    
    
    
entity_get_vectoridEV_VEC_originfOrigin );
    
    static 
Float:fDistanceFloat:fClosest;
    
    
fClosest 9999.0;
    switch( 
get_user_teamid ) )
    {
        case 
1:
        {
            for( new 
0g_iSpawnsCT ]; i++ )
            {
                
fDistance get_distance_ffOriging_fOriginsCT ][ ] );
                if( 
fDistance fClosest )
                    
fClosest fDistance;
            }
            
        }
        case 
2:
        {
            for( new 
0g_iSpawnsTERO ]; i++ )
            {
                
fDistance get_distance_ffOriging_fOriginsTERO ][ ] );
                if( 
fDistance fClosest )
                    
fClosest fDistance;
            }
            
        }
    }
    
    if( 
fClosest <= 255.0 && !g_bUserIsBlankedid ] )
    {
        
        
g_bUserIsBlankedid ] = true;
        
set_user_hitzonesid0);
        
client_printidprint_chat"%s You are now fireing blanks!"PLUGIN_TAG );
        
client_printidprint_chat"%s %.3f"PLUGIN_TAGfClosest );
        
    }
    else if( 
fClosest 255.0 && g_bUserIsBlankedid ] )
    {
        
g_bUserIsBlankedid ] = false;
        
set_user_hitzonesid0255 );
        
client_printidprint_chat"%s You're not fireing blanks anymore!"PLUGIN_TAG );
        
client_printidprint_chat"%s %.3f"PLUGIN_TAGfClosest );
    }
}

stock Float:get_distance_float( const Float:fOrigin], const Float:flOrigin] )
{
    return ( ( 
fOrigin] - flOrigin] ) + ( fOrigin] - flOrigin] ) );
}

GetSpawnsOrigins( )
{
    new 
iEnt;
    while( ( 
iEnt find_ent_by_classiEnt"info_player_deathmatch") ) )
    {
        if( 
iEnt && ++g_iSpawnsTERO ] < 64 )
        {
            
entity_get_vectoriEntEV_VEC_origing_fOriginsTERO ][ g_iSpawnsTERO ] ] );
            
g_iSpawnsTERO ]++;
        }
    }
    
    
iEnt = -1;
    while( ( 
iEnt find_ent_by_classiEnt"info_player_start") ) )
    {
        if( 
iEnt && ++g_iSpawnsCT ] < 64 )
        {
            
entity_get_vectoriEntEV_VEC_origing_fOriginsCT ][ g_iSpawnsCT ] ] );
            
g_iSpawnsCT ]++;
        }
    }
    
    
/*log_amx( "Loaded %i T and %i CT", g_iSpawns[ TERO ], g_iSpawns[ CT ] );
    
    for( new i = 0; i < g_iSpawns[ TERO ]; i++ )
        log_amx( "[T %i] %f %f %f", i +1, g_fOrigins[ TERO ][ i ][ 0 ], g_fOrigins[ TERO ][ 1 ], g_fOrigins[ TERO ][ 2 ] );
        
    for( new i = 0; i < g_iSpawns[ CT ]; i++ )
        log_amx( "[CT %i] %f %f %f", i +1, g_fOrigins[ CT ][ i ][ 0 ], g_fOrigins[ CT ][ 1 ], g_fOrigins[ CT ][ 2 ] );
    
    */

On de_dust2, when i walk around upside CT spawn ( see screenshot ) i get blanks ..
Click for ScreenShot ( imgur )

what can i do to check only horizontal distance ( x & y.. i mean forward/backward & right/left ) ?
__________________

My PC Themes . .

Last edited by red_bull2oo6; 10-26-2014 at 06:57. Reason: added [solved] tag.
red_bull2oo6 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 17:35.


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