Here is one way to do it. You should be able to add things on your own now. If you don't know if it will work, try it first, if it doesn't work try something else. If you can't get it after trying several times then you may post your question.
PHP Code:
#include <amxmodx>
#include <engine>
#include <cstrike> // Include cstrike.inc so we can use cs_get_user_team().
new Float: throworigin[3];
new Float: droporigin[3];
new g_bEnabled = true // Enable the plugin by default. Change to false if you want it disabled by default.
public plugin_init()
{
register_plugin("Drop Distance", "1.0", "Drekes");
register_touch("weaponbox", "worldspawn", "Fwd_Weapon_Touch");
register_clcmd("drop", "cmd_drop");
register_clcmd("say /example", "cmdToggleState")
}
public cmdToggleState(id)
{
if( cs_get_user_team(id) == CS_TEAM_CT ) // Check if player using the command is a Counter-Terrorist
{
if( g_bEnabled )
{
// Plugin is currently enabled.
g_bEnabled = false // Disable plugin.
}
else
{
// Plugin is currently disabled.
g_bEnabled = true // Enable plugin.
}
}
}
public cmd_drop(id)
{
if( g_bEnabled ) // Perform action only if plugin is enabled.
{
entity_get_vector(id, EV_VEC_origin, throworigin);
}
}
public Fwd_Weapon_Touch(weapon, world)
{
if( g_bEnabled ) // Perform action only if plugin is enabled.
{
entity_get_vector(weapon, EV_VEC_origin, droporigin);
check_distance();
}
}
public check_distance()
{
new Float: distance = get_distance_f(throworigin, droporigin);
client_print(0, print_chat, "Drop distance: %.1f", distance);
}
__________________