English Hello I need Flash light script

8 replies
Goto Page
To the start Previous 1 Next To the start
Up
UgnsLTU112
User
Offline Off
Hello all i need flashlight script for my survival map i have a Gfx for light but i don't know code , Also it will be cool if my map have others players skins ..... but i am fresh on Scripts.
17.06.13 04:50:26 pm
Up
TimeQuesT
User
Offline Off
CS2D already supports flashlight.
Muh
17.06.13 06:04:17 pm
Up
_Yank
User
Offline Off
http://unrealsoftware.de/files_show.php?file=601

Download it and install it. Then open the flashlight.lua file inside "sys/lua" with notepad or some txt editor, delete what is writed there and paste this :
Code:
1
2
3
4
5
6
7
addhook("spawn","lightz")
function lightz(id)
     local light=image("gfx/sprites/light.bmp",1,1,id+200)
     imageblend(light,1)
     imagecolor(light,255,255,255)
     imagealpha(light,0.5)
end


And about the player skins i can do it but it will cover some things (knife,etc) and you need to give we what skins you want.
17.06.13 07:24:35 pm
Up
UgnsLTU112
User
Offline Off
fairyXD
Its on the older version read in the coments and it dont working for me , also i been maked your code into a .lua but how to active it it will be coolest if light will be actived by f2 or f3
edited 1×, last 17.06.13 07:54:25 pm
17.06.13 08:04:12 pm
Up
_Yank
User
Offline Off
No it isnt old, the DC made a flashlight but is very diferent, that flash light is not a lantern, it is in the cursor.
It works
Just open flashlight.lu, delete everything and paste this :
Code:
1
2
3
4
5
6
7
8
9
addhook("serveraction","lightzas")
function lightzas(id,action)
     if action == 2
          local light=image("gfx/sprites/light.bmp",1,1,id+200)
          imageblend(light,1)
          imagecolor(light,255,255,255)
          imagealpha(light,0.5)
     end
end

PS: I make it to work when player presses f3.
Please verify if is installed correct
18.06.13 03:37:03 pm
Up
Sneaky
User
Offline Off
Arghh , press F and boom a flashlight .....

Cs2d already haves a flashlight
Where ever you go ,your soul goes with you.
18.06.13 09:02:32 pm
Up
_Yank
User
Offline Off
Dude... cs2d dont have a "real" flashlight. Please guys try to understand what he's meaning. He means a lantern.
18.06.13 09:31:30 pm
Up
Chingy
User
Offline Off
@user _Yank: What did you expected on a forum filled with tons of idiots and scumbags?
19.06.13 03:15:31 am
Up
MikuAuahDark
User
Offline Off
user Sneaky has written:
Arghh , press F and boom a flashlight .....

Cs2d already haves a flashlight

Yes CS2D have. but only the flare will turned on when you press "F". if you tired to use it with lighting then it will crash your CS2D

This is the code. It's hooked to flashlight hook(Press <Flashlight Key>(default F))
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
36
37
38
FlashLightState={}
for i=1,32 do FlashLightState[i]=0 end

HasStartround=false     -- Set to true if your server would start round more than 1 times

addhook("flashlight","Methane")
function Methane(id,state)
     if state==1 then
          FlashLightState[id]=image("gfx/sprites/light.bmp<a>",1,0,id+100)
     else
          freeimage(FlashLightState[id])
          FlashLightState[id]=0
     end
end

addhook("join","Legacy")
function Legacy(id)
     FlashLightState[id]=0
end

addhook("leave","Welcome")
function Welcome(id)
     if FlashLightState[id]>0 then
          freeimage(FlashLightState[id])
          FlashLightState[id]=0
     end
end

if HasStartround then
     addhook("startround","StartIt")
     function StartIt()
          for _, id in pairs(player(0,"table")) do
               if FlashLightState[id]>0 then
                    FlashLightState[id]=image("gfx/sprites/light.bmp<a>",1,0,id+100)
               end
          end
     end
end
file cs2d LuaJIT for Dedicated Server (9) JIT POWER! | Know your Lua errors! | don't use PM for scripting help!
To the start Previous 1 Next To the start