Jump to content

HELP me Please..


mint3d

Recommended Posts

Posted

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) 
  

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

Posted

It's not working... now its like everywhere is zombieproof.. I want only this area 96, 1788, 184, 145 the ColRectangle..

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

Posted

[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 ','

Posted

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) 

Posted

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

Posted
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

Posted

[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 ','

Posted

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

Posted

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.

Posted

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.

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

Posted

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) 
  

Posted

Okay, but which element should have the data zombieProof? the colshape?

If so just add:

setElementData(col, "zombieProof", true) 

after col is created.

Posted

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 

Posted

The zombieproof script you posted doesn't even work for colshapes, can't you read?. It checks for radar areas only.

Posted

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) 

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