[Release][C#] VStancer

So I’m really stupid and I was downloading the Source code.zip instead of the vstancer.zip becasue I thought the first one was for singer player. I honesty feel so stupid lmao

Hello, thanks you for this resource, but i have a problem. I can’t change the F6 to open, each other button i try don’t work… menu just don’t spawn. I already have EasyAdmin menu on F6, and i can’t change activation for thisone. Thanks.

That’s strange, cause it should trigger the menu to toggle even if the control is disabled, it doesn’t work with any other key?
By default, if the config.ini value is wrong or cant be read, the script will use F6 again.
Post your config.ini and be sure to get the control from here http://docs.fivem.net/game-references/controls/

I’m sorry, i feel totaly dumb since the vstancer menu wont open if im not in a car, sorry for useless comment :confused:

Have the FiveM devs added the Extra Natives yet so we can lift/lower the front and rear suspensions yet?

I Googled “fivem extra natives” and this popped up? https://github.com/citizenfx/fivem/tree/master/code/components/extra-natives-five

Not sure if thats what you’re talking about since idk jack about anything involving codes.

1 Like

That’s where the code will be, but such feature hasn’t been added yet and it’s known to cause some problems with hydraulics. You can change the fSuspensionRaise value using the Handling Editor tho.

Oh great i’ll check it out. Does the Handling Editor have an option to increase the size of the wheels like the original vstancer? Thats my favorite feature without a doubt.

No it doesn’t. If such feature was possible it would have been available here.

Will the feature be added in the future? Its the last feature missing to pretty much have all of vstancer on fivem.

When you say “problem with hydraulics” do you actually mean just the hydraulics on the lowriders…? That’s the reason we can’t have the full vstancer? Sorry i just don’t know anything, i wish lol.
I might see how i can put those new vehicle native codes and stuff into my files and work with the original vstancer mod and see if it works. :man_shrugging:t2::man_shrugging:t2:

Would you ever think about moving this menu to a /stance command to free up the hotkey?

1 Like

do you find the missing natives? you tried it?

@SLuG what does that mean?
@BaluZ it’s not something that has to be found but implemented. They are named extra natives for a reason, they aren’t natives but functions made by cfx which can be used just like if they were natives.

And it’s already known how do it, but bugs the hydraulics.

1 Like

I mean like having the ability to type /stance in chat and the menu will display. Instead of pressing a hot key to open the menu.

Ok, but in this case, is it possible to release two versions? one with lowering settings and one without? Because nobody uses lowriders on Drift servers, and we also can blacklist them if there is really a problem :wink:

@SLuG i don’t see why it should work that way
@BaluZ point is it isn’t related to this script, but to the implementation of the extra native itself. I don’t know if fivem devs would like to add a feature that could cause problems, or at least until a better solution is found so it works fine even with the hydraulics installed. From the point on my script if the extra native was available I could have already added it with all the checks to avoid it being used at the same time with hydraulics.

1 Like

it would be dope if you could just type in a chat command to pull up the menu, on fivem theres only so many hotkeys can be used and you run out of keys really fast.

2 Likes

I’ve added an export function to correctly load a vstancer config from another script, it’s currently available in the development branch

usage:
assign the values you have previously stored and saved in your database using
LoadVstancerConfig(vehicle, off_f_def, rot_f_def, off_r_def, rot_r_def, off_f, rot_f, off_r, rot_r);

while this is a quick example on how to get these values from an edited vehicle:

int wheelsCount = GetVehicleNumberOfWheels(vehicle);
int frontCount = wheelsCount / 2;
if (frontCount % 2 != 0)
	frontCount -= 1;
// Get default values first
float off_f_def = DecorExistOn(vehicle, "vstancer_off_f_def") ? DecorGetFloat(vehicle, "vstancer_off_f_def") : GetVehicleWheelXOffset(vehicle, 0);
float rot_f_def = DecorExistOn(vehicle, "vstancer_rot_f_def") ? DecorGetFloat(vehicle, "vstancer_rot_f_def") : GetVehicleWheelXrot(vehicle, 0);
float off_r_def = DecorExistOn(vehicle, "vstancer_off_r_def") ? DecorGetFloat(vehicle, "vstancer_off_r_def") : GetVehicleWheelXOffset(vehicle, frontCount);
float rot_r_def = DecorExistOn(vehicle, "vstancer_rot_r_def") ? DecorGetFloat(vehicle, "vstancer_rot_r_def") : GetVehicleWheelXrot(vehicle, frontCount);

float off_f = DecorExistOn(vehicle, "vstancer_off_f") ? DecorGetFloat(vehicle, "vstancer_off_f") : off_f_def;
float rot_f = DecorExistOn(vehicle, "vstancer_rot_f") ? DecorGetFloat(vehicle, "vstancer_rot_f") : rot_f_def;
float off_r = DecorExistOn(vehicle, "vstancer_off_r") ? DecorGetFloat(vehicle, "vstancer_off_r") : off_r_def;
float rot_r = DecorExistOn(vehicle, "vstancer_rot_r") ? DecorGetFloat(vehicle, "vstancer_rot_r") : rot_r_def;

i will refactor and make this easier in these days, so you don’t have to care about default values and only get values using DecorGetFloat

I’ve updated the export function and made it easier to use:

SET
You can set a vstancer preset on a vehicle this way:

Lua:

exports.vstancer:SetVstancerPreset(vehicle,offset_f,rotation_f,offset_r,rotation_r)

C#:

Exports["vstancer"].SetVstancerPreset(vehicle,offset_f,rotation_f,offset_r,rotation_r);

GET
You can get such values (for your custom script/db) this way:

C#:

float[] preset = Exports["vstancer"].GetVstancerPreset(vehicle);

Lua:

local preset = exports.vstancer:GetVstancerPreset(vehicle);

The returned array contains in order: off_f, rot_f, off_r, rot_r, off_f_def, rot_f_def, off_r_def, rot_r_def

You can use this export using the latest artifact available here
https://ci.appveyor.com/project/neos7/fivem-vstancer/build/artifacts
(be sure to have the resource name called “vstancer”)

Note that when using the Set, the default values are optional and the script will get them itself if you don’t pass them

private void SetVstancerPreset(int vehicle, float off_f, float rot_f, float off_r, float rot_r, object defaultFrontOffset = null, object defaultFrontRotation = null, object defaultRearOffset = null, object defaultRearRotation = null);
private float[] GetVstancerPreset(int vehicle);
1 Like

I need help i have been trying to figure out how to put the files into five m but i am dumb so i dont know how i am very frustrated please help