Forum

> > CS2D > Scripts > Changing Menu
Forums overviewCS2D overview Scripts overviewLog in to reply

English Changing Menu

2 replies
To the start Previous 1 Next To the start

old Changing Menu

BrunoRZ
User Off Offline

Quote
I have the following menu here

Quote
addhook("menu", "action")
function action (id, menu, select)
     if (menu == "Vagas de Emprego") then

     if (select == 1) then
     parse("setpos "..id.." 2800 1427")
     end

     if (select == 2) then
     parse("setpos "..id.." 2090 1150")
     end
     end
end


How can I disable option 2, by selecting it ?
and also adding a description to it ?

old Re: Changing Menu

EngiN33R
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
disableds2={}

function checkdis2(id)
if disableds2[id] then return "B" end return "(B)"
end

function testmenu(id)
if (not disableds2[id]) then
	menu(id,"Test Menu,A,"..checkdis2(id)..",C")
end

addhook("menu","testmenuf")
function testmenuf(id,menu,sel)
	if (menu=="Test Menu") then
		if (sel==2) then
			if not disableds2[id] then disableds2[id]=true end
		end
	end
end

May not be the best solution, but that's what I use. Also, the second button will only be disabled once - you won't be able to re-enable it unless you use the console.

old Changing my mind

BrunoRZ
User Off Offline

Quote
So I'll quit enabling/disabling button for now.

But how about adding/removing a description for a certain menu option, by choosing it ?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview