Store SteamID's and call them to check for a status

How might I store player’s SteamID’s in a text file and call them up in a gamemode to determine if they are part of a special group such as “donator”? I have looked through the wiki on it: and I’m trying to figure out how I would use that to check ID’s and see if they were in such group.


look into it


file.Write(“a.txt”, “infohere”)

[lua]if not file.Exists(“donators.txt”) then file.Write(“donators.txt”,"") end

local function FindByName(name) for _,v in ipairs(player.GetAll()) do
if string.match(v:Name(),name) then return v end
end end

local function AddDonator(ply) file.Write(“donators.txt”,file.Read(“donators.txt”)…FindByName(ply):SteamID()…"
") end

concommand.Add(“add_donator”,function(ply,cmd,args) AddDonator(args[1]) end)[/lua]

Use the console command “add_donator <name>”, then check your donators.txt file.

Where do I find the donators.txt file?

It’s in your /data directory.

Also, to check if a player is a donator…

[lua]local function IsDonator(ply)
for _,v in ipairs(string.Explode("
",file.Read(“donators.txt”))) do
if ply:SteamID() == v then return true end
return false

If I want something to check if the player is a donator and change the local color to something different such as [lua]color = Color( 41, 62, 89, 190 )[/lua] where would I add that in to the function?

Change the color of the player, you mean?

No this is in a scoreboard and i have a local color =, but I want this local color to change if the player is a donator.

That IsDonator function. Put that in there.

Then use…
[lua]if IsDonator(ply) == true then color = Color( 41, 62, 89, 190 )
else color = Color(255,255,255,255) end[/lua]

Make sure you put the player argument in there, whatever it is.

Do I put all of this in my player_row.lua? That is where the local color is but I can’t seem to place the scripts in the right place.

I have no clue how to implement this because I have no access to any of my gmod files right now. I couldn’t tell you where to put it. You just gotta figure out which color you want.

I keep getting the error

\gamemode\scoreboard\player_row.lua:28: attempt to call global 'IsDonator' (a nil value)

any reason why?

It’s a local function…

So where should I put each piece, no reason to put me down I just have a few questions.