Xwad Posted February 10, 2016 Share Posted February 10, 2016 Hi community! Im working on a vehicle machinegun script. I have a big problem. In my script i create a minigun object and attach it to a vehicle, and i add a bindkey which will attach the player to the minigun.. So, the problem is the attaching. When the player is attached to the minigun then the player is very oblique.. I tryed using setElementRotation but it didnt help me..So i wanna ask is that possible? to rotate the attached player (attached to the object). So here are 2 pictures about the issues. I hope you can help:) Thanks. Open the picture in a new side to see the full picture So here is the part where i create the object and attach the player to the object function attach(veh) setPedAnimation ( source, "SILENCED", "SilenceCrouchfire", 1, false, false, false, true ) attachElements ( source, weapon, 0, 0.16, 0.35, 0, 0, 90 ) setElementCollisionsEnabled ( source, false ) toggleControl (source,"fire", false) end addEvent("attachPlayerToMinigun", true) addEventHandler("attachPlayerToMinigun",getRootElement(), attach) function createVehicleMachinegun (veh) local x,y,z = getElementPosition(veh) local mid = getElementModel(veh) if weapOff[mid] then weapon = createObject ( 362, x+weapOff[mid][1],y+weapOff[mid][2],z+weapOff[mid][3]) weapon_base = createObject ( 336, x+weapOff[mid][1],y+weapOff[mid][2],z) attachElements ( weapon_base, veh, weapOff[mid][1], weapOff[mid][2], weapOff[mid][3], 0, 0, 0) attachElements ( weapon, weapon_base, 0.20, -0.3, 0.77, weapOff[mid][4], weapOff[mid][5], weapOff[mid][6]) setElementData(veh, "weapon", weapon_base) setElementData(veh, "weapon2", weapon) setElementData(veh, "playerOnWeapon", nil) outputChatBox ( "Machinegun attached!" ) end end addEvent( "create", true ) addEventHandler( "create", root, createVehicleMachinegun ) 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