Xwad Posted October 27, 2016 Posted October 27, 2016 Why does the setElementAttachedOffsets (in server side) not work? i got no debugscript client function onEnter2(player,seat) local model = getElementModel(source) if player == localPlayer and (model == 602) and seat == 0 then local veh = getPedOccupiedVehicle(localPlayer) local x,y,z = getElementPosition(veh) local object = createObject ( 357, x,y,z) attachElements(object, veh, 0,0,1,0,0,0) createWeapon_c(veh,object) setElementData(localPlayer,"object", object) addEventHandler('onClientRender', root, rotate_object ) end end addEventHandler("onClientVehicleEnter", root, onEnter2) function rotate_object() local veh = getPedOccupiedVehicle(localPlayer) local object = getElementData(localPlayer,"object") local _,_,rz = getVehicleComponentRotation(veh, "misc_a") local rx,_,_ = getVehicleComponentRotation(veh, "misc_b") triggerServerEvent("rotateWeapon", root, object,rx,rz) end and the server (which is actualy not woroking) function rotateWeapon(object,rx,rz) outputChatBox("rotate_s") rx = (-rx) setElementAttachedOffsets ( object, 0, 0, 1, 0, rx+7, rz+96) end addEvent("rotateWeapon", true) addEventHandler("rotateWeapon", root, rotateWeapon)
Simple0x47 Posted October 27, 2016 Posted October 27, 2016 Try chaning the element which triggers the serverEvent. triggerServerEvent("rotateWeapon", localPlayer, object, rx, rz )
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