Raised This Month: $ Target: $400
 0% 

error 035: argument type mismatch (argument 1)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-02-2014 , 22:26   Re: error 035: argument type mismatch (argument 1)
Reply With Quote #1

Quote:
Originally Posted by Mofforg View Post
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 
BanCmdid )
{
    new 
szArg33 ] , idTarget szName33 ];
    
    
read_argvszArg charsmaxszArg ) );
    
idTarget cmd_targetid szArg ); //3rd param has flags to control who can be selected, see below

    
if ( idTarget )
    {
        
get_user_nameidTarget szName charsmaxszName ) );
        
client_printid 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
__________________

Last edited by Bugsy; 12-02-2014 at 23:17.
Bugsy is offline
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 12-02-2014 , 23:38   Re: error 035: argument type mismatch (argument 1)
Reply With Quote #2

Quote:
Originally Posted by Bugsy View Post
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 
BanCmdid )
{
    new 
szArg33 ] , idTarget szName33 ];
    
    
read_argvszArg charsmaxszArg ) );
    
idTarget cmd_targetid szArg ); //3rd param has flags to control who can be selected, see below

    
if ( idTarget )
    {
        
get_user_nameidTarget szName charsmaxszName ) );
        
client_printid 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
Thanks, that's an ideal of accepting both userid and username. I made your way, now works! I can use only client_command through (can not BanCmd) because bansystem is closed-source and i can not edit it. And bansystem have no forward functions.

I did not consider to use cmd_target because i can not find full documentation on it (i even did not know that function before you told me about it). I am not sure what exactly does it do, what for does here the first argument and what does it mean.

PHP Code:
    if(equal(command[0],"amx_internalbancommand",22))
    {
        new 
idTarget;
        
idTarget cmd_targetid command[1] , CMDTARGET_ALLOW_SELF );
        
        if ( 
idTarget )
        {
            ...
        }
    } 
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
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 15:25.


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