Raised This Month: $ Target: $400
 0% 

how read user name from file and kick ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
BodyBuilder
BANNED
Join Date: Jun 2011
Location: Europa-USA-Moon
Old 08-14-2011 , 07:40   how read user name from file and kick ?
#1

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


Last edited by ConnorMcLeod; 08-14-2011 at 15:39. Reason: back to original deleted thread.
BodyBuilder is offline
 


Thread Tools
Display Modes

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 03:22.


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