Forum

> > CS2D > Scripts > Hook menu button
Forums overviewCS2D overview Scripts overviewLog in to reply

English Hook menu button

4 replies
To the start Previous 1 Next To the start

old Hook menu button

Joni And Friends
User Off Offline

Quote
I have problem with hook menu, i want to disable button X (closing) i has make the code for test like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("serveraction","_s")
function _s(id,ac)
     if ac==1 then
        menu(id,"Test,1,2,3")
    end
end
addhook("menu","_m")
function _m(id,title,button)
           if title=="Test" then
              if button==0 then
           msg2(id,"You cant close the menu")
           menu(id,"Test,1,2,3")
           end
      end
end
I has disable button close, but when i click button X (closing) then menu is closed, so how to disable button X (closing) ?

old Re: Hook menu button

Hajt
User Off Offline

Quote
I think you can't disable X button, this is impossible.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("serveraction","_s")
addhook("menu","_m")

function _s(id, ac)
	if ac == 1 then
		menu(id,"Test,1,2,3")
	end
end

function _m(id, title, button)
	if title == "Test" then
		if button == 0 then
			menu(id,"Test,1,2,3")
		end
	end
end

old Re: Hook menu button

DC
Admin Off Offline

Quote
Please note that menus can be closed in a lot of ways. Also by simply opening another menu. It's impossible to prevent this so you have to design your menus/scripts with that in mind.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview