Xwad Posted January 25, 2016 Posted January 25, 2016 Hi pls help me. I want to rotate the m4 weapon when i attach it to the player but when i try it then its not rotating the attached (weapon).. client local weapon = createWeapon("m4", -2376.80, -578.50, 132.3) setWeaponClipAmmo(weapon, 200) setWeaponState(weapon, "ready") function bindFire () local x, y, z = getElementPosition ( source ) local rotX, rotY, rotZ = getElementRotation(source) attachElements ( weapon, source, 0, 0.5, -0.46 ) setElementRotation(weapon,rotX,rotY,rotZ+45) <---- this is not working.. Its not rotating the weapon.. end addEvent( "bindFire", true ) addEventHandler( "bindFire", localPlayer, bindFire )
NewbProgramming Posted January 26, 2016 Posted January 26, 2016 If that does something it looks to me it will always face the weapon to the right of the player. Change getElementRotation(source) to getElementRotation(weapon) ... see what that does.
tosfera Posted January 26, 2016 Posted January 26, 2016 Don't attach it to the player, attach it to the bones of the player. It'll automatically rotate and be much more reliable
Army@1 Posted January 26, 2016 Posted January 26, 2016 And while we are taking about bone attachments... take a look at this topic: https://forum.multitheftauto.com/viewtopic.php?f=108&t=44422
Xwad Posted January 26, 2016 Author Posted January 26, 2016 If that does something it looks to me it will always face the weapon to the right of the player. Change getElementRotation(source) to getElementRotation(weapon) ... see what that does. Its not working:// Its still looking to the right.. Don't attach it to the player, attach it to the bones of the player. It'll automatically rotate and be much more reliable How can i make that? what function need i use? Anyway, im trying to make this script
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