Javier Posted October 31, 2012 Author Share Posted October 31, 2012 Si, el mismo. Y no es in ipairs ??? Link to comment
Castillo Posted October 31, 2012 Share Posted October 31, 2012 No, ipairs se usa para las tablas con index. Link to comment
Javier Posted October 31, 2012 Author Share Posted October 31, 2012 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? Link to comment
Javier Posted October 31, 2012 Author Share Posted October 31, 2012 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? Link to comment
Arsilex Posted October 31, 2012 Share Posted October 31, 2012 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 ) Link to comment
Javier Posted October 31, 2012 Author Share Posted October 31, 2012 No funciona Pekio, cuadno el player muere lo mismo le sigue dando armadura por mas que el zombie no lo toque. Link to comment
Castillo Posted November 1, 2012 Share Posted November 1, 2012 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'. Link to comment
Recommended Posts