Forum

> > CS2D > Scripts > My lua dont work
Forums overviewCS2D overview Scripts overviewLog in to reply

English My lua dont work

5 replies
To the start Previous 1 Next To the start

old My lua dont work

Forever Alone
User Off Offline

Quote
Hey! In cs2d console nothing to say but menu dont work. What is wrong?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("serveraction","menus")
function menus(id,action)
     if action == 1 then
          menu(id,"Menu,1,2,3")
     end
end

addhook("menu","menu")
function menu(id,menu,sel)
	if title == "Menu" then
		if button == 1 then
			parse ("speedmod "..id.." 50")
		end
	end
end
edited 1×, last 17.05.14 03:01:57 pm

old Re: My lua dont work

RedizGaming
GAME BANNED Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("serveraction","_menus")
function _menus(id,action)
     if action == 1 then
          menu(id,"Menu,1,2,3")
     end
end

addhook("menu","_menu")
function _menu(id,title,button)
	if title == "Menu" then
		if button == 1 then
			parse ("speedmod "..id.." 50")
		end
	end
end

function _menu(id,menu,sel) -> _menu(id,title,button)

old Re: My lua dont work

TopNotch
User Off Offline

Quote
You assigned "id, menu, sel". So you should use:
1
2
3
4
5
6
7
8
9
if menu == "Menu" then
	if sel == 1 then
		-- code
	elseif sel == 2 then
		-- code
	elseif sel == 3 then
		-- code
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview