Thanks in Advance
Ajmin
edited 1×, last 05.12.14 01:14:16 pm
Scripts
[Solved]Twice "E" (use) opens a menu
[Solved]Twice "E" (use) opens a menu
1

use is only triggered when you actually use something and not when you just press the key without pointing at anything usable.
serveraction hook. By default the serveractions are bound to F2, F3 and F4 I think so you could use these keys instead.
DC: Actually i found some servers using this!
DC: Are you sure? If I recall correctly I've used the "use" hook without being actually using something.
Ajmin: I'm not sure if this would work, try it.PlayerLastUse = {}
addhook("use","UseTwice")
function UseTwice(id, event)
	if PlayerLastUse[id] and os.clock() - PlayerLastUse[id] < 0.5 then
		-- Open the menu
	end
	PlayerLastUse[id] = os.clock()
end
Starkkz: Works fine! Thank You !
Ajmin: The Fws server one works using a timer (I wrote it) but I think that the @
Starkkz way is better.
_Yank: yeh,i was trying to do it with the timer but still i was unable to figure out.pressInterval = 600
pPresses = {}
for i = 1, 32 do pPresses[id] = 0 end
function pPress(id, event)
	if event == 0 then
		pPresses[id] = pPresses[id] + 1
		
		freetimer(pressInterval, "kPresses", id)
		timer(pressInterval, "kPresses", id)
		
		if pPresses[id] >= 2 then -- You can change it for example you want penta press O.o
			-- Do da stuff
		end
	end
end
function kPresses(id)
	pPresses[id] = 0
end
addhook("use","pPress")
1
