Please show me how!
Admin/mod comment
§4.4 - Titles/texts in capital letters are impolite and undesired
Scripts
ADD & REMOVE VIP
ADD & REMOVE VIP
§4.4 - Titles/texts in capital letters are impolite and undesired
Sweet Death has written
SektoR_ has written
SektoR_I'll do all the code for you if you give me something in return.function Array(s,v)
	local a = {}
	for i = 1,s do
		a[i] = v
	end
	return a
end
vip = Array(32,0)
function LoadAccount(id)
	local usgn = player(id,"usgn")
	if usgn > 0 then
		local file = io.open("sys/lua/"..usgn..".txt","r")
		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/"..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)
for pl = 1,32 do
	if txt == "!addvip "..pl.."" then
		vip[pl] = 1
		SaveAccount(pl,1)
		return 1
	elseif txt == "!removevip "..pl.."" then
		vip[pl] = 0
		SaveAccount(pl,0)
		return 1
	end
end
end
Suprise has writtenlocal file = io.open("sys/lua/"..usgn..".txt","r")
local file = io.open("sys/lua/"..usgn..".txt","w")
local file = io.open("sys/lua/saves/"..usgn..".txt","r")
local file = io.open("sys/lua/saves/"..usgn..".txt","w")
Gaios: Also better not add vip if he is already, don't you think?^^addhook("say","_sayHook")
function _sayHook(id,txt)
for pl = 1,32 do
if txt == "!addvip "..pl.."" then
vip[pl] = 1
SaveAccount(pl,1)
return 1
elseif txt == "!removevip "..pl.."" then
vip[pl] = 0
SaveAccount(pl,0)
return 1
end
end
end
addhook("say","_sayHook")
function _sayHook(id,txt)
	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
Gaios and @
Suprise: Thanks! But as I'll add commands to it? How menu and others?
addhook("serveraction","a")
function a(if,a)
	if a == 1 then
		if vip[id] == 1 then
		menu(id,"Test,A,B,C")
		else
		msg2(id,"©255255255Error, Only VIP Acess the Menu !")
		end
	end
end
addhook("menu","b")
function b(id,t,b)
	if t == "Test" then
		if b == 1 then
			msg("123")
		elseif b == 2 then
			msg("1234")
		elseif b == 3 then
			msg("12345")
		end
	end
end
addhook("say","c")
function c(id,t
		if vip[id] == 1 then
			if t == "!on"
			msg("©255255255 VIP : "..player(id,"name").." ON.")
		else
			msg2(id,"©255255255 Error, Commands Only to Vips")
			return 1
		end
	end
end
sheeL! I was just wondering lines 4 and 27!
addhook("serveraction","_action")
function _action(id,action)
	if action == 1 then
		if vip[id] == 1 then
			menu(id,"Test,A,B,C") -- THE MENU
		else
			 --It's pointless to put Error text, in my opinon.
		end
	end
end
addhook("menu","_menu")
function _menu(id,title,button)
	if title == "Test" then -- TITTLE OF MENU
		if button == 1 then -- B = BUTTONS IN MENU
			msg("123") --You can use menu(id,"Test2") too!
		elseif button == 2 then
			msg("1234")
		elseif button == 3 then
			msg("12345")
		end
	end
end
addhook("say","_say")
function _say(id,t)
	if t == "!on" then
		if vip[id] == 1 then
			msg("©255255255"..player(id,"name").." |VIP| "..txt)
			return 1
		else
			msg2(id,"©255255255This command is only for Vip/Admin!")
		end
	end
end
Suprise - @
Gaios: When executed, this error appears: [...]:861: attempt to call field 'open' (a nil value)local file = io.open("sys/lua/OCP 2.0/OCP config/"..usgn..".txt","r")
SektoR_ has written
sheeL has writtenlist_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
Gaios has written