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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

What do you mean by "slowly"?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 ) 
  

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

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
BUMP

Can you post a pick of the problem so we can understand the real problem??

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

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

'source' isn't a ped element then.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 ) 

Omerta Roleplay

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)

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

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