Alexs Posted June 3, 2012 Share Posted June 3, 2012 Hola a Todos, queria saber si esto funcionaria o como hacerlo funcionar: borrar ( ) destroyElement ( ramp ) end end function crear ( player, key, keyState ) local mx,my,mz = getElementPosition( player ) local accame = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accame, aclGetGroup ( "Admin" ) ) then ramp = createObject ( 1634, mx + 5,my,mz ) --Aca me crea la duda sobre la variable.... setTimer ( borrar, 3000, 1 ) end end bindKey ( player, "l", "down", crear ) Esto deberia funcionar, verdad? Edit: lo intente asi y no funciona Link to comment
Castillo Posted June 3, 2012 Share Posted June 3, 2012 "player" es nil ahi. addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "L", "down", crear ) end ) addEventHandler ( "onResourceStart", resourceRoot, function ( ) ramps = { } for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "L", "down", crear ) end end ) function crear ( player, key, keyState ) local mx, my, mz = getElementPosition ( player ) local accame = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user.".. accame, aclGetGroup ( "Admin" ) ) then ramps [ player ] = createObject ( 1634, mx + 5, my, mz ) setTimer ( function ( theRamp ) if ( theRamp ) then destroyElement ( theRamp ) end end ,3000, 1, ramps [ player ] ) end end Link to comment
Alexs Posted June 3, 2012 Author Share Posted June 3, 2012 (edited) Gracias funciono perfecto y descubri que X es el lado e Y el frente Edit: Tengo un problema, como hago que siempre aparezca frente a mi sin importar mi rotacion? Edited June 3, 2012 by Guest Link to comment
Alexs Posted June 3, 2012 Author Share Posted June 3, 2012 De nada. Tengo un problema, como hago que siempre aparezca frente a mi sin importar mi rotacion? mi idea seria usar getElementRotation y si la rotacion X es 90 se crea con mx + 10 y asi... pero no estoy seguro.. Edit: algo asi intentare: if isObjectInACLGroup ( "user.".. accame, aclGetGroup ( "Admin" ) ) and rmx == 90 then ramps [ player ] = createObject ( 1634, mx, my + 10, mz ) else if isObjectInACLGroup ( "user.".. accame, aclGetGroup ( "Admin" ) ) and rmy == 90 then ramps [ player ] = createObject ( 1634, mx + 90, my, mz ) Link to comment
Castillo Posted June 3, 2012 Share Posted June 3, 2012 Usa esta funcion: https://wiki.multitheftauto.com/wiki/FindRotation Link to comment
Alexs Posted June 3, 2012 Author Share Posted June 3, 2012 Wow, me llego a marear, esto devuelve la direction del punto A al punto B? como uso eso? ahh ya entendi, esto me serviria para que su rotacion sea igual a la mia, pero el problema es que la rampa aparece a mi lado, no frente a mi, eso quiero corregir Edit: Era para un amigo que me lo pidio, pero me acompleje mucho, Pueden cerrar el tema, no acabare el script Link to comment
Recommended Posts