When a player presses a key twice(like u press the "E" button 2 times) then that player will become very fast and go through walls and at the same time shooting many grenades,how do i do that?
Forum




When i press a key twice?
3 replies



When a player presses a key twice(like u press the "E" button 2 times) then that player will become very fast and go through walls and at the same time shooting many grenades,how do i do that?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- Creates an array function initArray() 	local array = {} 	for i = 1, 32 do -- count from 1 to 32 (For every player ID) 		array[i]=0 -- Every value is "0" 	end 	return array end check_button = initArray() button = {x=50,y=50} -- Button x and y (in tiles) addhook("usebutton","godmode") function godmode(id,x,y) 	if x==button[x] and y==button[y] then -- If its the button 		check_button[id] = check_button[id]+1 -- set player array +1 	end 	if check_button[id] >= 2 then -- if he pressed it the second time 		check_button[id] = 0 -- set it to 0 		parse("speedmod "..id.." 200") -- make him fast 		-- Code for moving through walls and shooting many grenades 	end end -- Not tested
Edit:
Do you want to have more than one button?
Do you mean a button on the map or just the "E" key on the keyboard?
Does the player have to press the button 2 times in general or 2 times in a certain time distance?
Quote
Do you mean a button on the map or just the "E" key on the keyboard?
The "E" key in the keyboard
Quote
Does the player have to press the button 2 times in general or 2 times in a certain time distance?
Pressing the "E" key 2 times.
Please search before posting!



