Get a SteamID

I am trying to get a SteamID.

Like I want to give a player something and I check this with the SteamID.

But there are alot of players having a SteamID

Lets say the SteamID of that player is “STEAM:5000” as example.
I want to get the SteamID from the table because I can’t use this http://wiki.garrysmod.com/page/player/GetBySteamID because the Schema returns it as nil.
and yeah

why can’t you use player.GetBySteamID?

Player:SteamID?

thats the table it gets me all steam ids this works but I don’t know how to

for k, v in pairs

Show your code please. Having trouble understanding what you’re trying to explain/achieve, sorry.


local PLUGIN = PLUGIN;
 
concommand.Add("update_check", function(player, command, arguments)
	local theplayer = { for i,v in pairs(player.SteamID)
						if player.SteamID == ("STEAM_0:1:00000000") then
							return theplayer;
				};
						
	
	if IsValid(theplayer) then
		if player == theplayer then
			timer.Simple( 2, function() Clockwork.player:NotifyAll("Everyone likes hidden text"); end)
			timer.Simple( 5, function()
		local schemaFolder = Clockwork.kernel:GetSchemaFolder();
                local durationThePlayer = 0
                local reasonThePlayer = "More hidden text"
       
				Clockwork.bans:Add(theplayer, durationThePlayer * 60, reasonThePlayer, function(theplayer, durationThePlayer, reasonThePlayer)
					if (duration > 0) then
						local hours = math.Round(duration / 3600);
					else
						Clockwork.player:NotifyAll("A modified plugin has banned Theplayer permanently ("..reasonThePlayer..").");
					end;
				end);
			end);
		end;
	else
		local targetstring = tostring(target)
		local target = Clockwork.player:FindByID(player);
		local reasonOther = "More hidden text"
       
		if (target) then
			Clockwork.player:NotifyAll("A modified plugin has kicked '"..target:Name().."' ("..reasonOther..").");
			target:Kick(reasonOther);
			target.kicked = true
		end;
	end;
end);

you should read this.

GetBySteamID returns as nil value.

[ERROR] gamemodes/cwhl2rp/plugins/something_hidden/plugin/sv_hooks.lua:9: attempt to call field ‘GetBySteamID’ (a nil value)

That’s because you’re overriding the player variable in your function declaration. Change it to ply or something.

like ply.GetBySteamID?

[lua]
concommand.Add(“update_check”, function(player, command, arguments) – he’s talking about the player argument here
[/lua]

No, in your function declaration, you’re doing function(player, blah); do function(ply, blah) and change all usages of player to ply. For GetBySteamID, player is a global table, so you still use player there.


concommand.Add("update_check", function(player, command, arguments)
		local target = Clockwork.player:FindByID();
		local reasonOther = "Hidden text"
       
		timer.Simple( 2, function() Clockwork.player:NotifyAll("More hidden text"); end)
		timer.Simple( 5, function()
		if (target) then
			Clockwork.player:NotifyAll("A modified plugin has kicked '"..target:Name().."' ("..reasonOther..").");
			target:Kick(reasonOther);
			target.kicked = true
		end;
	end);
end);

I made it a little bit easier now

and I get this error


bad argument #1 to 'lower' (string expected, got nil)

¨

I am trying this, whoever types in update_check gets kicked

This isn’t Javascript.

Stop putting “;” everywhere.

there’s nowhere in the code that uses string.lower, it’s something else

[editline]15th December 2016[/editline]

you can use ; in glua

99% of the time you don’t have to, though.

What’s the point of using it?

Also, the string.lower is most likely a clockwork function.

Funnily enough, JavaScript doesn’t need semicolons as well. :v:

This is an example of where you must use a semicolon:



local some_var = bullshit -- semicolon should be there
("lliteral string"):somecrap()


Why would it need one? I have never seen them used before in Lua.

[editline]16th December 2016[/editline]

Ah, well I only took about an hour of Javascript before I got bored with it. My bad.