Search the Community
Showing results for tags 'getvehiclecomponents'.
-
The question is the same as the title: how to get width and height of a vehicle component?I dont think that there is any way to do it.
-
- getvehiclecomponents
- lua
-
(and 8 more)
Tagged with:
-
Okey, so im currently working on a repair script for my server, until this point everything worked, but now i need to calculate some offsets(world offset, and rotation offset too), and i have no idea how to do it.So, the basic idea is to hold every demounted component like this.Heres the script i made. --CLIENT SIDE local r = { ["door_lf_dummy"] = {90,0,-90}, ["door_rf_dummy"] = {90,0,-90}, ["door_lr_dummy"] = {90,0,-90}, ["door_rr_dummy"] = {90,0,-90}, } addEvent("addVehComponentToPlayer",true) function funkzson(veh,comp,player) setTimer(function() local rotx,roty,rotz = getElementRotation(player) setElementRotation(veh,rotx,rotx,rotz) for k in pairs(getVehicleComponents(veh)) do if not (k==comp) then setVehicleComponentVisible(veh,k,false) end end local cX,cY,cZ = getVehicleComponentPosition(veh,comp,"world") local vX,vY,vZ = getElementPosition(veh) local offsetX,offsetY,offsetZ = (vX-cX),(vY-cY),(cZ-vZ) exports.bone_attach:attachElementToBone(veh,player,2,0,-0.4,-0.65,r[comp][1],r[comp][2],r[comp][3]) setPedAnimation(player,"carry","crry_prtial",0,false,false,false) end,50,1) end addEventHandler("addVehComponentToPlayer",getLocalPlayer(),funkzson) --SERVER SIDE addCommandHandler("setcompstate",function(source,_,comp) local x,y,z = getElementPosition(source) local veh = createVehicle(440,x,y,z,rotx,roty,rotz) setElementCollisionsEnabled(veh,false) setVehicleDamageProof(veh,true) setElementData(veh,"onlyfixveh",true) triggerClientEvent("addVehComponentToPlayer",root,veh,comp,source) end) Ignore that i attached the server side triggerClientEvent to a command, i made it like this only for testing purposes. btw, maybe i will post the full script as a community script.