Narutimmy Posted July 12, 2015 Share Posted July 12, 2015 Hola tengo este error... local objeto1 = createObject ( 3865, 3233.3000488281, 2064.1000976563, 34, 90, 0, 0 ) local objeto2 = createObject ( 3865, 3237.3999023438, 1928, 34, 90, 0, 0 ) local objeto3 = createObject ( 3865, 3240.1000976563, 1815.5999755859, 34, 90, 0, 0 ) local objeto4 = createObject ( 3865, 3333, 1765.8000488281, 34, 90, 0, 0 ) local objeto5 = createObject ( 3865, 3428, 1784.6999511719, 34, 90, 0, 0 ) local objeto6 = createObject ( 3865, 3592.1999511719, 1770.7001953125, 34, 90, 0, 0 ) local objeto7 = createObject ( 3865, 3640.1999511719, 1859.8000488281, 34, 90, 0, 0 ) local objeto8 = createObject ( 3865, 3595.6000976563, 1954.6999511719, 34, 90, 0, 0 ) local objeto9 = createObject ( 3865, 3622.6000976563, 2047.1999511719, 34, 90, 0, 0 ) local objeto10 = createObject ( 3865, 3554.3999023438, 2053.1999511719, 34, 90, 0, 0 ) local objeto11 = createObject ( 3865, 3449.6000976563, 2056.3000488281, 34, 90, 0, 0 ) local objeto12 = createObject ( 3865, 3370.3000488281, 2054.8000488281, 34, 90, 0, 0 ) local objeto13 = createObject ( 3865, 3360.5, 1952.9000244141, 34, 90, 0, 0 ) local objeto14 = createObject ( 3865, 3527.5, 1941.5999755859, 34, 90, 0, 0 ) local objeto15 = createObject ( 3865, 3538.8000488281, 1849, 34, 90, 0, 0 ) local x,y,z = getElementPosition (objeto1) local x2,y2,z2 = getElementPosition (objeto2) local x3,y3,z3 = getElementPosition (objeto3) local x4,y4,z4 = getElementPosition (objeto4) local x5,y5,z5 = getElementPosition (objeto5) local x6,y6,z6 = getElementPosition (objeto6) local x7,y7,z7 = getElementPosition (objeto7) local x8,y8,z8 = getElementPosition (objeto8) local x9,y9,z9 = getElementPosition (objeto9) local x10,y10,z10 = getElementPosition (objeto10) local x11,y11,z11 = getElementPosition (objeto11) local x12,y12,z12 = getElementPosition (objeto12) local x13,y13,z13 = getElementPosition (objeto13) local x14,y14,z14 = getElementPosition (objeto14) local x15,y15,z15 = getElementPosition (objeto15) local state = false function Funcion ( source ) ---Line 51 if ( not state ) then moveObject ( objeto1, 5000, x, y, z-6, 0, 0, 0 ) moveObject ( objeto2, 5000, x2, y2, z2-6, 0, 0, 0 ) moveObject ( objeto3, 5000, x3, y3, z3-6, 0, 0, 0 ) moveObject ( objeto4, 5000, x4, y4, z4-6, 0, 0, 0 ) moveObject ( objeto5, 5000, x5, y5, z5-6, 0, 0, 0 ) moveObject ( objeto6, 5000, x6, y6, z6-6, 0, 0, 0 ) moveObject ( objeto7, 5000, x7, y7, z7-6, 0, 0, 0 ) moveObject ( objeto8, 5000, x8, y8, z8-6, 0, 0, 0 ) moveObject ( objeto9, 5000, x9, y9, z9-6, 0, 0, 0 ) moveObject ( objeto10, 5000, x10, y10, z10-6, 0, 0, 0 ) moveObject ( objeto11, 5000, x11, y11, z11-6, 0, 0, 0 ) moveObject ( objeto12, 5000, x12, y12, z12-6, 0, 0, 0 ) moveObject ( objeto13, 5000, x13, y13, z13-6, 0, 0, 0 ) moveObject ( objeto14, 5000, x14, y14, z14-6, 0, 0, 0 ) moveObject ( objeto15, 5000, x15, y15, z15-6, 0, 0, 0 ) --- Linea 67 state = true outputChatBox ( "Tubos : Abiertos", source, 255, 0, 0, true ) else moveObject ( objeto1, 5000, x, y, z+6, 0, 0, 0 ) moveObject ( objeto2, 5000, x2, y2, z2+6, 0, 0, 0 ) moveObject ( objeto3, 5000, x3, y3, z3+6, 0, 0, 0 ) moveObject ( objeto4, 5000, x4, y4, z4+6, 0, 0, 0 ) moveObject ( objeto5, 5000, x5, y5, z5+6, 0, 0, 0 ) moveObject ( objeto6, 5000, x6, y6, z6+6, 0, 0, 0 ) moveObject ( objeto7, 5000, x7, y7, z7+6, 0, 0, 0 ) moveObject ( objeto8, 5000, x8, y8, z8+6, 0, 0, 0 ) moveObject ( objeto9, 5000, x9, y9, z9+6, 0, 0, 0 ) moveObject ( objeto10, 5000, x10, y10, z10+6, 0, 0, 0 ) moveObject ( objeto11, 5000, x11, y11, z11+6, 0, 0, 0 ) moveObject ( objeto12, 5000, x12, y12, z12+6, 0, 0, 0 ) moveObject ( objeto13, 5000, x13, y13, z13+6, 0, 0, 0 ) moveObject ( objeto14, 5000, x14, y14, z14+6, 0, 0, 0 ) moveObject ( objeto15, 5000, x15, y15, z15+6, 0, 0, 0 ) state = false outputChatBox ( "Tubos : Cerrados", source, 255, 0, 0, true ) end end Link to comment
Narutimmy Posted July 12, 2015 Author Share Posted July 12, 2015 if ( not state ) thenCreo que el error, no es al final, sino el "not state", mejor que ese valor sea cambiado por uno numérico, local objeto1 = createObject ( 3865, 3233.3000488281, 2064.1000976563, 34, 90, 0, 0 ) local objeto2 = createObject ( 3865, 3237.3999023438, 1928, 34, 90, 0, 0 ) local objeto3 = createObject ( 3865, 3240.1000976563, 1815.5999755859, 34, 90, 0, 0 ) local objeto4 = createObject ( 3865, 3333, 1765.8000488281, 34, 90, 0, 0 ) local objeto5 = createObject ( 3865, 3428, 1784.6999511719, 34, 90, 0, 0 ) local objeto6 = createObject ( 3865, 3592.1999511719, 1770.7001953125, 34, 90, 0, 0 ) local objeto7 = createObject ( 3865, 3640.1999511719, 1859.8000488281, 34, 90, 0, 0 ) local objeto8 = createObject ( 3865, 3595.6000976563, 1954.6999511719, 34, 90, 0, 0 ) local objeto9 = createObject ( 3865, 3622.6000976563, 2047.1999511719, 34, 90, 0, 0 ) local objeto10 = createObject ( 3865, 3554.3999023438, 2053.1999511719, 34, 90, 0, 0 ) local objeto11 = createObject ( 3865, 3449.6000976563, 2056.3000488281, 34, 90, 0, 0 ) local objeto12 = createObject ( 3865, 3370.3000488281, 2054.8000488281, 34, 90, 0, 0 ) local objeto13 = createObject ( 3865, 3360.5, 1952.9000244141, 34, 90, 0, 0 ) local objeto14 = createObject ( 3865, 3527.5, 1941.5999755859, 34, 90, 0, 0 ) local objeto15 = createObject ( 3865, 3538.8000488281, 1849, 34, 90, 0, 0 ) local x,y,z = getElementPosition (objeto1) local x2,y2,z2 = getElementPosition (objeto2) local x3,y3,z3 = getElementPosition (objeto3) local x4,y4,z4 = getElementPosition (objeto4) local x5,y5,z5 = getElementPosition (objeto5) local x6,y6,z6 = getElementPosition (objeto6) local x7,y7,z7 = getElementPosition (objeto7) local x8,y8,z8 = getElementPosition (objeto8) local x9,y9,z9 = getElementPosition (objeto9) local x10,y10,z10 = getElementPosition (objeto10) local x11,y11,z11 = getElementPosition (objeto11) local x12,y12,z12 = getElementPosition (objeto12) local x13,y13,z13 = getElementPosition (objeto13) local x14,y14,z14 = getElementPosition (objeto14) local x15,y15,z15 = getElementPosition (objeto15) local state = 0 function Funcion ( source ) if ( state == 0 ) then moveObject ( objeto1, 5000, x, y, z-6, 0, 0, 0 ) moveObject ( objeto2, 5000, x2, y2, z2-6, 0, 0, 0 ) moveObject ( objeto3, 5000, x3, y3, z3-6, 0, 0, 0 ) moveObject ( objeto4, 5000, x4, y4, z4-6, 0, 0, 0 ) moveObject ( objeto5, 5000, x5, y5, z5-6, 0, 0, 0 ) moveObject ( objeto6, 5000, x6, y6, z6-6, 0, 0, 0 ) moveObject ( objeto7, 5000, x7, y7, z7-6, 0, 0, 0 ) moveObject ( objeto8, 5000, x8, y8, z8-6, 0, 0, 0 ) moveObject ( objeto9, 5000, x9, y9, z9-6, 0, 0, 0 ) moveObject ( objeto10, 5000, x10, y10, z10-6, 0, 0, 0 ) moveObject ( objeto11, 5000, x11, y11, z11-6, 0, 0, 0 ) moveObject ( objeto12, 5000, x12, y12, z12-6, 0, 0, 0 ) moveObject ( objeto13, 5000, x13, y13, z13-6, 0, 0, 0 ) moveObject ( objeto14, 5000, x14, y14, z14-6, 0, 0, 0 ) moveObject ( objeto15, 5000, x15, y15, z15-6, 0, 0, 0 ) --- Linea 67 state = 1 outputChatBox ( "Tubos : Abiertos", source, 255, 0, 0, true ) else moveObject ( objeto1, 5000, x, y, z+6, 0, 0, 0 ) moveObject ( objeto2, 5000, x2, y2, z2+6, 0, 0, 0 ) moveObject ( objeto3, 5000, x3, y3, z3+6, 0, 0, 0 ) moveObject ( objeto4, 5000, x4, y4, z4+6, 0, 0, 0 ) moveObject ( objeto5, 5000, x5, y5, z5+6, 0, 0, 0 ) moveObject ( objeto6, 5000, x6, y6, z6+6, 0, 0, 0 ) moveObject ( objeto7, 5000, x7, y7, z7+6, 0, 0, 0 ) moveObject ( objeto8, 5000, x8, y8, z8+6, 0, 0, 0 ) moveObject ( objeto9, 5000, x9, y9, z9+6, 0, 0, 0 ) moveObject ( objeto10, 5000, x10, y10, z10+6, 0, 0, 0 ) moveObject ( objeto11, 5000, x11, y11, z11+6, 0, 0, 0 ) moveObject ( objeto12, 5000, x12, y12, z12+6, 0, 0, 0 ) moveObject ( objeto13, 5000, x13, y13, z13+6, 0, 0, 0 ) moveObject ( objeto14, 5000, x14, y14, z14+6, 0, 0, 0 ) moveObject ( objeto15, 5000, x15, y15, z15+6, 0, 0, 0 ) state = 0 outputChatBox ( "Tubos : Cerrados", source, 255, 0, 0, true ) end end local objeto1 = createObject ( 3865, 3233.3000488281, 2064.1000976563, 34, 90, 0, 0 ) local objeto2 = createObject ( 3865, 3237.3999023438, 1928, 34, 90, 0, 0 ) local objeto3 = createObject ( 3865, 3240.1000976563, 1815.5999755859, 34, 90, 0, 0 ) local objeto4 = createObject ( 3865, 3333, 1765.8000488281, 34, 90, 0, 0 ) local objeto5 = createObject ( 3865, 3428, 1784.6999511719, 34, 90, 0, 0 ) local objeto6 = createObject ( 3865, 3592.1999511719, 1770.7001953125, 34, 90, 0, 0 ) local objeto7 = createObject ( 3865, 3640.1999511719, 1859.8000488281, 34, 90, 0, 0 ) local objeto8 = createObject ( 3865, 3595.6000976563, 1954.6999511719, 34, 90, 0, 0 ) local objeto9 = createObject ( 3865, 3622.6000976563, 2047.1999511719, 34, 90, 0, 0 ) local objeto10 = createObject ( 3865, 3554.3999023438, 2053.1999511719, 34, 90, 0, 0 ) local objeto11 = createObject ( 3865, 3449.6000976563, 2056.3000488281, 34, 90, 0, 0 ) local objeto12 = createObject ( 3865, 3370.3000488281, 2054.8000488281, 34, 90, 0, 0 ) local objeto13 = createObject ( 3865, 3360.5, 1952.9000244141, 34, 90, 0, 0 ) local objeto14 = createObject ( 3865, 3527.5, 1941.5999755859, 34, 90, 0, 0 ) local objeto15 = createObject ( 3865, 3538.8000488281, 1849, 34, 90, 0, 0 ) local x,y,z = getElementPosition (objeto1) local x2,y2,z2 = getElementPosition (objeto2) local x3,y3,z3 = getElementPosition (objeto3) local x4,y4,z4 = getElementPosition (objeto4) local x5,y5,z5 = getElementPosition (objeto5) local x6,y6,z6 = getElementPosition (objeto6) local x7,y7,z7 = getElementPosition (objeto7) local x8,y8,z8 = getElementPosition (objeto8) local x9,y9,z9 = getElementPosition (objeto9) local x10,y10,z10 = getElementPosition (objeto10) local x11,y11,z11 = getElementPosition (objeto11) local x12,y12,z12 = getElementPosition (objeto12) local x13,y13,z13 = getElementPosition (objeto13) local x14,y14,z14 = getElementPosition (objeto14) local x15,y15,z15 = getElementPosition (objeto15) local state = "false" function Funcion ( source ) if ( state == "false" ) then moveObject ( objeto1, 5000, x, y, z-6, 0, 0, 0 ) moveObject ( objeto2, 5000, x2, y2, z2-6, 0, 0, 0 ) moveObject ( objeto3, 5000, x3, y3, z3-6, 0, 0, 0 ) moveObject ( objeto4, 5000, x4, y4, z4-6, 0, 0, 0 ) moveObject ( objeto5, 5000, x5, y5, z5-6, 0, 0, 0 ) moveObject ( objeto6, 5000, x6, y6, z6-6, 0, 0, 0 ) moveObject ( objeto7, 5000, x7, y7, z7-6, 0, 0, 0 ) moveObject ( objeto8, 5000, x8, y8, z8-6, 0, 0, 0 ) moveObject ( objeto9, 5000, x9, y9, z9-6, 0, 0, 0 ) moveObject ( objeto10, 5000, x10, y10, z10-6, 0, 0, 0 ) moveObject ( objeto11, 5000, x11, y11, z11-6, 0, 0, 0 ) moveObject ( objeto12, 5000, x12, y12, z12-6, 0, 0, 0 ) moveObject ( objeto13, 5000, x13, y13, z13-6, 0, 0, 0 ) moveObject ( objeto14, 5000, x14, y14, z14-6, 0, 0, 0 ) moveObject ( objeto15, 5000, x15, y15, z15-6, 0, 0, 0 ) --- Linea 67 state = "true" outputChatBox ( "Tubos : Abiertos", source, 255, 0, 0, true ) else moveObject ( objeto1, 5000, x, y, z+6, 0, 0, 0 ) moveObject ( objeto2, 5000, x2, y2, z2+6, 0, 0, 0 ) moveObject ( objeto3, 5000, x3, y3, z3+6, 0, 0, 0 ) moveObject ( objeto4, 5000, x4, y4, z4+6, 0, 0, 0 ) moveObject ( objeto5, 5000, x5, y5, z5+6, 0, 0, 0 ) moveObject ( objeto6, 5000, x6, y6, z6+6, 0, 0, 0 ) moveObject ( objeto7, 5000, x7, y7, z7+6, 0, 0, 0 ) moveObject ( objeto8, 5000, x8, y8, z8+6, 0, 0, 0 ) moveObject ( objeto9, 5000, x9, y9, z9+6, 0, 0, 0 ) moveObject ( objeto10, 5000, x10, y10, z10+6, 0, 0, 0 ) moveObject ( objeto11, 5000, x11, y11, z11+6, 0, 0, 0 ) moveObject ( objeto12, 5000, x12, y12, z12+6, 0, 0, 0 ) moveObject ( objeto13, 5000, x13, y13, z13+6, 0, 0, 0 ) moveObject ( objeto14, 5000, x14, y14, z14+6, 0, 0, 0 ) moveObject ( objeto15, 5000, x15, y15, z15+6, 0, 0, 0 ) state = "false" outputChatBox ( "Tubos : Cerrados", source, 255, 0, 0, true ) end end Recien lo arregle solo borre moveObject ( objeto15, 5000, x15, y15, z15+6, 0, 0, 0 ) jeje gracias Otra duda.. como arreglo esto?? me tira error [code)lua]for _,player in pairs(getElementsByType("player")) doif getElementData(player,"EVENT") == true thenusers = #player endend[/code] Link to comment
Sasu Posted July 13, 2015 Share Posted July 13, 2015 Recuerda que estas definiendo 'player' como un elemento. Si lo que tratas es contar los jugadores que tienen algun valor en element data 'event' puedes intentar esto: local users = 0 for _,player in ipairs(getElementsByType("player")) do if getElementData(player,"EVENT") == true then users = users+1 end end Link to comment
Narutimmy Posted July 13, 2015 Author Share Posted July 13, 2015 Recuerda que estas definiendo 'player' como un elemento. Si lo que tratas es contar los jugadores que tienen algun valor en element data 'event' puedes intentar esto: local users = 0 for _,player in ipairs(getElementsByType("player")) do if getElementData(player,"EVENT") == true then users = users+1 end end si justo asi lo probe.. pero iba de 1...3..5 nose porque Link to comment
Sasu Posted July 13, 2015 Share Posted July 13, 2015 No entiendo, ¿qué quieres decir? Link to comment
Narutimmy Posted July 17, 2015 Author Share Posted July 17, 2015 No entiendo, ¿qué quieres decir? Nada jeje lo puse mal, ya quedo gRacias Link to comment
Recommended Posts