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
function totable(t,match)
local cmd = {}
if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end
function saveToFile()
local script={}
local File = io.open("maps/users.lua", "r")
for line in File:lines() do
if line~="adminlist = {" and not line:find("adminlist") then
table.insert(script,line)
else
break
end
end
File:close()
local File = io.open("maps/users.lua", "w")
for _,l in pairs(script) do
File:write(l)
end
File:write("\nadminlist = {\n")
for k,u in pairs(adminlist) do
File:write("["..k.."] = "..u..",\n")
end
File:write("}")
File:close()
end
addhook("say","dresadd")
function dresadd(id,txt)
local p = totable(txt)
local cmd = (p[1])
if cmd == "!admin" then
local us = tonumber(p[2])
table.insert(adminlist,us)
saveToFile()
end
end
adminlist={}