AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Argument type mismatch (https://forums.alliedmods.net/showthread.php?t=174355)

kramesa 12-19-2011 09:08

Argument type mismatch
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    
register_logevent("Cmd_Check_Name"2"1=Round_Start")
}

public 
Cmd_Check_Name(id)
{        
    if(
is_user_admin(id))
    {
        new 
szName[32]
        
get_user_name(idszName31)
        
        if(
contain(szName"[ADMIN]"))
        {
            return 
PLUGIN_HANDLED
        
}
        else
        {
            
client_cmd("name ^"[ADMIN] %s^""szName)
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_HANDLED


Why have the problem here?

PHP Code:

if(contain(szName"[ADMIN]")) 


kiki33hun 12-19-2011 09:13

Re: Argument type mismatch
 
PHP Code:

#include <amxmodx> 
#include <amxmisc> 

public plugin_init() 

    
register_logevent("Cmd_Check_Name"2"1=Round_Start"


public 
Cmd_Check_Name(id
{         
    if(
is_user_admin(id)) 
    { 
        new 
szName[32
        
get_user_name(idszName31
         
        if(
contain(szName"[ADMIN]")) 
        { 
            return 
PLUGIN_HANDLED 
        

        else 
        { 
            
client_cmd(id"name ^"[ADMIN] %s^""szName
            return 
PLUGIN_HANDLED 
        

    } 
    return 
PLUGIN_HANDLED 



JoKeR LauGh 12-19-2011 09:18

Re: Argument type mismatch
 
ohh sorry , I was late ;)

anyway , you got the error is because you missed the first parameter , it should be index

kramesa 12-19-2011 09:25

Re: Argument type mismatch
 
Wow, i dont see the change

hleV 12-19-2011 10:00

Re: Argument type mismatch
 
There's no id passed in the Round_Start log event.

ConnorMcLeod 12-19-2011 10:48

Re: Argument type mismatch
 
PHP Code:

/*    Formatright © 2011, ConnorMcLeod 

    Admins & VIPs Tags is free software; 
    you can redistribute it and/or modify it under the terms of the 
    GNU General Public License as published by the Free Software Foundation. 

    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 

    You should have received a copy of the GNU General Public License 
    along with Admins Tag; if not, write to the 
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    Boston, MA 02111-1307, USA. 
*/ 

#define FLAG_ADMIN_ADMIN        ADMIN_BAN // obligatoirement un flag que les VIPs n'ont pas
#define FLAG_ADMIN_VIP        ADMIN_LEVEL_B

#include <amxmodx> 

#define VERSION "0.0.1" 

#define MAX_NAME_LENGTH    32 

new g_pCvarAdminTagg_pCvarVipTagg_pCvarVipPlaceg_pCvarAdminPlace

public plugin_init() 

    
register_plugin("Admins & VIPs Tags"VERSION"ConnorMcLeod"

    
g_pCvarAdminTag register_cvar("amx_admin_tag""[ADMIN]"
    
g_pCvarVipTag register_cvar("amx_vip_tag""[VIP]")
    
g_pCvarVipPlace register_cvar("amx_vip_tag_potision""0"// 0 left, 1 right
    
g_pCvarAdminPlace register_cvar("amx_admin_tag_potision""0")


public 
client_authorizedid 

    new 
iAdminType get_user_admin(id)
    if( !
iAdminType )
    {
        return
    }
    new 
szName[MAX_NAME_LENGTH
    new 
iNameLen get_user_name(idszNamecharsmax(szName)) 
    
CheckUserName(idszNameiNameLeniAdminType)  


public 
client_infochanged(id

    if( 
is_user_connected(id) ) 
    {
        new 
iAdminType get_user_admin(id)
        if( !
iAdminType )
        {
            return
        }
        new 
szOldName[MAX_NAME_LENGTH],szNewName[MAX_NAME_LENGTH
        
get_user_name(idszOldNamecharsmax(szOldName)) 
        new 
iNameLen get_user_info(id"name"szNewNamecharsmax(szNewName)) 
        if( !
equal(szOldNameszNewName) ) 
        { 
            
CheckUserName(idszNewNameiNameLeniAdminType
        }
    } 


CheckUserName(const idszName[MAX_NAME_LENGTH], const iNameLen, const iAdminType

    new 
szTag[32
    new 
iTagLen get_pcvar_string(iAdminType == FLAG_ADMIN_VIP g_pCvarVipTag g_pCvarAdminTagszTagcharsmax(szTag))

    if( 
containi(szNameszTag) != -
    { 
        return 
    } 

    if( 
get_pcvar_num(iAdminType == FLAG_ADMIN_VIP g_pCvarVipPlace g_pCvarAdminPlace) )
    {
        if( 
MAX_NAME_LENGTH iNameLen iTagLen 
        { 
            
add(szNamecharsmax(szName), szTag
        } 
        else 
        { 
            
formatex(szName[MAX_NAME_LENGTH-iTagLen-1], iTagLenszTag
        }
    }
    else
    {
        
format(szNamecharsmax(szName), "%s %s"szTagszName)
    }

    
set_user_info(id"name"szName


get_user_admin(id

    new 
__flags=get_user_flags(id)
    if( 
__flags>&& !(__flags&ADMIN_USER) )
    {
        if( 
__flags FLAG_ADMIN_ADMIN )
        {
            return 
FLAG_ADMIN_ADMIN
        
}
        else if( 
__flags FLAG_ADMIN_VIP )
        {
            return 
FLAG_ADMIN_VIP
        
}
    }
    return 
0



kramesa 12-19-2011 10:59

Re: Argument type mismatch
 
Thx Connor. Can check if admins have tag in 15 - 15 seconds?

fysiks 12-19-2011 13:58

Re: Argument type mismatch
 
Quote:

Originally Posted by kramesa (Post 1615894)
15 - 15 seconds

What does that mean?


All times are GMT -4. The time now is 11:48.

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