Forum

> > CS2D > Scripts > Hello I need Flash light script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Hello I need Flash light script

8 replies
To the start Previous 1 Next To the start

old Hello I need Flash light script

UgnsLTU112
User Off Offline

Quote
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.

old Re: Hello I need Flash light script

_Yank
User Off Offline

Quote
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 :
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.

old Re: Hello I need Flash light script

UgnsLTU112
User Off Offline

Quote
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

old Re: Hello I need Flash light script

_Yank
User Off Offline

Quote
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 :
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

old Re: Hello I need Flash light script

MikuAuahDark
User Off Offline

Quote
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))
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview