mint3d Posted June 8, 2014 Share Posted June 8, 2014 I need some help basically I want something to be set "zombieproof" I need help I want to set it zombieproof the colRectangle.. setElementData ("zombieProof", true), addEventHandler("onColShapeHit", createColRectangle (96, 1788, 184, 145), function(h)if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) Link to comment
Saml1er Posted June 9, 2014 Share Posted June 9, 2014 for _,v in pairs ( getElementsByType("player")) do setElementData (v,"zombieProof", true) end local col = createColRectangle (96, 1788, 184, 145) addEventHandler("onColShapeHit", col, function(h) if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) Link to comment
mint3d Posted June 9, 2014 Author Share Posted June 9, 2014 It's not working... now its like everywhere is zombieproof.. I want only this area 96, 1788, 184, 145 the ColRectangle.. Link to comment
Price. Posted June 9, 2014 Share Posted June 9, 2014 for _,v in pairs ( getElementsByType("player")) do local col = createColRectangle (96, 1788, 184, 145) end setElementData ("zombieProof", true), addEventHandler("onColShapeHit", col, function(h) if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) Link to comment
mint3d Posted June 9, 2014 Author Share Posted June 9, 2014 [19:45:34] SCRIPT ERROR: zombies/zombie_server.lua:29: unexpected symbol near ', ' [19:45:34] ERROR: Loading script failed: zombies/zombie_server.lua:29: unexpect e d symbol near ',' Link to comment
Price. Posted June 9, 2014 Share Posted June 9, 2014 yea added a comma by mistake for _,v in pairs ( getElementsByType("player")) do local col = createColRectangle (96, 1788, 184, 145) end setElementData ("zombieProof", true) addEventHandler("onColShapeHit", col, function(h) if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) Link to comment
mint3d Posted June 9, 2014 Author Share Posted June 9, 2014 WARNING: zombies/zombie_server.lua:29: Bad argument @ 'setElementData ' [Expected element at argument 1, got string 'zombieProof'] 5:05] WARNING: zombie s/zombie_server.lua:30: Bad argument @ 'addEventHandle r' [Expected element at argument 2, got nil] 5:0 Link to comment
Price. Posted June 9, 2014 Share Posted June 9, 2014 setElementData ("zombieProof", true), local col = createColRectangle (96, 1788, 184, 145) end addEventHandler("onColShapeHit", function(h)if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) if there is a problem remove that comma @ setElementData Link to comment
mint3d Posted June 9, 2014 Author Share Posted June 9, 2014 [20:13:34] SCRIPT ERROR: zombies/zombie_server.lua:26: unexpected symbol near ', ' [20:13:34] ERROR: Loading script failed: zombies/zombie_server.lua:26: unexpect e d symbol near ',' Link to comment
Den. Posted June 9, 2014 Share Posted June 9, 2014 Here: This will work if each zombie has the element data "zombie" set to a value other than nil. local col = createColRectangle (96, 1788, 184, 145) addEventHandler("onColShapeHit", col, function(hitElement) if getElementType(hitElement) == 'ped' and getElementData(hitElement, 'zombie') then killPed(hitElement) end end) Also: price wat r u doin, price, stahp Link to comment
Price. Posted June 9, 2014 Share Posted June 9, 2014 lel @ den i was gonna do the same thing u did , i just found the paremeters of getElementData was wrong Link to comment
mint3d Posted June 9, 2014 Author Share Posted June 9, 2014 That part of the script is fine.. I just want this local col = createColRectangle (96, 1788, 184, 145) to be zombieproof which means zombies won't spawn inside it. Link to comment
Den. Posted June 9, 2014 Share Posted June 9, 2014 Depends what zombie resource you are using to spawn the zombies. I'm not sure if onColShapeHit is triggered if a ped is created inside that col, test it, and if it does trigger then replace killPed with destroyElement. Note: May cause issues with the zombie resource, depending on how they handle destroying zombie elements. Link to comment
mint3d Posted June 9, 2014 Author Share Posted June 9, 2014 setElementData (createRadarArea(2418.4255371094, -1735,121.6306152344,100,0,150,0,153),"zombieProof",true) addEventHandler("onColShapeHit", createColRectangle (2418.4255371094, -1735,121.6306152344,100), function(h)if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) This is a working one I use in another place.. only thing is I don't want the radar.. Can you help me with the original onColShapeHit maybe this code can help both you? Link to comment
Den. Posted June 9, 2014 Share Posted June 9, 2014 The code I posted should work without creating a radar area.. But anyways: I removed the radar area...It was pretty obvious you needed to remove createRadarArea if you wanted to remove it.. addEventHandler("onColShapeHit", createColRectangle (2418.4255371094, -1735,121.6306152344,100), function(h)if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) Link to comment
mint3d Posted June 9, 2014 Author Share Posted June 9, 2014 Your missing the full point. The script must have the setelement zombieproof in it. Link to comment
Den. Posted June 9, 2014 Share Posted June 9, 2014 Okay, but which element should have the data zombieProof? the colshape? If so just add: setElementData(col, "zombieProof", true) after col is created. Link to comment
mint3d Posted June 9, 2014 Author Share Posted June 9, 2014 Sorry for late reply but it didn't work with the setElementData.. addEventHandler("onColShapeHit", createColRectangle (96, 1788, 184, 145), function(h)if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) setElementData(col, "zombieProof", true) I get this error.. WARNING: Zombie-System\zombie_server.lua:27: Bad argument @ 'setElementData' [Expected element at argument 1, got nil] This is the zombieproof script if it helps.. addEvent( "onZombieSpawn", true ) function RanSpawn_Z ( gx, gy, gz, rot) local safezone = 0 local allradars = getElementsByType("radararea") for theKey,theradar in ipairs(allradars) do if getElementData(theradar, "zombieProof") == true then if isInsideRadarArea ( theradar, gx, gy ) then safezone = 1 end end Link to comment
Den. Posted June 9, 2014 Share Posted June 9, 2014 The zombieproof script you posted doesn't even work for colshapes, can't you read?. It checks for radar areas only. Link to comment
mint3d Posted June 9, 2014 Author Share Posted June 9, 2014 Ye thats what I am saying.. How to make it for Colshapes? Link to comment
Saml1er Posted June 10, 2014 Share Posted June 10, 2014 Then explain better local col = createColRectangle (96, 1788, 184, 145) setElementData (col,"zombieProof", true) addEventHandler("onColShapeHit", col, function(h) if not isElement(h) then return end if getElementData(h,"zombie") then killPed(h) end end) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now