I got confused and need help

Need help, I want it to check the SteamIDs list and if the SteamID is valid within the server at that point in time it returns true when they try and noclip else it returns false. But I got confused and need some help.

[lua]local SteamID = {}
SteamID[1] = “STEAM_0:1:18765762”
SteamID[2] = “STEAM_0:1:18765762”
SteamID[3] = “STEAM_0:1:18765762”

function CheckSteamIDs()
for k, v in pairs(SteamID()) do
if v:SteamID !isValid
end
end

function Blocked()
if ("…v…", "…k…"is:Valid()
return true
else

end

end
hook.Add(“PlayerNoClip”, “Blocked”, Blocked)[/lua]

What the Jesus fuck.

[lua]
local SteamIDs = {}
SteamIDs[1] = “STEAM_0:1:18765762”
SteamIDs[2] = “STEAM_0:1:18765762”
SteamIDs[3] = “STEAM_0:1:18765762”

function Blocked(ply)
for k, v in pairs(SteamIDs) do
if k:SteamID() == v then
return true
end
end
ply:ChatPrint(“You are not allowed to NoClip!”)
return false
end
hook.Add(“PlayerNoClip”, “Blocked”, Blocked)
[/lua]

Should work.

Whao, that is seriously messed up. Do us a favor, take a Lua tutorial before trying to code Lua.

I think you mean this :

[lua]
local SteamIDs = {}
SteamIDs[1] = “STEAM_0:1:18765762”
SteamIDs[2] = “STEAM_0:1:18765762”
SteamIDs[3] = “STEAM_0:1:18765762”

function Blocked(ply)
for k, v in pairs(SteamIDs) do
if ply:SteamID() == v then
return true
end
end
ply:ChatPrint(“You are not allowed to NoClip!”)
return false
end
hook.Add(“PlayerNoClip”, “Blocked”, Blocked)
[/lua]

:angel:

Wow, what is with the tutorials, literally, immature. What I did was called an example snipit, and I didn’t know how to go with the keys and the values

What? I don’t understand.

Good lord, the code in the OP is an absolute monstrosity. It looks like you just stringed together some buzzwords and thought it would work.

Quebec’s code looks like it would work from skimming over it but you do need to look at tutorials if you haven’t already. I have no idea what you’re talking about in your last post there.

Well, if you speak english you would, eh? The word “snip-pit” is defined as an example, piece of something. What I did was an example of thrown together shit that took less then a minute, lol. Also I looked over Quebec’s and it works. But I can’t test it since I don’t have a computer.

The thing is we don’t want your “snip-it” around here. If you haven’t even tried to make it work yourself then don’t post.

And no matter how good at programming you are a good long stare at this page will definitely help you : http://wiki.garrysmod.com/?title=Lua
Maybe you could even click one of the links and learn something.

I learned a lot, lol. My the last part of the snip-it wasn’t mad with the knowledge of anything because I got confused, searched, couldn’t find anything.

[editline]02:54AM[/editline]

Oh, I can’t make it work neither because I am working on a bad computer because mine died, actually two of them died yesterday.

[editline]02:55AM[/editline]

Also you sounded kind of cocky and I dislike people like that, but you are a good lua coder and I appreciate your help, you help a lot of people. I like that.

This thread is full of fail, I’m sorry to say.

The code you showed us in the first post was a bucket of sludge. There is no debate over that.

Quebec is not cocky, he’s telling you how it is. Don’t just write a piece of code (especially when it looks like that) and throw it on the forums without even testing it.

We all speak English, better than you apparently, since no one understood your second post.

Don’t come to the forums and ask for help, then criticize the people who give you the correct answers.

I didn’t, look.

[editline]06:27AM[/editline]

Also I can’t test anything without a comp that works