Raised This Month: $ Target: $400
 0% 

Max Distance.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Merc3y
Member
Join Date: Dec 2009
Old 12-22-2009 , 06:46   Max Distance.
Reply With Quote #1

Does anyone know how to get max distance ?

Example like:

A terrorist is near a counter terrorist, then the terrorist the one who is near the counter terrorist will be slay right away.
Merc3y is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-22-2009 , 07:18   Re: Max Distance.
Reply With Quote #2

Use get_distance() or get_distance_f() to know the distance between 2 origins.
__________________
Arkshine is offline
Merc3y
Member
Join Date: Dec 2009
Old 12-22-2009 , 07:45   Re: Max Distance.
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
Use get_distance() or get_distance_f() to know the distance between 2 origins.
I not too sure about this.

Maybe like this ?

PHP Code:
new cvar_maxdistance
 
public plugin_init( )
{
         
cvar_maxdistance register_cvar"maxdistance""600" )
}
 
new 
Float:fMyOrigin]
entity_get_vectoridEV_VEC_originfMyOrigin )
 
new 
Float:fTargetOrigin]
entity_get_vectortargetEV_VEC_originfTargetOrigin )
 
if ( ( 
get_distance_ffMyOriginfTargetOrigin ) > get_pcvar_numcvar_maxdistance ) )
{
      
user_killid )

Merc3y is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-22-2009 , 10:37   Re: Max Distance.
Reply With Quote #4

Of course that code alone won't work but your idea is correct.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Merc3y
Member
Join Date: Dec 2009
Old 12-22-2009 , 11:49   Re: Max Distance.
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
Of course that code alone won't work but your idea is correct.
Alright , but i don't know which one to choose ?

Using playerprethink ?

Can give me some example ?
Merc3y is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-22-2009 , 12:02   Re: Max Distance.
Reply With Quote #6

This should work:
Code:
#include < amxmodx > #include < engine > #include < cstrike > const Float:MAX_DISTANCE = 300.0; public plugin_init( ) {     register_plugin( "Team Distance?", "0.0.1", "Exolent" ); } public client_PreThink( iPlayer ) {     if( is_user_alive( iPlayer ) && cs_get_user_team( iPlayer ) == CS_TEAM_CT ) {         static iPlayers[ 32 ], iNum;         get_players( iPlayers, iNum, "ae", "TERRORIST" );                 static iTarget;         for( new i = 0; i < iNum; i++ ) {             iTarget = iPlayers[ i ];                         if( entity_range( iPlayer, iTarget ) < MAX_DISTANCE ) {                 user_kill( iTarget );                 client_print( iTarget, print_chat, "You were too close to a CT." );             }         }     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 04:13.


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