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
list_adm = {00000}
-- ADM
function ADMS(id)
for _, usgn in ipairs(list_adm) do
if (player(id,"usgn") == usgn) then
return true
end
end
return false
end
-- ARRAY
function initArray(m)
local array = {}
for i = 1, m do array[i]=0
end
return array
end
-- CODE
vip = initArray(32,0)
function LoadAccount(id)
local usgn = player(id,"usgn")
if usgn > 0 then
local file = io.open("sys/lua/OCP 2.0/OCP config/"..usgn..".txt","r") -- Line error.
if file then
vip[id] = tonumber(file:read());
end
end
end
function SaveAccount(id,level)
local usgn = player(id,"usgn")
if usgn > 0 then
local file = io.open("sys/lua/OCP 2.0/OCP config/"..usgn..".txt","w")
file:write(level)
file:close()
end
end
addhook("join","_joinHook")
function _joinHook(id)
vip[id] = 0
LoadAccount(id)
if vip[id] == 1 then
msg2(id,"©000255000You are VIP!@C")
end
end
addhook("say","_sayHook")
function _sayHook(id,txt)
if ADMS(id) then
for pl = 1,32 do
if txt == "!addvip "..pl.."" then
if vip[pl] == 0 then
vip[pl] = 1
SaveAccount(pl,1)
msg2(pl,"©255255255You're now VIP!")
return 1
else
msg2(id,"©255000000Error: The player you wanted to add is already VIP!")
end
elseif txt == "!removevip "..pl.."" then
if vip[pl] == 1 then
vip[pl] = 0
SaveAccount(pl,0)
msg2(pl,"©255255255Your vip status has been removed!")
return 1
else
msg2(id,"©255000000Error: This guy is NOT VIP!")
end
end
end
end -- if ADMS
end