FetchByRole
Server
Lyn.Player.FetchByRole(string role, table? include, function callback)FunctionDescription
Fetches all players that have a specific role.
Params
Example:
-- Basic usage (steamid64 only)
Lyn.Player.FetchByRole("admin", function(err, players)
if err then
-- database error already printed in console by Lyn
print("Error fetching players")
return
end
PrintTable(players)
--[[
{
{ steamid64 = "76561198261855442" },
{ steamid64 = "76561198000000000" }
}
]]
end)
-- With included fields
Lyn.Player.FetchByRole("admin", {"name", "playtime"}, function(err, players)
if err then
-- database error already printed in console by Lyn
print("Error fetching players")
return
end
PrintTable(players)
--[[
{
{ steamid64 = "76561198261855442", name = "Srlion", playtime = 5000 },
{ steamid64 = "76561198000000000", name = "", playtime = 0 }
}
]]
end)