Raised This Month: $51 Target: $400
 12% 

how read user name from file and kick ?


Post New Thread Closed Thread   
 
Thread Tools Display Modes
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
Blue Snake.
Member
Join Date: May 2011
Location: Romania
Old 08-14-2011 , 12:32   Re: error 047: array sizes do not match, or destination array is too small
#2

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)


Last edited by Blue Snake.; 08-14-2011 at 12:35.
Blue Snake. is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-14-2011 , 13:24   Re: :
#3

?????????????

PS: I love when a admin look the previus post and repost the old post
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.

Last edited by lucas_7_94; 08-14-2011 at 15:09.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Korxu
Senior Member
Join Date: Sep 2010
Old 08-14-2011 , 13:40   Re: :
#4

Don't edit your post, if another user have the same problem can see the solution....
Korxu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-14-2011 , 15:39   Re: :
#5

Quote:
Originally Posted by lucas_7_94 View Post
?????????????

PS: I love when a admin look the previus post and repost the old post
Locked.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Closed Thread



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 23:58.


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