Jump to content

HELP me Please..


mint3d

Recommended Posts

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
  
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
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

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

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
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

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

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
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

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

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

Then explain better :P

  
  
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

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...