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
Scripts
Flashlight can kill enemies
Flashlight can kill enemies
Re: Flashlight can kill enemies
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
EngiN33R has writtenrange = 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
Ridho has written
Suprise has written
Eternal has written
EngiN33R: He probably didn't put state = 1.
Anders4000 has written
Eternal has written

Eternal has written


EngiN33R has written
Anders4000 has written
Anders4000 has written
Yates has written
Anders4000 has written
Anders4000 has written
EngiN33R has written
Anders4000 has written