Forum

> > CS2D > Scripts > Flashlight and Speed
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Flashlight and Speed

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Flashlight and Speed

limonata
User Off Offline

Zitieren
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
1× editiert, zuletzt 17.03.13 19:37:38

alt Re: Flashlight and Speed

Infinite Rain
Reviewer Off Offline

Zitieren
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 >

alt Re: Flashlight and Speed

limonata
User Off Offline

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

alt Re: Flashlight and Speed

MikuAuahDark
User Off Offline

Zitieren
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

alt Re: Flashlight and Speed

limonata
User Off Offline

Zitieren
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht