ItsMods

Full Version: Anti-Invisible Name
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
My version of it. Only allows ASCII characters.
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Addon;
  5.  
  6. namespace ASCIIName
  7. {
  8. public class Class1 : CPlugin
  9. {
  10. string command = "kickClient";
  11. string commandMsg = string.Empty;
  12. string srvMsg = string.Empty;
  13.  
  14. public override void OnServerLoad()
  15. {
  16. try
  17. {
  18. ServerPrint("\n ASCIIName loaded \n Author: zxz0O0 \n Thanks to Nukem, Jariz and Pozzuh\n");
  19. ServerPrint(" youtube.com/zxz0O0 \n itsmods.com\n");
  20.  
  21. command = GetServerCFG("ASCIIName", "Command", "kickClient");
  22. srvMsg = GetServerCFG("ASCIIName", "ServerMsg", string.Empty);
  23. commandMsg = GetServerCFG("ASCIIName", "CommandMsg", string.Empty);
  24. }
  25. catch (Exception e)
  26. {
  27. ServerPrint(e.Message);
  28. }
  29. }
  30.  
  31. public override void OnPlayerConnect(ServerClient Client)
  32. {
  33. if (Encoding.UTF8.GetByteCount(Client.Name) != Client.Name.Length)
  34. {
  35. if (!string.IsNullOrEmpty(srvMsg))
  36. ServerSay(string.Format(srvMsg, Client.Name, Client.XUID), false);
  37. ServerPrint("ASCIIName executed: " + command + " " + Client.ClientNum + " \"" + commandMsg + "\"");
  38. ServerPrint("ASCIIName Name was: " + Client.Name);
  39. ServerCommand(command + " " + Client.ClientNum + " \"" + commandMsg + "\"");
  40. }
  41. }
  42. }
  43. }


Options are
Code:
[ASCIIName]
//Command to be executed, kickClient, tempBanClient or banClient
Command=kickClient
//Message to be displayed when an action is taken, valid placeholders {0} - name and {1} xuid
ServerMsg=
//Message to be displayed to the client who is being kicked
CommandMsg=
thanks for these.
quite useful
i have been running this for a while now and on the whole it works a treat however i have noticed it is letting players in with just . and <> for a name, can you please make sure that these sort of names are excluded from joining please?
(04-18-2012, 01:02)hillbilly Wrote: [ -> ]i have been running this for a while now and on the whole it works a treat however i have noticed it is letting players in with just . and <> for a name, can you please make sure that these sort of names are excluded from joining please?

Ya I'm seeing that as well.. Nyan Cat just wanted to put that there xD
Someone can post an invisible name or how to do this? I need test the plugin because after that plugin no one with strage name join in me server xD
(04-18-2012, 04:46)Dumas Wrote: [ -> ]Someone can post an invisible name or how to do this? I need test the plugin because after that plugin no one with strage name join in me server xD
[Image: 9CsV8rZm3G.jpg]
deny some xuid and Anti-Invisible Name and ASCIIName

deny name include "">= you name >="Space" char,

Code:
using System;
using System.Collections.Generic;
using System.Text;
using Addon;

namespace ASCIIName
{
    public class Class1 : CPlugin
    {
        string command = "kickClient";
        string commandMsg = string.Empty;
        string srvMsg = string.Empty;
           string commandMsg1 = string.Empty;
        string badPlayers1 = "01100001e70d9398";
        List<string> badPlayers = new List<string>();
        int result;
        
        public override void OnServerLoad()
        {
            try
            {
                ServerPrint("ASCIIName loaded Author: zxz0O0 Thanks to Nukem, Jariz and Pozzuh\n and AntiInvisibleName plug master131 modify ljp");
                command = GetServerCFG("ASCIIName", "Command", "kickClient");
                srvMsg = GetServerCFG("ASCIIName", "ServerMsg", string.Empty);
                commandMsg = GetServerCFG("ASCIIName", "CommandMsg", string.Empty);
                commandMsg1 = GetServerCFG("ASCIIName", "CommandMsg1", string.Empty);
            
                string badPlayersXUID = GetServerCFG("ASCIIName","badPlayers_xuid", "");

                if(!badPlayers.Equals(""))
                    badPlayers = new List<string>(badPlayersXUID.ToLower().Split(','));
                
            }
            catch (Exception e)
            {
                ServerPrint(e.Message);
            }
        }

        public override void OnPlayerConnect(ServerClient Client)
        {
            if (0 == (result=string.Compare (badPlayers1 , Client.XUID)))
            {
                    ServerCommand(command + " " + Client.ClientNum + " \"" + commandMsg1 + "\"");  
            }
            
            foreach ( string bad in badPlayers )
            {
                if (0 == (result=string.Compare (bad , Client.XUID)))
                  {
                    ServerCommand(command + " " + Client.ClientNum + " \"" + commandMsg1 + "\"");  
                  }
            }
                            
            if (Encoding.UTF8.GetByteCount(Client.Name) != Client.Name.Length)
                {
                ServerSay(string.Format(srvMsg, Client.Name, Client.XUID), false);
                ServerPrint("ASCIIName executed: " + command + " " + Client.Name + " \"" + commandMsg + "\"");
                ServerCommand(command + " " + Client.ClientNum + " \"" + commandMsg + "\"");    
                }
            else if (Array.Exists(Client.Name.ToCharArray(), c => (int)c <= 31) || Array.Exists(Client.Name.ToCharArray(), c => (int)c >= 191) )
                {
                    ServerPrint("ASCIIName executed Invisible name: " + command + " " + Client.Name + " \"" + commandMsg + "\"");
                    ServerCommand(command + " " + Client.ClientNum + " \"" + commandMsg + "\"");
                }

        }
    }
}

sv_config.ini

Code:
[ASCIIName]
//Command to be executed, kickClient, tempBanClient or banClient
Command=kickClient
//Message to be displayed when an action is taken, valid placeholders {0} - name and {1} xuid
ServerMsg=User was name bad!
//Message to be displayed to the client who is being kicked
CommandMsg=Change you name (use 0-9 and a-Z)
CommandMsg1=Same ID,Change you ID
badPlayers_xuid=xuid6,xuid7,xuid8
//example:badPlayers_xuid=0110000112181148,01100001707af3ec,0110000123862132,011000012c512cb2
still lets you just with just .. though
(04-19-2012, 22:03)hillbilly Wrote: [ -> ]still lets you just with just .. though

Anyone have any fixes? I get blank people now..
(04-25-2012, 03:04)DidUknowiPwn Wrote: [ -> ]
(04-19-2012, 22:03)hillbilly Wrote: [ -> ]still lets you just with just .. though

Anyone have any fixes? I get blank people now..

Same here. A player with a blank name. nothing. no dots.
Edit: ASCII characters only by zxz0O0 does the trick [tested] ^_^
Pages: 1 2 3