Timer failed ! Fix ?


function mykamikaze()

local kamikaze = ents.Create( "npc_zombie" )

kamikaze:SetPos( kamikazePosition[ math.random( 1, 3) ] )

kamikazeSpawn()
kamikazeSpawn = {}

kamikazeSpawn[1] = Vector( 80, -800, 90 )
kamikazeSpawn[2] = Vector( 70, -300, 90 )
kamikazeSpawn[3] = Vector( 170, -330, 90 )

end
timer.Create( "kamikaze", 1, 0, mykamikaze )

Does sombody know what’s wrong with this script it keeps saying Timer Failed ! I know its an easy script only costed me around 5 mins but I already got some issues with timers

  1. Post the error you are getting.
  2. You are calling the function from itself, you are creating an infinite loop
  3. [del]You are trying to access the table BEFORE you create the table[/del] Even more then that, you trying to access a table that doesn’t even exist.
  4. You are never actually spawning the entity.


local kamikazeSpawn = {
     Vector( 80, -800, 90 ),
     Vector( 70, -300, 90 ),
     Vector( 170, -330, 90 )
}

timer.Create( "kamikaze", 1, 0, function()
    local kamikaze = ents.Create( "npc_zombie" )
    kamikaze:SetPos( kamikazeSpawn[ math.random( 1, 3) ] )
    kamikaze:Spawn()
end )

Oh thx ! I appriciate your help