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

Name Checker 1.5


Post New Thread Reply   
 
Thread Tools Display Modes
Kahless
Member
Join Date: May 2008
Old 01-17-2009 , 02:54   Re: Name Checker 1.3
Reply With Quote #11

Is there a way to do a check to get the steam id of someone who has changed their name to the name of an admin. Our admins have a habit of banning themselves with name changes copying their names.
Kahless is offline
Roachy
Member
Join Date: Feb 2008
Old 02-22-2009 , 19:11   Re: Name Checker 1.3
Reply With Quote #12

Hey, I'm trying to mod this a bit to display a meaningful message when a player gets timer-kicked, instead of it just saying "Change your name".

I would love to see the author himself make this change, but for now, what I've done is basically make a clone of the CheckName function called GetReason, except instead of returning true or false, it returns an explanatory message String, based on why the name check didn't succeed. I then modified the Timed_Kick function to grab that reason and plug it into the kick message where "Change your name" was.

However I've never seriously taught myself SourcePawn in the least, and am merely drawing off of my experience in other languages. My problem is that I'm getting a bunch of "Tag Mismatch" error on compiling this edit, one each time I try to return the reason string, and also a "Tag Mismatch" error in the Timed_Kick function when I try to grab that string and set it to a local variable. I'm sure someone with a bit of SourcePawn experience can point out my total noob flaws here:

Code:
public Action:Timed_Kick(Handle:timer,any:client)
{
    if ( IsClientConnected(client) && !IsFakeClient(client) && !IsClientInKickQueue(client) )
    {
        decl String:reason[255];
        decl String:name[64];
        GetClientName(client, name, sizeof(name));
        reason = GetReason(client,name);
        KickClient(client, "%s", reason);
    }
}

GetReason(client,const String:text[])
{
    new iCopySize = GetConVarInt(g_hCVarCopySize);
    new iCopyDiff = GetConVarInt(g_hCVarCopyDiff);
    new iSpecialChars = GetConVarInt(g_hCVarSpecialChars);
    new iMultiByte = GetConVarInt(g_hCVarMultiByte);
    new iBadNames = GetArraySize(g_hBadNameList);
    new iMinSize = GetConVarInt(g_hCVarMinSize);
    new iMaxSize = GetConVarInt(g_hCVarMaxSize);
    new FoundSpecial = 0;
    new FoundMB = 0;
    decl String:name[64];
    decl String:name2[64];
    decl String:kickReason[255];

    strcopy(name,sizeof(name),text);

    // empty names are not allowed
    TrimString(name);
    if(strlen(name)<iMinSize)
    {
        FormatEx(kickReason, sizeof(kickReason), "Name is too short.");
        return kickReason;
    }
    if(strlen(name)>iMaxSize)
    {
        FormatEx(kickReason, sizeof(kickReason), "Name is too long.");
        return kickReason;
    }

    for(new i=0;i<strlen(name);i++) {

        // no control characters allowed
        if (name[i]<32)
        {
            FormatEx(kickReason, sizeof(kickReason), "Name contains control characters.");
            return kickReason;
        }

        if (!IsCharAlpha(name[i]) && !IsCharNumeric(name[i]) && !IsCharMB(name[i]))
            FoundSpecial++;

        if (IsCharMB(name[i]))
            FoundMB++;

    }

    // only special characters
    if(strlen(name)<=FoundSpecial)
    {
        FormatEx(kickReason, sizeof(kickReason), "Name is all special characters.");
        return kickReason;
    }

    // no more than x special chars allowed
    if (FoundSpecial > iSpecialChars)
    {
        FormatEx(kickReason, sizeof(kickReason), "Name contains too many special characters.");
        return kickReason;
    }

    // no more than x multi-byte chars allowed
    if (FoundMB > iMultiByte)
    {
        FormatEx(kickReason, sizeof(kickReason), "Name contains too many multi-byte characters.");
        return kickReason;
    }

    name[iCopySize] = '\0';
    for(new i=0;i<g_iMaxPlayers;i++) {
        strcopy(name2,iCopySize,g_sNames[i][0]);
        TrimString(name2);
        if ((i!=client) && (strlen(name2)>3) && (StringDiff(name,name2) < iCopyDiff))
        {
            FormatEx(kickReason, sizeof(kickReason), "Name is too similar to another connected player's name.");
            return kickReason;
        }
    }

    // check for bad names
    for(new i=0;i<iBadNames;i++) {
        GetArrayString(g_hBadNameList, i, name2, sizeof(name2));
        if (StrContains(name, name2, false) != -1)
        {
            FormatEx(kickReason, sizeof(kickReason), "Name contains text that is not allowed.");
            return kickReason;
        }
    }

    if(IsPluginDebugging(g_hPlugin))
        LogMessage("Got name reason: %s (Size: %d)", name, strlen(name));

    FormatEx(kickReason, sizeof(kickReason), "Name is OK.");
    return kickReason;
}
Thanks for any help. The purpose of this is so that I can change around my namechecker cvars and people can tell me why exactly they can't connect so I can tweak them to be as efficient as possible.
Roachy is offline
Roachy
Member
Join Date: Feb 2008
Old 02-22-2009 , 19:31   Re: Name Checker 1.3
Reply With Quote #13

