Comparing steam ids not working?

I want to compare steam ids, but this isn’t working.
I have:

local IDs = 	{
function kickonjoin(ply)
	for k, v in pairs( IDs ) do
        	if v == ply:SteamID() then
			ply:Kick("This is a test!")

hook.Add( "PlayerConnect", "playerConnectHook", kickonjoin )

And I get this error:

L 03/13/2014 - 19:29:25: Lua Error:
[ERROR] lua/autorun/server/kick.lua:8: bad key to string index (number expected, got string)
  1. error - [C]:-1
   2. __index - lua/includes/extensions/string.lua:262
    3. fn - lua/autorun/server/kick.lua:8
     4. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

Can you help me?


Show us the whole code…

Okay, I updated it.

What made you think that the PlayerConnect hook’s first parameter is a player?

Wiki is your friend


Hmm okay… The first parameter is a name, but how can I convert a name to a player? I have already googled, but all solutions doesn’t work… I’m very new in lua.

Use a different hook, like PlayerInitialSpawn.

Ah, it works fine now. Thank you :slight_smile: