Jump to content

Error


ghost050

Recommended Posts

He creado esto para que los zombies se incendien con el tiempo:

addEvent("cuandoUnZombieEsCreado",true) 
addEventHandler("cuandoUnZombieEsCreado",root, 
function () 
  if  ( getElementModel (source) ==  287) then 
  setTimer ( encenderZombie, 100, 0, source ) 
  end 
end 
) 

Esto me aparece en la consola:

[01:19:45] WARNING: zombies\zombie_server.lua:698: Bad 'element' pointer @ 'setPedOnFire'(1) 
[01:19:45] WARNING: zombies\zombie_server.lua:698: Bad 'element' pointer @ 'setPedOnFire'(1) 
[01:19:45] WARNING: zombies\zombie_server.lua:698: Bad 'element' pointer @ 'setPedOnFire'(1) 
[01:19:45] WARNING: zombies\zombie_server.lua:698: Bad 'element' pointer @ 'setPedOnFire'(1) 
[01:19:45] WARNING: zombies\zombie_server.lua:698: Bad 'element' pointer @ 'setPedOnFire'(1) 
[01:19:45] WARNING: zombies\zombie_server.lua:698: Bad 'element' pointer @ 'setPedOnFire'(1) 

Es obvio que el error es que el "pirozombie" muere y no hay elemento para incendiar, pero, ¿Como lo soluciono?

PD: La parte para que los zombies no pierdan vida ya la he arreglado.

Link to comment

Este guion lo hice durmiendome, deberia quedar asi:

    addEvent("cuandoUnZombieEsCreado",true) 
    addEventHandler("cuandoUnZombieEsCreado",root, 
    function () 
      if  ( getElementModel (source) ==  287) then 
      setTimer ( setPedOnFire, 100, 0, source, true ) 
      end 
    end 
    ) 

Link to comment
local timers = {} 
  
addEvent("cuandoUnZombieEsCreado",true) 
addEventHandler("cuandoUnZombieEsCreado",root, 
    function () 
        if ( getElementModel (source) == 287) then 
            timers[source] = setTimer ( encenderZombie, 100, 0, source ) 
        end 
    end 
) 
  
function encenderZombie(zombie) 
    if (isElement(zombie) and getElementHealth(zombie) > 0) then 
        setPedOnFire(zombie, true) 
    else 
        if isTimer(timers[zombie]) then killTimer(timers[zombie]) end 
    end 
end 

Link to comment

Me sale esto en la consola mira:

[17:24:20] ERROR: zombies\zombie_server.lua:713: attempt to compare number with boolean 
[17:24:20] WARNING: zombies\zombie_server.lua:713: Bad 'element' pointer @ 'getElementHealth'(1) 
[17:24:20] ERROR: zombies\zombie_server.lua:713: attempt to compare number with boolean 
[17:24:21] WARNING: zombies\zombie_server.lua:713: Bad 'element' pointer @ 'getElementHealth'(1) 
[17:24:21] ERROR: zombies\zombie_server.lua:713: attempt to compare number with boolean 
[17:24:21] WARNING: zombies\zombie_server.lua:713: Bad 'element' pointer @ 'getElementHealth'(1) 
[17:24:21] ERROR: zombies\zombie_server.lua:713: attempt to compare number with boolean 
[17:24:21] WARNING: zombies\zombie_server.lua:713: Bad 'element' pointer @ 'getElementHealth'(1) 
[17:24:21] ERROR: zombies\zombie_server.lua:713: attempt to compare number with boolean 
[17:24:21] WARNING: zombies\zombie_server.lua:713: Bad 'element' pointer @ 'getElementHealth'(1) 
[17:24:21] ERROR: zombies\zombie_server.lua:713: attempt to compare number with boolean 
[17:24:21] WARNING: zombies\zombie_server.lua:713: Bad 'element' pointer @ 'getElementHealth'(1) 
[17:24:21] ERROR: zombies\zombie_server.lua:713: attempt to compare number with boolean 
[17:24:21] WARNING: zombies\zombie_server.lua:713: Bad 'element' pointer @ 'getElementHealth'(1) 
[17:24:21] ERROR: zombies\zombie_server.lua:713: attempt to compare number with boolean 

guion:

function encenderZombie(zombie)--712 
    if (zombie and getElementHealth(zombie) > 0) then--713 
     setPedOnFire(zombie, true)--714 
     else--715 
        if isTimer(timers[zombie]) then--716 
         killTimer(timers[zombie])--717 
        end--718 
    end--719 
end--720 

Edited by Guest
Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...