Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving in db #30

Open
KrnkTV opened this issue Nov 13, 2021 · 4 comments
Open

Saving in db #30

KrnkTV opened this issue Nov 13, 2021 · 4 comments

Comments

@KrnkTV
Copy link

KrnkTV commented Nov 13, 2021

Hello i use script which make exports to vstancer but how i can make it when i make changes in my script to save in db and when u put car in garage and take out to be with last settings ?

@KrnkTV
Copy link
Author

KrnkTV commented Nov 13, 2021

Thats my callback

RegisterNUICallback('SetStancer', function(data, cb)
local fOffset = data.fOffset * 100 / 1000
local fRotation = data.fRotation * 100 / 1000
local rOffset = data.rOffset * 100 / 1000
local rRotation = data.rRotation * 100 / 1000

print(fOffset)
print(fRotation)
print(rOffset)
print(rRotation)

local ped = PlayerPedId()
local veh = GetVehiclePedIsIn(ped)

exports["vstancer"]:SetWheelPreset(veh, -fOffset, -fRotation, -rOffset, -rRotation)

end)

@carmineos
Copy link
Owner

carmineos commented Nov 14, 2021

The saving to your db has to be handled in your own script.
Use the GetWheelPreset to get the preset from vstancer

local result = exports["vstancer"]:GetWheelPreset(vehicle);

Input: vehicle is an integer, the handle of the vehicle entity
Output: an array of floats containing the preset values in this order frontTrackWidth, frontCamber, rearTrackWidth, rearCamber.

At this point you have to save these values wherever you need to, and when you want to apply them back to the vehicle you'll have to use the SetWheelPreset you mentioned which returns a bool to report if the preset has been applied successfully

@KrnkTV
Copy link
Author

KrnkTV commented Nov 23, 2021

can u help me to figureout this thing ?

@LeSiiN
Copy link

LeSiiN commented Aug 12, 2022

did u get this to work ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants