Forum

> > CS2D > Scripts > Flashlight can kill enemies
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Flashlight can kill enemies

25 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Flashlight can kill enemies

Eternal
User Off Offline

Zitieren
Hello guys i want the script that is Flashlight can kill eneies
Example
when i toggle to open flashlight to kill my nearby enemies

please make me one or give example flashlight can kill enemies to me

THANK YOU EVERY ANSWER

alt Re: Flashlight can kill enemies

EngiN33R
Moderator Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
range = 100 -- range within which the torch will kill enemies

addhook("flashlight","killtorch")
function killtorch(id,state)
	if state==1 then
		for _,iid in pairs(player(0,"tableliving")) do --check all players that are alive
			if iid~=id then --if the player being checked isn't the torch activator
				local ix=player(id,"x")
				local iy=player(id,"y")
				local iix=player(iid,"x")
				local iiy=player(iid,"y")	
				if ((ix-iix)*(ix-iix)+(iy-iiy)*(iy-iiy))<=range then --mathematical formula for checking distancethen kill player
					parse("customkill "..id.." Torch "..iid)
				end
			end
		end
	end
end

alt Re: Flashlight can kill enemies

Suprise
BANNED Off Offline

Zitieren
user EngiN33R hat geschrieben
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
range = 100 -- range within which the torch will kill enemies

addhook("flashlight","killtorch")
function killtorch(id,state)
	if state==1 then
		for _,iid in pairs(player(0,"tableliving")) do --check all players that are alive
			if iid~=id then --if the player being checked isn't the torch activator
				local ix=player(id,"x")
				local iy=player(id,"y")
				local iix=player(iid,"x")
				local iiy=player(iid,"y")	
				if ((ix-iix)*(ix-iix)+(iy-iiy)*(iy-iiy))<=range then --mathematical formula for checking distancethen kill player
					parse("customkill "..id.." Torch "..iid)
				end
			end
		end
	end
end


Torch lol

alt Re: Flashlight can kill enemies

Eternal
User Off Offline

Zitieren
user Ridho hat geschrieben
i think, it good in zombie mode, when player move his flashlight to zombie, it decrease the zombie hp
hehe

yeah i think like this i want to use flashlight to hurt zombies


Ahhh it not work how to do it work? i don't understand
1× editiert, zuletzt 12.03.12 15:38:00

alt Re: Flashlight can kill enemies

EngiN33R
Moderator Off Offline

Zitieren
user Suprise hat geschrieben
Torch lol


I don't see anything funny.

user Eternal hat geschrieben
Ahhh it not work how to do it work? i don't understand


How exactly does it not work? And stop putting crying smilies for goodness' sakes.

alt Re: Flashlight can kill enemies

Anders4000
User Off Offline

Zitieren
@user EngiN33R: He probably didn't put state = 1.
Also, I don't like that you call it "iid". iid is short for Item ID.

EDIT: Forget about that state thing ^^, I though it was something else.

alt Re: Flashlight can kill enemies

EngiN33R
Moderator Off Offline

Zitieren
user Anders4000 hat geschrieben
Also, I don't like that you call it "iid". iid is short for Item ID.


You do know that I don't care and call my variables whatever the hell I want?

user Eternal hat geschrieben
aaaa -..-
how to make it work i don't understand?


We won't be able to bloody help you unless you tell us whether or not there's an error and if there is, what error is it.

alt Re: Flashlight can kill enemies

Eternal
User Off Offline

Zitieren
when i turn on flashlight [F] enemies aren't hurt and take any damage,yeah i call it not work but if i see on console it works
i am confuse how to install?,
i install exactly?,
how to do it works?


i test it very sure

Sorry for my bad english
i am not in your country

alt Re: Flashlight can kill enemies

Grulf
User Off Offline

Zitieren
user Eternal hat geschrieben
when i turn on flashlight [F] enemies aren't hurt and take any damage,yeah i call it not work but if i see on console it works
i am confuse how to install?,
i install exactly?,
how to do it works?


i test it very sure

Sorry for my bad english
i am not in your country


put the script in the [cs2d directory]/sys/lua/server.lua
d00d

alt Re: Flashlight can kill enemies

Anders4000
User Off Offline

Zitieren
user EngiN33R hat geschrieben
user Anders4000 hat geschrieben
Also, I don't like that you call it "iid". iid is short for Item ID.


You do know that I don't care and call my variables whatever the hell I want?

Well, I didn't mean to offend you. But it's bad not to call variables things that other people understand.
Adding comments, and making the code the most understandable possible is being a good programmer.

alt Re: Flashlight can kill enemies

Anders4000
User Off Offline

Zitieren
user Yates hat geschrieben
user Anders4000 hat geschrieben
and making the code the most understandable possible is being a good programmer.

Lolno. Coding something that works is being a good programmer.

U won't get a job without the skills i mentioned.

alt Re: Flashlight can kill enemies

EngiN33R
Moderator Off Offline

Zitieren
user Anders4000 hat geschrieben
Well, I didn't mean to offend you. But it's bad not to call variables things that other people understand.
Adding comments, and making the code the most understandable possible is being a good programmer.


There's quite a bit of comments there, and I could call the variable 'dickshit', but I didn't, so it doesn't really matter as long as people understand which variable corresponds to what. What if in this case iid is imaginary ID for me? It doesn't matter. And you can't say that this script is not commented well enough because it is.

Also, I must agree with Yates - being a good programmer is mainly producing things that work. Adding comments and making the code understandable come in in certain situations - like this one.

alt Re: Flashlight can kill enemies

Anders4000
User Off Offline

Zitieren
user EngiN33R hat geschrieben
user Anders4000 hat geschrieben
Well, I didn't mean to offend you. But it's bad not to call variables things that other people understand.
Adding comments, and making the code the most understandable possible is being a good programmer.


There's quite a bit of comments there, and I could call the variable 'dickshit', but I didn't, so it doesn't really matter as long as people understand which variable corresponds to what. What if in this case iid is imaginary ID for me? It doesn't matter. And you can't say that this script is not commented well enough because it is.

Also, I must agree with Yates - being a good programmer is mainly producing things that work. Adding comments and making the code understandable come in in certain situations - like this one.

I didn't say your code wasn't commented. I just think it's a big and important part of coding.
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht