EDIT: Fixed, I had to use ToggleVehicleMod() to enable the vehicle mod.
Hi! I want to add turbo to my vehicle right after I have spawned it. But the script is not working, the vehicle does not get any modification, I have no idea why. What could the problem be? I’m using JavaScript.
Client:
function modifyVehicle(veh)
{
SetVehicleModKit(veh, 0);
SetVehicleMod(veh, 18, 0, true);
}
onNet("modifyVehicle", modifyVehicle);
Server:
RegisterCommand("veh", function (source, args)
{
var customVehicleNames =
{
"skyline": "elegy",
"skyline_gtr": "elegy2"
}
if (customVehicleNames[args[0]])
{
args[0] = customVehicleNames[args[0]];
}
var playerPed = GetPlayerPed(source);
var heading = GetEntityHeading(playerPed);
var [positionX, positionY, positionZ] = GetEntityCoords(playerPed);
var veh = CreateVehicle(GetHashKey(args[0]), positionX, positionY, positionZ + 2, heading, true, false);
SetPedIntoVehicle(playerPed, veh, -1);
emitNet("modifyVehicle", source, veh);
});