Forum

> > CS2D > Scripts > Admin Mode on off
Forums overviewCS2D overview Scripts overviewLog in to reply

English Admin Mode on off

2 replies
To the start Previous 1 Next To the start

old Admin Mode on off

limonata
User Off Offline

Quote
Hello there i tried to make an admin mode lua but it doesnt work idk here is the lua

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
adm = {50998}

ps = 0


addhook("join","yet")
function yet(id)
		ps = 0
	end

addhook("say","asd")
function asd(id,txt)
	for _, a in pairs (adm) do
		if player(id,"usgn") == a then
			if ps == 1 then
				if txt == "!hi" then
				msg("Test lua")
					if ps == 1 then
				menu(id,"Admin,Admin|On")
						elseif ps ~= 1 then
				menu(id,"Admin,Admin|Off")
					end
				end
			end
		end
	end
end

addhook("serveraction","asd")
function asd(id,act)
	for _, a in pairs (adm) do
		if player(id,"usgn") == a then
			if act == 1 then
			menu(id,"Admin,Admin|Off")
			end
		end
	end
end

addhook("menu","a")
function a(id,tit,but)
	if tit == "Admin" then
		if but == 1 then
		ps = 1
			elseif but == 1 and ps == 1 then
		ps = 0
		end
	end
end
edited 1×, last 09.03.13 07:41:35 pm

old Re: Admin Mode on off

cortz
Super User Off Offline

Quote
you didnt initialize 'but'
ps is a global value, you should assign it to individual players instead.

and i dont think you need 'exists' in the join hook.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview