Jump to content

[AYUDA] Objeto enfrente del jugador.


Recommended Posts

Hola :-D , 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 :-D ) 

 

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 :S

Edited by <~KaMiKaZe~>
Link to comment
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 by #Dv^
  • Thanks 1
Link to comment
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 :lol:. ( perdón por las molestias xD )

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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