concommand to Kill specific player?

I’m new to Lua and I’m trying to create (what should be) a simple concommand to kill my friend (dimensions)

Here is what I have


 concommand.Add("killdimensions", function()
     for k,v in pairs( player.GetAll() ) Find (SteamID == BLANK)
          if SteamID == true then function ()
               Player:Kill(BLANK)
          else
              print( "Couldn't find that slippery fuck")
end) 

The balnks are his steam ID… I believe my problem is I do not know the function to run on his SteamID once I have found it… Any help is appreciated…

You’re were on the right track


local function ccKillDimensions( pl, _, args )
  if pl:SteamID( ) ~= "YOUR STEAMID" then
    return
  end

  local did = false

  for k, v in pairs( player.GetAll( ) ) do
    if v:SteamID( ) == "DIMENSION'S STEAMID" then
      did = true
      if v:Alive( ) then
        v:Kill( )
      else
        pl:PrintMessage( HUD_PRINTCONSOLE, "Boss! Someone else beat me to the job!" )
      end
    end
  end

  if not did then
    pl:PrintMessage( HUD_PRINTCONSOLE, "Sorry boss, I couldn't find that slippery fuck!" )
  end
end

concommand.Add( "killdimensions", ccKillDimensions )

You’ll probably want to make sure only you can run the command ( by checking if the player’s steamid is your steamid ) unless you want anyone to be able to run the command.

I’m not sure what you were trying to do with Find since Lua doesn’t work that way, and sticking a function without closing it midstream is going to cause syntax errors.

@Kogitsune why do you say cc infront of dimensions name?

It’s just the way he decided to call the function.
He could’ve also gone with a anonymous function like in your example, or called the function penis, etc.
The way how you do naming conventions depends on your own preference.