Weapon kits working

Ok, first of all i wanted a way to make weapon kits for a player, so that steamid would get the assault kit wich contains a hk.

But an easyer way of adding the weapon kits instead of going into the .lua file and edit it everytime then restart just to add one steamid to the kit.

Heres the lua code for it.

[lua]hook.Add( “PlayerLoadout”, “Assault kit”, function( ply ) – Name of the kit

if ply:SteamID() == "STEAM_0:1:156583373" then -- The steam idea that gets the weapon kit

   ply:Give( "m9k_m416" ) -- The weapons the steam id gets

end

end )[/lua]

Ok so i want it so i can add a steamid by typing a command in console instead of restarting every single time.

Here’s the command i would prefer: kitaddsteamid STEAM_0:12323 Assault kit

How do i do this? Might tell me the code for it?

[editline]7th March 2016[/editline]

Basicly, i want an easyer way to add a steamid. I want it to just type the command in console then it adds that steamid to that kit. "kitaddsteamid (steamid) (name of kit)

You’ve already got a thread going for this and believe another one ontop of that…

http://forum.facepunch.com/showthread.php?t=1509491

We’re trying to help you, but you’ve got to stick to one thread…

This is untested but looks like it works to me. Type addid in console along with the steamid.



local AssaultIDs = {}
hook.Add("Initialize", "load", function()
	if file.Exists("ids.dat", "DATA") then
		AssaultIDs = string.ToTable(file.Read("ids.dat", "DATA"))
	end
end)

hook.Add("PlayerLoadout", "Assault Kit", function(ply)
    for _, id in pairs(AssaultIDs) do
    	if ply:SteamID() == id then
    		ply:Give("m9k_m416")
    		break
    	end
    end
end)

concommand.Add("addid",function(ply, cmd, args, argStr)
	if player.GetBySteamID(args[1]):IsValid() then
		table.insert(AssaultIDs, args[1])
		file.Write("ids.dat", table.ToString(AssaultIDs))
	end
end)