I want make dynamic player table with two pieces of information. The player's SteamID, provided as a string, would be used as the key, and the value should be a number.
Should look like table = { "ExampleSteamID" = 3, "ExampleSteamID2" = 4 }
I found something like table.insert(table, { key = x, value = z})
, but it did not work.
gameevent.Listen("player_connect")
local function AdminBotOnJoinCheck(data)
local ply = data.networkid -- SteamID of joining player
local tableisempty = true -- some random stuff
for k, tableply in pairs(adminbot_players) do --checking for players already writed to table, maybe need fix
if not ply == tableply then
--need code here
MsgC("\nAdminBot: Player table updated | ", ply, "\n")
end
tableisempty = false --clear table = table break - just dont execute code.
end
if tableisempty == true then
--here same code
MsgC("\nAdminBot: Player table updated | ", ply, "\n")
end
if file.Exists("adminbotplayers.txt", "DATA") == true and adminbot_teamkills_use_file == true then -- Random stuff for file writing
local adminbot_players_json = util.TableToJSON(adminbot_players)
file.Write("adminbotplayers.txt", adminbot_players_json)
end
end