AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how read user name from file and kick ? (https://forums.alliedmods.net/showthread.php?t=164655)

BodyBuilder 08-14-2011 07:40

how read user name from file and kick ?
 
PHP Code:

#include amxmodx
#include amxmisc

#define PLUGIN "Long Name And Player Kicker"
#define VERSION "1.0"
#define AUTHOR "BodyBuilder"

#define NICKFILE "addons/amxmodx/data/PlayersKicker.ini"

new
    
max_name_leght,
    
max_name_kick_text_1,
    
max_name_kick_text_2

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
max_name_leght register_cvar("max_name_leght","15")
    
max_name_kick_text_1 register_cvar("max_name_kick_text_a","Players Not Allowed")
    
max_name_kick_text_2 register_cvar("max_name_kick_text_b","Nick Is Too Long Max Length: ")
}

public 
client_connect(id)
{
    static
        
max_name_kick_text_a[32],
        
max_name_kick_text_b[32],
        
maxname[32],
        
authid[32],
        
get

    get_pcvar_string
(max_name_kick_text_1,max_nam e_kick_text_a,31)
    
get_pcvar_string(max_name_kick_text_2,max_nam e_kick_text_b,31)
    
get_user_name(id,maxname,sizeof (maxname) - 1)

    if(
nick_isvalid(maxname) == 0)
    {
        
get_user_authid(id,authid,31)
        
server_cmd("kick #%d ^"%s^"",get_user_userid(id),max_name_kick_tex t_a)
    }
    
get get_pcvar_num(max_name_leght)
    if(
strlen(maxname) > get)
    {
        
maxname[get] = '^0'
        
get_user_authid(id,authid,31)
        
server_cmd("kick #%d ^"%%d^"",get_user_userid(id),max_name_kick_text_ b,get)
    }
}

public 
plugin_precache()
{
    if(!
file_exists(NICKFILE))
    {
        
write_file(NICKFILE,":::Player'S Kicker:::",-1)
    }
    return 
PLUGIN_CONTINUE
}

public 
nick_isvalid(maxname[64])
{
    if(!
file_exists(NICKFILE))
    {
        
write_file(NICKFILE,":::Player'S Kicker:::",-1)
        return 
1
    
}
    new 
linetext[64], txtlen
    
while((line read_file(NICKFILE,line,text,63,txtlen)) != 0)
    {
        if(
equali(text,maxname))
        {
            
nick_kick(maxname)
            return 
0
        
}
    }
    return 
1
}

public 
nick_kick(maxname[64])
{
    new 
checkstring[6]
    
copy(checkstring,5,maxname)

    if(
equali(checkstring,"kick "))
    {
        return 
1
    
}
    return 
0



Blue Snake. 08-14-2011 12:32

Re: error 047: array sizes do not match, or destination array is too small
 
PHP Code:

public name_isvalid(maxname[64]) 

to
PHP Code:

public name_isvalid(maxname[]) 

Same thing for name_precache

And i'm not sure this will works, NICKSFILE is a definition, not a string.
PHP Code:

public plugin_precache()
{
    
get_configsdir(NICKSFILEDIR,199)
    
format(NICKSFILE,199,"%s/PlayersKicker.ini",NICKSFILEDIR)



lucas_7_94 08-14-2011 13:24

Re: :
 
?????????????

PS: I love when a admin look the previus post and repost the old post :D

Korxu 08-14-2011 13:40

Re: :
 
Don't edit your post, if another user have the same problem can see the solution....

ConnorMcLeod 08-14-2011 15:39

Re: :
 
Quote:

Originally Posted by lucas_7_94 (Post 1532491)
?????????????

PS: I love when a admin look the previus post and repost the old post :D

Locked.


All times are GMT -4. The time now is 03:22.

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