When i press a buton:
1
(id,title,buton)
Then Locks the pressed buton, making that i cant press it again until unlocks pressing another buton...
Please help me
==SOVED==
edited 1×, last 05.03.12 08:56:27 pm
Scripts
Lock buton when
Lock buton when
1

(id,title,buton)
pressed = {} for i = 1,32 do pressed[i] = false
addhook("join","a")
function a(id)
pressed[id] = false
end
addhook("serveraction","b")
function b(id,button)
	if button == 1 then
		if pressed[id] == false then
			--YOUR THING HERE
			pressed[id] = true
		end
	end
end
EP has written
Cons, is it a menu button or a trigger button?
addhook("serveraction","dresamenu0")
function dresamenu0(id,act)
if act==1 then
menu(id,"TEST,tab1,tab2")
end
return 1
end
pressed = {} for i = 1,32 do pressed[i] = false
addhook("join","a")
function a(id)
pressed[id] = false
end
end
addhook("menu","dresamenu1")
function dresamenu1(id,title,buton)
if title=="TEST" then
if b == 1 then
if pressed[id] == false then
msg2(id,"©255000000It Works!")
pressed[id] = true
end
end
end
end
addhook("serveraction","dresamenu0")
function dresamenu0(id,act)
	if act==1 then
		menu(id,"TEST,tab1,tab2")
	end
	return 1
end
pressed = {}
for i = 1,32 do
	pressed[i] = false
end
addhook("join","a")
function a(id)
	pressed[id] = false
end
addhook("menu","dresamenu1")
function dresamenu1(id,title,buton)
	if title=="TEST" then
		if b == 1 then
			if pressed[id] == false then
				msg2(id,"©255000000It Works!")
				pressed[id] = true
			end
		end
	end
end
Anders4000: It's kind of messy, to be more precise - the arguments for the menu function.function dresamenu0(id)
	menu(id,"TEST,tab1,tab2")
end
addhook("serveraction","dresamenu0")
function dresamenu1(id,act)
	if act==1 then
		dresamenu0(id)
	end
	return 1
end
pressed = {}
for i = 1,32 do
	pressed[i] = false
end
addhook("join","a")
function a(id)
	pressed[id] = false
end
addhook("menu","dresamenu1")
function dresamenu2(id,title,b)
	if title=="TEST" then
		if b == 1 then
			if pressed[id] == false then
				msg2(id,"©255000000It Works!")
				pressed[id] = true
			else
				dresamenu0(id)
			end
		end
		if b == 2 then
			if pressed[id] == true then
				msg2(id,"©000255000Turn It Back On!")
				pressed[id] = false
			else
				dresamenu0(id)
			end
		end
	end
end
Anders4000 has writtenaddhook("serveraction","dresamenu0")
function dresamenu0(id,act)
if act==1 then
if buton == 1 then
menu(id,"Unlock Weapows with Levels,DEAGLE|Level one,TMP|Level two)
EngiN33R: I just cleaned up... I personally never work and never have worked with menus 
Cons: Nah, sorry. But
EngiN33R does.
EngiN33R has written
Anders4000: It's kind of messy, to be more precise - the arguments for the menu function.
omg function Array(size,value)
local array = {}
for i = 1, size do
array[i]=value
end
return array
end pressed = Array(32,false)
addhook("join","a") function a(id) pressed[id] = false end
function Array(size,value) --nasty function
local array = {}
for i = 1, size do
array[i]=value
end
return array
end
menus = {
	weapon_menu = {
		title = "Weapons",
		buttons = {
			[1] = {
				locked = "(Deagle)|Lvl 1",
				unlocked = "Deagle",
				state = {},
				dstate = false,
				func = function(id)
					parse("equip "..id.." 3")
					menus.weapon_menu.buttons[2].state = false --unlock second button
				end
			},
			[2] = {
				locked = "(TMP)|Lvl 2",
				unlocked = "TMP",
				state = {},
				dstate = true,
				func = function(id)
					parse("equip "..id.." 21")
				end
			}
		}
	}
}
for _,menu in pairs(menus) do
	for _,button in pairs(menu.buttons) do
		button.state=Array(32,button.dstate)
	end
end
function mmenu(id,menu)
	local m=menu.title..","
	for k,b in pairs(menu.buttons) do
		if b.state then
			m=m..b.unlocked
		else
			m=m..b.locked
		end
		if k~=#menu.buttons then
			m=m..","
		end
	end
	menu(id,m)
end
addhook("serveraction","openmenu")
function openmenu(id,a)
	if a==3 then
		mmenu(id,menus.weapon_menu) --syntax
	end
end
Cons has written
EngiN33R has written
EngiN33R has writtenmenus.weapon_menu.buttons[2].state[id] = true
EngiN33R has writtenmenus.weapon_menu.buttons[2].state[id] = true
1
