Jump to content

help


Chaos

Recommended Posts

Posted

hi,

i have problem with this code not working

    function killzombieinwater() 
    zombie = getElementData(source,"zombie") 
    if isElementInWater(zombie) then 
    killPed(zombie) 
    end 
end 
  
      
  addEventHandler("onZombieSpawn",root,killzombieinwater) 

i want when the zombie spawn and hit the water then he will die

Posted
function killzombieinwater ( ) 
    local zombie = getElementData ( source, "zombie" ) 
    if isElementInWater ( zombie ) then 
        killPed ( zombie ) 
    end 
end 
addEvent ( "onZombieSpawn", true ) 
addEventHandler ( "onZombieSpawn", root, killzombieinwater ) 

Posted

When you did killped (zombie) it dies.. how it can not be dead? you may say that it does not dissapear...?

try with this:

  
destroyElement ( element elementToDestroy ) 
  

Maybe...?

  
function killzombieinwater ( ) 
    local zombie = getElementData ( source, "zombie" ) 
    if isElementInWater ( zombie ) then 
        killPed ( zombie ) 
destroyElement( zombie ) 
    end 
end 
addEvent ( "onZombieSpawn", true ) 
addEventHandler ( "onZombieSpawn", root, killzombieinwater ) 
  

Posted
When you did killped (zombie) it dies.. how it can not be dead? you may say that it does not dissapear...?

try with this:

  
destroyElement ( element elementToDestroy ) 
  

Maybe...?

  
function killzombieinwater ( ) 
    local zombie = getElementData ( source, "zombie" ) 
    if isElementInWater ( zombie ) then 
        killPed ( zombie ) 
destroyElement( zombie ) 
    end 
end 
addEvent ( "onZombieSpawn", true ) 
addEventHandler ( "onZombieSpawn", root, killzombieinwater ) 
  

not working

Posted

The problem is the code is working fine but when zombie touch the water won't die directly he spend a lot of time to die

Posted

try this...

  
function killzombieinwater ( ) 
local zombie = getElementData ( source, "zombie" ) 
    if isElementInWater ( zombie ) then 
         setElementHealth ( zombie, 0 ) 
    end 
end 
addEvent ( "onZombieSpawn", true ) 
addEventHandler ( "onZombieSpawn", root, killzombieinwater ) 
  

Posted

guys what are doing ?

function killzombieinwater ( ) 
local zombie = getElementData ( source, "zombie" ) 
    if zombie and  isElementInWater ( source )  then 
         destroyElement( source ) 
    end 
end 
addEvent ( "onZombieSpawn", true ) 
addEventHandler ( "onZombieSpawn", root, killzombieinwater ) 

Posted

I think i got it, he isnt triggering the event onZombieSpawn on the zombie, he is just triggering (i think becouse we dont have the full script, and source should work)

Posted
'source' isn't a ped element then.
  
function killzombieinwater ( ) 
local zombie = getElementData (ped, "zombie" ) 
    if isElementInWater ( zombie ) then 
         setElementHealth ( zombie, 0 ) 
    end 
end 
addEvent ( "onZombieSpawn", true ) 
addEventHandler ( "onZombieSpawn", root, killzombieinwater ) 
  

this work?

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