Note: I didn't add error checking, so, if you make any mistakes, it's on you.
Example usage in an AMXX plugin:
Code: Select all
#include <amxmodx>
#include <fakemeta>
public plugin_init()
{
register_plugin( "Max/Min Usage Example" , "1.0" , "v3x" )
register_clcmd( "say /test" , "ClCmd_SayTest" )
}
new Float:g_fMaxs[3] = { -279.0 , -635.0 , -78.0 }
new Float:g_fMins[3] = { -728.0 , -1005.0 , -174.0 }
public ClCmd_SayTest( id )
{
if( !is_user_alive( id ) )
return PLUGIN_CONTINUE
new Float:fOrigin[3]
pev( id , pev_origin , fOrigin )
if(
fOrigin[0] <= g_fMaxs[0] &&
fOrigin[1] <= g_fMaxs[1] &&
fOrigin[2] <= g_fMaxs[2] &&
fOrigin[0] >= g_fMins[0] &&
fOrigin[1] >= g_fMins[1] &&
fOrigin[2] >= g_fMins[2] )
{
client_print( id , print_chat , "You are within the rectangle" )
}
else
{
client_print( id , print_chat , "You are not within the rectangle" )
}
return PLUGIN_CONTINUE
} 