AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Find out registered functions (https://forums.alliedmods.net/showthread.php?t=88147)

GoD2.0 03-21-2009 05:21

Find out registered functions
 
Hi

I would like to make a plugin that for each amx_ client console command registers another equivalent admin_ function which calls the same function as the amx_ function. For example, if if have the amx_kick console command the plugin would automatically register admin_kick and make it call the same function with the same parameters.

The problem i've ran into is that get_concmd do not tell you which function the call is mapped on to.

TheRadiance 03-21-2009 07:04

Re: Find out registered functions
 
You can replace prefix admin_ with amx_ and then execute it from the clients console with it arguments.
PHP Code:

public CommandKickidlevelcid )
{
    if ( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED

    
new szCommand16 ]
    
read_argv0szCommandsizeof szCommand ) - )

    if ( 
equaliszCommand"admin_") )
        
replace_allszCommandsizeof szCommand ) - 1"admin_""amx_" )

    
client_cmdid"%s"szCommand )
    return 
PLUGIN_HANDLED




All times are GMT -4. The time now is 08:57.

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