English Flashlight and Speed

5 replies
Goto Page
To the start Previous 1 Next To the start
17.03.13 07:09:34 pm
Up
limonata
User
Offline Off
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..

Code:
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
17.03.13 07:13:11 pm
Up
Infinite Rain
Reviewer
Offline Off
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 >
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
17.03.13 07:48:32 pm
Up
Shawni
User
Offline Off
Since when the speed depends on the shoes ?
We die once, do i have to hide to be visible ?
17.03.13 07:50:32 pm
Up
limonata
User
Offline Off
I pressed the buton and selected nike. It shouldnt give me speed while i open the flashlight. Thats all.
18.03.13 06:47:40 am
Up
MikuAuahDark
User
Offline Off
So you want if you press a button on a map then it shows a menu?

Code:
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
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
18.03.13 06:51:18 am
Up
limonata
User
Offline Off
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