Also, one more thing I've been wondering... is it possible to literally just STOP people from changing names? If I understand correctly, this plugin simply enacts a punishment (kick/ban) after a player has changed names more than X times. But is there a way to make it so that when a player tries to change names on a particular server, the server simply doesn't allow the command to work?

Personally, I'd much rather that a person realizes that they're not allowed to change names on my server, and if it frustrates them, leaves on their own accord, than forcefully disconnect them when they try. Currently, not only do they not get a decent explanation of why they were kicked (something I'm trying to help with the above edit), but it turns away some players who might otherwise stay once they understand the no-name- change rules.

Simply put, I'd ideally like to see a third possible value for "sm_name_change_action", that being "disallow" or some such.
Roachy is offline
bobbobagan
SourceMod Donor
Join Date: May 2007
Location: New Zealand
Old 02-24-2009 , 20:10   Re: Name Checker 1.3
Reply With Quote #14

I am running this plugin along side sourcebans, and everytime somebody joins under the name 'unconnected' it bans them, although it also crashes the server.

It doesn't work!
__________________
bobbobagan is offline
Send a message via Skype™ to bobbobagan
saulstari
Member
Join Date: Jan 2006
Old 03-05-2009 , 16:22   Re: Name Checker 1.3
Reply With Quote #15

ye, same on my server.

when action is ban = crash.
action kick works fine.

:X

Last edited by saulstari; 03-05-2009 at 16:25.
saulstari is offline
clad
Senior Member
Join Date: Oct 2006
Old 05-12-2009 , 21:44   Re: Name Checker 1.3
Reply With Quote #16

i have just tested this on my tf server, and it seems to work great.

i have a request if possible.

How about a DB what would hold the info on why they got kicked?

For example we don't let clients join our server that have a forward slash in there name.
So if client was named "/" (without the quotes)
he would get the message in the kick window.
your name has / in it which is not allowed.

I'm sure it would have to be worded right so it fits in the window.

Or this for example:

Client was named: peckerpan^

On his kick window it would show:
Your name has ^ in it which is not allowed.
__________________
clad is offline
zhelev81
Veteran Member
Join Date: Nov 2007
Location: Varna,Bulgaria
Old 05-23-2009 , 04:57   Re: Name Checker 1.3
Reply With Quote #17

I don't want to allow people to change their names in game but i also don't want to kick them ,can u do that ?
zhelev81 is offline
Send a message via ICQ to zhelev81 Send a message via MSN to zhelev81 Send a message via Skype™ to zhelev81
Nail
BANNED
Join Date: May 2008
Location: PetrovЪ GradЪ
Old 07-20-2009 , 06:38   Re: Name Checker 1.3
Reply With Quote #18

zhelev81 +1
Nail is offline
Silent_Water
Member
Join Date: Sep 2008
Old 07-20-2009 , 16:25   Re: Name Checker 1.3
Reply With Quote #19

Quote:
Originally Posted by Roachy View Post
Also, one more thing I've been wondering... is it possible to literally just STOP people from changing names? If I understand correctly, this plugin simply enacts a punishment (kick/ban) after a player has changed names more than X times. But is there a way to make it so that when a player tries to change names on a particular server, the server simply doesn't allow the command to work?
I've updated a lot in version 1.5 and I tried to do that. But the plugin does not really block but it renames the player immediately back. If anyone knows a way to block this player setinfo command - please let me know
Silent_Water is offline
Silent_Water
Member
Join Date: Sep 2008
Old 07-20-2009 , 16:28   Re: Name Checker 1.3
Reply With Quote #20

Quote:
Originally Posted by clad View Post
How about a DB what would hold the info on why they got kicked?

For example we don't let clients join our server that have a forward slash in there name.
So if client was named "/" (without the quotes)
he would get the message in the kick window.
your name has / in it which is not allowed.
Well, I've updated my plugin to version 1.5 and I've added a lot of messages and the option to tell the player these details (or to disable this). Give it a try
Silent_Water 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 16:56.


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