Jump to content

[AYUDA] setTimer


Javier

Recommended Posts

Posted

No, ipairs se usa para las tablas con index.

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
No, ipairs se usa para las tablas con index.

Ahora cuando abro mi server con el resource me dice esto constantemente

 ERROR: infection\zombie.lua:65: bad argument #1 to 'pairs' (table expected, got nil) 

Alguna otra ayuda?

Posted

Solidsnake , Ahora si funciona es que lo habia copiado mal. Ahora el problema es que cuando el player muere y respawnea le sigue sumando armadura. alguna ayuda?

Posted
playersTouched = { } 
  
function incremento ( attacker, weapon, bodypart, loss ) 
    if ( attacker and getElementType ( attacker ) == "ped" and getElementData ( attacker, "zombie" ) ) then 
        playersTouched [ source ] = true 
    end 
end 
addEventHandler ( "onPlayerDamage", getRootElement(), incremento ) 
  
setTimer ( 
    function ( ) 
        for player, _ in pairs ( playersTouched ) do 
            setPedArmor ( player, ( getPedArmor ( player ) + 10 ) ) 
        end 
    end 
    ,120000, 0 
) 
  
addEventHandler( "onPlayerWasted", getRootElement( ), 
function() 
        playersTouched [ source ] = false 
end 
) 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted
playersTouched = { } 
  
function incremento ( attacker, weapon, bodypart, loss ) 
    if ( attacker and getElementType ( attacker ) == "ped" and getElementData ( attacker, "zombie" ) ) then 
        playersTouched [ source ] = true 
    end 
end 
addEventHandler ( "onPlayerDamage", getRootElement(), incremento ) 
  
setTimer ( 
    function ( ) 
        for player, _ in pairs ( playersTouched ) do 
            setPedArmor ( player, ( getPedArmor ( player ) + 10 ) ) 
        end 
    end 
    ,120000, 0 
) 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        playersTouched [ source ] = nil 
    end 
) 

El problema de pekio era que no quito al jugador de la tabla, nomas cambio el valor a 'false'.

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.

  • Recently Browsing   0 members

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