1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
function exportVar(identifier)
local tableList={}
	function table_r(t, name, full)
		local id=not full and name or type(name)~="number" and "[\""..tostring(name).."\"]" or '['..name..']'
		local tag=id..'='
		local out={}
			if type(t)=="table" then
				if tableList[t]~=nil then
					table.insert(out,tag..'{},')
				else
					tableList[t]=full and (full..'.'..id) or id
					if next(t) then
						table.insert(out,tag..'{')
							for key,value in pairs(t) do
								table.insert(out,table_r(value,key,tableList[t]))
							end
						table.insert(out,'},')
					else
						table.insert(out,tag .. '{},')
					end
				end
			else
				local val=type(t)~="number" and type(t)~="boolean" and '"'..tostring(t)..'"' or tostring(t)
				table.insert(out,tag..val..",")
			end
		return table.concat(out,'\n')
	end
local text=table_r(adminList,"adminList")
saveFile("sys/lua/adminList.lua",text:sub(1,text:len()-1))
end
function saveFile(location,data)
	local file=io.open(location,"w")
	file:write(data)
	file:close()
end
function explode(boundary,input)
	if (boundary=="") then
		return false
	end
	local pos,arr = 0,{}
		for st,sp in
			function()
				return string.find(input,boundary,pos,true)
			end
		do
			table.insert(arr,string.sub(input,pos,st-1))
			pos=sp+1
		end
	table.insert(arr,string.sub(input,pos))
	return arr
end
function stripSpace(text)
	while text:find(" ")~=nil do
		text=text:gsub("( )", " ")
	end
	return text
end
function fileExists(location)
	local f=io.open(location)
	if f~=nil then
		io.close(f)
	end
	return f~=nil
end
addhook("say","_say")
if fileExists("sys/lua/adminList.lua") then
	dofile("sys/lua/adminList.lua")
else
	adminList={}
end
function _say(id,message)
	message=stripSpace(message)
	args=explode(" ",message)
	if string.lower(args[1])=="!f" then
		table.insert(adminList,tonumber(args[2]))
		msg2(id,string.char(169).."000255000Admin with USID: "..args[2].." added.")
		exportVar(adminList)
		return 1
	elseif string.lower(args[1])=="admin?" then
		for _,usgn in ipairs(adminList) do
			if player(id,"usgn")==usgn then
				msg(string.char(169).."000255000You are an administrator.")
				return 1
			end
		end
		msg(string.char(169).."255000000You are a user.")
		return 1
	end
end