Forum

> > CS2D > Scripts > Flashlight and Speed
Forums overviewCS2D overview Scripts overviewLog in to reply

English Flashlight and Speed

5 replies
To the start Previous 1 Next To the start

old Flashlight and Speed

limonata
User Off Offline

Quote
Hi all in my map i put a trigger_use and when you press the button there will be a menu when i click Nike my speedmod being 35 but when if my flashligt is active then speedmod will be active elseif my flaslight is deactive then my speedmod will be normal (0). here is the codes..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
addhook("menu","onMenu")
function onMenu(id,tit,btn)
     if tit == "Shoe Seller" then
          if btn == 1 then -- Adidas
               parse("speedmod "..id.." 35")
          elseif btn == 2 then -- Nike
               parse("speedmod "..id.." 27")
          elseif btn == 3 then -- Puma
               parse("speedmod "..id.." 19")
          elseif btn == 4 then -- Jump
               parse("speedmod "..id.." 12")
          elseif btn == 5 then
               parse("speedmod "..id.." 0")
          end
     end
end

addhook("flashlight", "flashlight_hook")
function flashlight_hook(id, state)
     if state == 0 then
          parse("speedmod "..id.." 0")
     end
end

So i just need the active speedmod with flashlight. Thanks
edited 1×, last 17.03.13 07:37:38 pm

old Re: Flashlight and Speed

Infinite Rain
Reviewer Off Offline

Quote
Why don't you put tabs?! No one will ever help you if you won't do this, because code look like a shit if you do it like this.

Fixed version >

old Re: Flashlight and Speed

limonata
User Off Offline

Quote
I pressed the buton and selected nike. It shouldnt give me speed while i open the flashlight. Thats all.

old Re: Flashlight and Speed

MikuAuahDark
User Off Offline

Quote
So you want if you press a button on a map then it shows a menu?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
pV={}
for i=1,32 do
	pV[i]=0
end
addhook("use","au_ah_gelap")
function au_ah_gelap(id,event,data,x,y)
	if event==100 and x==trigger_use_x and y==trigger_use_y then
		menu(id,"Shoe Seller,Adidas,Nike,Puma,Jump,None")
	end
end

addhook("menu","onMenu")
function onMenu(id,tit,btn)
     if tit == "Shoe Seller" and pV[id]==1 then
          if btn == 1 then -- Adidas
               parse("speedmod "..id.." 35")
          elseif btn == 2 then -- Nike
               parse("speedmod "..id.." 27")
          elseif btn == 3 then -- Puma
               parse("speedmod "..id.." 19")
          elseif btn == 4 then -- Jump
               parse("speedmod "..id.." 12")
          elseif btn == 5 then
               parse("speedmod "..id.." 0")
          end
     end
end

addhook("flashlight", "flashlight_hook")
function flashlight_hook(id, state)
	pV[id]=state
     if state == 0 then
          parse("speedmod "..id.." 0")
     end
end

Later, please more specific. Where the X and Y of the trigger_use

old Re: Flashlight and Speed

limonata
User Off Offline

Quote
Guys im sorry for disturb you i solved my problem. How? So there is flashlight hook. I didnt know it i used it and now im open/close speed wih flashlight Thanks all.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview