Raised This Month: $ Target: $400
 0% 

Registering cl_cmd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-25-2011 , 03:18   Re: Registering cl_cmd
Reply With Quote #1

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 Floatthroworigin[3];
new 
Floatdroporigin[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(idEV_VEC_originthroworigin);
    }
}

public 
Fwd_Weapon_Touch(weaponworld)
{
    if( 
g_bEnabled // Perform action only if plugin is enabled.
    
{
        
entity_get_vector(weaponEV_VEC_origindroporigin);
        
check_distance();
    }
}

public 
check_distance()
{
    new 
Floatdistance get_distance_f(throworigindroporigin);

    
client_print(0print_chat"Drop distance: %.1f"distance);

__________________
fysiks is online now
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 23:33.


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