Raised This Month: $ Target: $400
 0% 

Problem characters (name and symbol)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CsIosefin
Senior Member
Join Date: Aug 2009
Old 05-08-2010 , 09:30   Problem characters (name and symbol)
Reply With Quote #1

Code:
#include <amxmodx>

new const Caracters[] = "!'.,/"

public plugin_init() 
{
	register_plugin("Characters", "1.0", "Teams")
}

public client_connect(id)
{
	static name[32]
	get_user_name(id, name, 31)

	for(new i = 0; i < strlen(name); i++)
	{
		for(new j = 0; j < 10; j++)
		{
			if(name[i] == Caracters[j])
			{
				server_cmd("kick #%d %s", get_user_userid(id), "The name can not contain characters.")
			}

			if(strlen(name[i]) < 3 )
			{
				server_cmd("kick #%d %s", get_user_userid(id), "The name can not be less than three characters.")
			}
		}
	}

	return PLUGIN_CONTINUE
}

public client_infochanged(id)
{
	new newname[32], oldname[32]
	get_user_info(id, "name", newname, 31)
	get_user_name(id, oldname, 31)
	
	if(equali(newname, oldname))
		return PLUGIN_CONTINUE
      
	set_task(1.0, "client_connect", id)
   
	return PLUGIN_CONTINUE
}
What is, why not get the logs ... all understand ...
Code:
L 05/08/2010 - 04:17:51: [AMXX] Displaying debug trace (plugin "caracters.amxx")
L 05/08/2010 - 04:17:51: [AMXX] Run time error 4: index out of bounds 
L 05/08/2010 - 04:17:51: [AMXX]    [0] caracter.sma::client_connect (line 19)
Can you tell me what is wrong ...? Thanks very much!
CsIosefin is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-08-2010 , 09:37   Re: Problem characters (name and symbol)
Reply With Quote #2

use sizeof Caracters not 10
__________________
xPaw is offline
CsIosefin
Senior Member
Join Date: Aug 2009
Old 05-08-2010 , 10:16   Re: Problem characters (name and symbol)
Reply With Quote #3

Code:
#include <amxmodx>

new const Caracters[] = "!'.,/"

public plugin_init() 
{
    register_plugin("Characters", "1.0", "Teams")
}

public client_connect(id)
{
    static name[32]
    get_user_name(id, name, 31)

    for(new i = 0; i < strlen(name); i++)
    {
        for(new j = 0; j < sizeof Caracters; j++)
        {
            if(name[i] == Caracters[j])
            {
                server_cmd("kick #%d %s", get_user_userid(id), "The name can not contain characters.")
            }

            if(strlen(name[i]) < 3 )
            {
                server_cmd("kick #%d %s", get_user_userid(id), "The name can not be less than three characters.")
            }
        }
    }

    return PLUGIN_CONTINUE
}

public client_infochanged(id)
{
    new newname[32], oldname[32]
    get_user_info(id, "name", newname, 31)
    get_user_name(id, oldname, 31)
    
    if(equali(newname, oldname))
        return PLUGIN_CONTINUE
      
    set_task(1.0, "client_connect", id)
   
    return PLUGIN_CONTINUE
}
I put sizeof, but now I'm not going to the server, I still require at least 3 characters, I ask nothing more, all this tells me.

EDIT:

I did, I repaired!
Okay, thank you very much xPaw support!

Last edited by CsIosefin; 05-08-2010 at 10:42.
CsIosefin is offline
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 03:42.


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