Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help kick command still need help
#1
Question 
i have a problem with my kick command this is the code
Code:
if (Message.Substring(0,5) == "!kick")
                {
                    ServerCommand("kick " + Message.Substring(5));
                }
it only works on players without a space in their name anyone know why?
[Image: 24gu1a8.png]
Reply

#2
Try this
(Code from my engine)

ServerClient clienttokick = SV_GetPlayerByName(Message.substring(5).tostring());
Then use clienttokick infos

THIS should return fine name

Code:
public ServerClient SV_GetPlayerByName(string name)
        {
/*
            if (cvar_t.Get<int>("sv_running") == 0)
            {
                CLog.Print_f(Level.Info, "No server running.");
                return null;
            }
*/
            for (int i = 0; i < GetClients().Length; i++)
            {
                if (GetClients()[i] != null && GetClients()[i].Name == name)
                {
                    return GetClients()[i];
                }
            }
           ServerPrint("No player found");
            return null;
        }
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#3
im sorry i dont know how to use this im a noob.
[Image: 24gu1a8.png]
Reply

#4
I get this error: 'System.Collections.Generic.List<Addon.ServerClient>' does not contain a definition for 'Length' and no extension method 'Length' accepting a first argument of type 'System.Collections.Generic.List<Addon.ServerClient>' could be found (are you missing a using directive or an assembly reference?)
[Image: 24gu1a8.png]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 4,169 11-09-2013, 09:21
Last Post: clemi555
  Help auto command Dynasty 6 4,360 08-26-2013, 16:05
Last Post: hillbilly
  !come command Dr3am95 12 7,862 02-12-2013, 12:08
Last Post: SgtLegend
  whats the command to get string length pedjas 4 3,097 01-20-2013, 18:30
Last Post: pedjas
Question Help Kick people with space in name koro35 13 8,359 01-06-2013, 14:14
Last Post: master131
Brick WeaponType\projectile kick back. HELP! GenaSG 10 7,466 12-24-2012, 20:42
Last Post: GenaSG
  [Request] Team change by admin command. Dumas 10 8,896 11-29-2012, 21:38
Last Post: 99IRock
  [Release] Bad Names Kick Plugin v3.0 OzonE 73 44,273 11-05-2012, 12:51
Last Post: lammv
  [Help] How to hide a command? korsika 4 4,111 10-27-2012, 23:30
Last Post: korsika
  [Request] Kick if non ASCII name islamsaab 2 2,856 10-27-2012, 05:54
Last Post: islamsaab

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.