-- !tuban

CreateChat"@tunban" ""(15)[[tempunbanmenu:OpenPlayer(id, 1)]]

tempunbanmenu = CreateMenu("Remove temp. ban", "IP,USGN,Name")
function tempunbanmenu:click(id,b,p)
	if b == 1 then
		ipbanmenu:OpenPlayer(id, 1)
	elseif b == 2 then
		usgnbanmenu:OpenPlayer(id, 1)
	elseif b == 3 then
		namebanmenu:OpenPlayer(id, 1)
	end
end

AddMenu(tempunbanmenu, 15)

-- Remove IP temp. ban
ipbanmenu = CreateMenu("Remove IP temp. ban")
function ipbanmenu:getcustombutton(b)
	local i = 0
	for k, v in pairs(SERVER_DATA["tempbanip"]) do
		i = i + 1
		if i == b then return k.."|"..v.." Mins." end
	end
end

function ipbanmenu:click(id,b,p)
	local i = 0
	for k, v in pairs(SERVER_DATA["tempbanip"]) do
		i = i + 1
		if i == b then
			SERVER_DATA["tempbanip"][k] = nil
		end
	end
	if b > 0 then
		ipbanmenu:OpenPlayer(id, p)
	end
end

-- Remove USGN temp. ban
usgnbanmenu = CreateMenu("Remove USGN temp. ban")
function usgnbanmenu:getcustombutton(b)
	local i = 0
	for k, v in pairs(SERVER_DATA["tempbanusgn"]) do
		i = i + 1
		if i == b then return k.."|"..v.." Mins." end
	end
end

function usgnbanmenu:click(id,b,p)
	local i = 0
	for k, v in pairs(SERVER_DATA["tempbanusgn"]) do
		i = i + 1
		if i == b then
			SERVER_DATA["tempbanusgn"][k] = nil
		end
	end
	if b > 0 then
		usgnbanmenu:OpenPlayer(id, p)
	end
end

-- Remove name temp. ban
namebanmenu = CreateMenu("Remove Name temp. ban")
function namebanmenu:getcustombutton(b)
	local i = 0
	for k, v in pairs(SERVER_DATA["tempbanname"]) do
		i = i + 1
		if i == b then return k.."|"..v.." Mins." end
	end
end

function namebanmenu:click(id,b,p)
	local i = 0
	for k, v in pairs(SERVER_DATA["tempbanname"]) do
		i = i + 1
		if i == b then
			SERVER_DATA["tempbanname"][k] = nil
		end
	end
	if b > 0 then
		namebanmenu:OpenPlayer(id, p)
	end
end