Quote:
Originally Posted by Mofforg
Why "len" errors here? It's just a buffer, so a string. As it's not defined what type is it, it should be automatically become a string, is it?
|
No, this isn't Visual Basic.
Why don't you try something like this. It accepts all or part of the users name, or the userid number (#12).
- amx_internalbancommand bugs
- amx_internalbancommand #12
PHP Code:
public plugin_init()
{
register_clcmd( "amx_internalbancommand" , "BanCmd" );
}
public BanCmd( id )
{
new szArg[ 33 ] , idTarget , szName[ 33 ];
read_argv( 1 , szArg , charsmax( szArg ) );
idTarget = cmd_target( id , szArg , 0 ); //3rd param has flags to control who can be selected, see below
if ( idTarget )
{
get_user_name( idTarget , szName , charsmax( szName ) );
client_print( id , print_chat , "You used ban cmd on '%s'" , szName );
}
return PLUGIN_HANDLED;
}
Flags for cmd_target (already defined by default), just use flag(s)
#define CMDTARGET_OBEY_IMMUNITY (1<<0)
#define CMDTARGET_ALLOW_SELF (1<<1)
#define CMDTARGET_ONLY_ALIVE (1<<2)
#define CMDTARGET_NO_BOTS (1<<3)
To use multiple, use bit-wise OR
CMDTARGET_NO_BOTS | CMDTARGET_OBEY_IMMUNITY
__________________