Jump to content

zombies spawning and destroying in anti zombie zone


Notorious^

Recommended Posts

hello

This is my anti zombie zone codes.but problem zombies still spawning and 2 or 3 seconds later dying in zone.sometimes they dont die in this zone.so ı added destroyElement but still they spawning.

whats my mistake ? Can you please help  ?

Quote

alanlar = {
{ 1082.17944, -2117.68848, 45.22021, 275.57470703125, 143.94189453125, 47.723364257812}, 
{ 96.42160, 1799.00146, 8.64063, 207.82876586914, 164.90344238281, 49.681719207764},
{1159.22192, -1861.63623, 2207.91968, 458.67749023438, 135.39514160156, 347.82529296875},
{-3028.51025, 412.85077, -4.36548, 165.30834960938, 101.53894042969, 71.609956288338},
}	


for i,v in pairs(alanlar) do
	local x, y, z, width, height, depth = unpack(alanlar[i]) 
	--rad = createRadarArea ( x, y, width, height, 255, 0, 0, 170, root )
	col = createColCuboid ( x, y, z, width, height, depth)
	setElementData(col, "zombieProof", true)
	addEventHandler("onColShapeHit", col, function(giren)	
		if getElementType(giren) == "ped" then
			if getElementData(giren, "zombie") then
				destroyElement(giren)
			end	
		end	
	end)	
end	

 

 

Link to comment

What about this ?

alanlar = {
    { 1082.17944, -2117.68848, 45.22021, 275.57470703125, 143.94189453125, 47.723364257812},
    { 96.42160, 1799.00146, 8.64063, 207.82876586914, 164.90344238281, 49.681719207764},
    { 1159.22192, -1861.63623, 2207.91968, 458.67749023438, 135.39514160156, 347.82529296875},
    { -3028.51025, 412.85077, -4.36548, 165.30834960938, 101.53894042969, 71.609956288338}
}	


for i,v in pairs(alanlar) do
  local x, y, z, width, height, depth = unpack(alanlar[i]) 
	--rad = createRadarArea ( x, y, width, height, 255, 0, 0, 170, root )
	col = createColCuboid ( x, y, z, width, height, depth)
	setElementData(col, "zombieProof", true)
end	

addEventHandler("onColShapeHit", root,
function(giren)
	if getElementData(source,"zombieProof") == true and getElementType(giren) == "ped" then
		if getElementData(giren, "zombie") then
			destroyElement(giren)
		end
	end
end
)

 

Link to comment

okay ! It's debug time :lol:

alanlar = {
    { 1082.17944, -2117.68848, 45.22021, 275.57470703125, 143.94189453125, 47.723364257812},
    { 96.42160, 1799.00146, 8.64063, 207.82876586914, 164.90344238281, 49.681719207764},
    { 1159.22192, -1861.63623, 2207.91968, 458.67749023438, 135.39514160156, 347.82529296875},
    { -3028.51025, 412.85077, -4.36548, 165.30834960938, 101.53894042969, 71.609956288338}
}	


for i,v in pairs(alanlar) do
  local x, y, z, width, height, depth = unpack(alanlar[i]) 
	--rad = createRadarArea ( x, y, width, height, 255, 0, 0, 170, root )
	col = createColCuboid ( x, y, z, width, height, depth)
	setElementData(col, "zombieProof", true)
end	

addEventHandler("onColShapeHit", root,
function(giren)
	if getElementData(source,"zombieProof") == true and getElementType(giren) == "ped" then
		if getElementData(giren, "zombie") then
			destroyElement(giren)
			outputChatBox("element destroyed !",root)
		else
		    outputChatBox("player / ped that entered the col hasn't data called 'zombie' !",root)
		end
	elseif getElementType(giren) ~= "ped" then
	    outputChatBox("You are not a ped ! ( "..getElementType(giren).." )",root)
	elseif getElementData(source,"zombieProof") ~= true
	    outputChatBox("this col hasn't data called 'zombieProof'",root)
    else
        outputChatBox("error !",root,255,0,0)
    end
end
)

this is a simple debug code created at the moment :3 tell me what outputs when a zombie hit a col created by above script.

Edited by DeadthStrock
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...