Search TXT file for steam ID

Ok, so I’m making a basic whitelist for my server and so far I have the following code.

[lua]
local id = file.Read( “jobs/whitelist/cpn_whitelist.txt” )
if id ~= nil then
local whitelist = string.find( id, ply:SteamID() )
if (whitelist > 0) then
ply:SetTeam( 2 )
else
ply:PrintMessage( HUD_PRINTTALK, “You, cannot use this class” )
end
else
ply:PrintMessage( HUD_PRINTTALK, “You, cannot use this class” )
end
[/lua]

My txt file looks like this:

It is not reading it though, any help would be appreciated! Thank you!

-= should be either ~= or !=

Also, don’t use text saving, use tables and mysql.
So save all id’s with ; between then explode them to produce a localised table of steamids.

I am using ~=

I also do not want to use mysql. XD

Sorry, the phone draws the tidle shit.

Use pdata and glon or localsql

Well for one make sure your files are in the right place **[file.Read

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=File.Read)** is relative to your “garrysmod/data” folder

[lua]
local whitelists = file.Read( “jobs/whitelist/cpn_whitelist.txt” )
for _, sid in pairs(string.Explode("
", whitelists)) do
if ply:SteamID() == sid then
ply:SetTeam(2)
else
ply:ChatPrint(“You cannot use this class”)
end
end
[/lua]