KaMi Posted February 12, 2018 Share Posted February 12, 2018 (edited) Hola , estoy intentando hacer que, mediante un comando, se cree un objeto enfrente del jugador. El problema es que el objeto no se adapta correctamente a la rotación del usuario o algo así . Para que se den una idea, dejaré este video que retrata lo que intento hacer : ( En el minuto 0:22 ) Acá está el código : function tabla1(player) local x,y,z = getElementPosition(player) local rx,ry,rz = getElementRotation(player) setPedAnimation( player, "knife", "knife_part") setPedWeaponSlot ( player, 10 ) triggerClientEvent("sonido", root ) setTimer ( function() createObject ( 3260, x - 1 , y, z, rx, 90, rz ) setPedAnimation( player, false) end, 1000, 1 ) end addCommandHandler("tabla", tabla1) Ayuda, por favor Edited February 12, 2018 by <~KaMiKaZe~> Link to comment
#Dv^ Posted February 12, 2018 Share Posted February 12, 2018 (edited) x = x - math.sin (math.rad (rx)) * 1 y = y + math.cos (math.rad (rx)) * 1 createObject ( 3260, x, y, z, 0, 90, rx ) addCommandHandler("tabla", function (source) local x,y,z = getElementPosition(source) local rx = getElementRotation(source) x = x - math.sin (math.rad (rx)) * 1 y = y + math.cos (math.rad (rx)) * 1 setPedAnimation( source, "knife", "knife_part") setPedWeaponSlot ( source, 10 ) setTimer ( function() createObject ( 3260, x, y, z, 0, 90, rx ) setPedAnimation( source, false) end, 1000, 1 ) end ) Edited February 12, 2018 by #Dv^ 1 Link to comment
KaMi Posted February 12, 2018 Author Share Posted February 12, 2018 1 minute ago, #Dv^ said: x = x - math.sin (math.rad (rx)) * 1 y = y + math.cos (math.rad (rx)) * 1 createObject ( 3260, x, y, z, 0, 90, rx ) addCommandHandler("tabla", function (source) local x,y,z = getElementPosition(source) local rx = getPlayerRotation (source) x = x - math.sin (math.rad (rx)) * 1 y = y + math.cos (math.rad (rx)) * 1 setPedAnimation( source, "knife", "knife_part") setPedWeaponSlot ( source, 10 ) setTimer ( function() createObject ( 3260, x, y, z, 0, 90, rx ) setPedAnimation( source, false) end, 1000, 1 ) end ) Muchas gracias por la ayuda, me funcionó correctamente . ( perdón por las molestias ) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now