[Help] How can i make this script target one person/one steamid.


for i, k in pairs (player.GetAll()) do
	if(LocalPlayer() != k) then
		net.Start("kickban")
			net.WriteString(k:SteamID().."{sep}"..k:Nick())
		net.SendToServer()
	end
end

That would kick everyone but yourself…

I would do this



local id = "STEAM:0:0:538223" // targets id
for k,v in pairs( player.GetAll() ) do
    if v:SteamID() == id then
        // net start and stuff
    end 
end


if you have the entity then just do the net stuff directly

So, This will work ?


local id = "STEAM:0:0:538223" // targets id
for k,v in pairs( player.GetAll() ) do
    if v:SteamID() == id then
		net.Start("kickban")
			net.WriteString(k:SteamID().."{sep}"..k:Nick())
		net.SendToServer()
    end 
end

No, I thought I would write it for shits and giggles…

Seriously though, yes it will, if you change k to v for the player functions

You have not told us if this is client or server side. So, assuming it is server side,
[lua]
local id = “STEAM:0:0:538223” // targets id
for k,v in pairs( player.GetAll() ) do
if v:SteamID() == id then
res = “Feel likes banning for 5 minutes.”
v:Kick(res)
v:Ban(5, res)
end
end
[/lua]

Then, assuming clientside your version would work if kickban is defined on net, but this all leaves a security hole for the client to kick/ban players. Suggest not allowing client to run lua :smiley:



		net.Start("kickban")
			net.WriteString(k:SteamID().."{sep}"..k:Nick())
		net.SendToServer()


Is this running on client or server? Come on Sherlock, it’s an easy one!

ClientSide

How do you know he is running client side? Sure, it says SendToServer, but people can make silly mistakes, they’re humans!

Yeah, humans do make silly mistakes, like you.