[Release][C#] Vstancer



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.


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.


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

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:

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





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


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


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
(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);


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


Just drop the “vstancer” folder in your resources folder, and add “start vstancer” (without quotes) in your server.cfg file.
(and just in case, you have to add it on the server, not the client)


So it has to be on the server? I thought it was like lambda or something


Anyone know why I am unable to get this working with my server… It just doesn’t seem to work and doesn’t seem to wanna open the menu on either the default key or one I want to set it to…

Is there something special I need to do to get this working ?
Any help would be appreciated

Thanks in advance


have you tried basic stuff?
stop the server, delete cache folder, restart the server. check in server.cfg if you don’t misspelled something, if still not working, maybe try to start or restart the resource with the rcon console, also don’t change the name of the resource, some resource are sensitive and can be broken if you change the folder name (idk for this one but just in case…).


Update I was a wee bit on the dumb side and forgot I needed to be inside a vehicle for it to work :joy:
I feel so dumb but it happens I guess
Probs shouldn’t be adding scripts when tired


Can you add the ability to lower both the front and rear suspension independently?


I’ve already replied multiple times above, this is actually not possible yet


Added a new release to the release page on github

Added config fields to have different limits for front and rear wheels.
Added a config field to expose the /vstancer command to toggle the menu and a config field to expose the vstancer:toggleMenu event.
Added two exports (GetVstancerPreset and SetVstancerPreset)




@a7f8ca3 Only call PostBuildEvent if not in CI
@a700911 Fixed typo when reading frontMaxOffset from config
@ed3f799 Conversion to MenuAPI

various minor changes