addhook("say","zm_lila_say")
function zm_lila_say(id,txt)
x = player(id,"tilex")
y = player(id,"tiley")
	if (txt=="627342") then
		if (x==34) and (y==28) then
			parse("trigger cwall")
			msg("©000255000Correct Code")
		end
		return 1
	end
end

parse("sv_maxplayers 32")
parse("sv_gm 4")
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

addhook("join","zm_lila_join")
function zm_lila_join(id)
flashlight[id]=0
end

flashlight = initArray(32)
addhook("serveraction","zm_lila_flashlight")
function zm_lila_flashlight(id,act)
	if (act==1) then
		if (flashlight[id]>=1) then
			flashlight[id]=0
			freeimage(id) 
			id1=image("gfx/sprites/flare2.bmp",0,0,100+id) 
			imagescale(id1,1,1) 
			imageblend(id1,1) 
			imagealpha(id1,0.0)
			parse("sv_sound extasy/flash.wav")
		else
			flashlight[id]=1
			freeimage(id) 
			img=image("gfx/extasy/flashlight.png",1,1,100+id)
			imagecolor(img,255,255,255)
			imageblend(img,1)
			imagealpha(img,0.7)
			parse("sv_sound extasy/flash.wav")
		end
	end
end

function standartrad(angle) 
     if (angle<90) then 
          angle = (angle + 360) 
     end 
     return math.rad(math.abs( angle + 90 ))-math.pi 
end 

addhook("hit","zm_lila_hit")
function zm_lila_hit(id,source,weapon,hpdmg,apdmg)
	rot = player(source,"rot")
	local angle = standartrad(rot)
	local x = player(id,"x") + math.cos(angle)*18
	local y = player(id,"y") + math.sin(angle)*18
	if (player(id,"team")==1) then
		parse("setpos "..id.." "..x.." "..y)
	end
end

addhook("spawn","zm_lila_spawn")
function zm_lila_spawn(id)
	if (player(id,"team")==1) then
		parse("setmaxhealth "..id.." 250")
	end
	if (player(id,"team")==2) then
		parse("setmaxhealth "..id.." 100")
	end
end

addhook("second","zm_lila_sec")
function zm_lila_sec()
	local i = 1,32 do
		if (player(i,"exists")) then
			if (player(i,"team")==1) then
			parse("sethealth "..i.." "..player(i,"health")+7)
			end
		end
	end
end