diff --git a/README.md b/README.md index 201e3ec..8b46f13 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,12 @@ - Removes stuck wagons - Prevents the spawning of NPC boats +## Dependencies +- [bcc-utils](https://github.com/BryceCanyonCounty/bcc-utils) + ## How to install * Download this repo +* Make sure dependencies are installed/updated and ensured before this script * Copy and paste `bcc-vehiclefixes` folder to `resources/bcc-vehiclefixes` * Add `ensure bcc-vehiclefixes` to your `server.cfg` file * Now you are ready to get coding! diff --git a/client/wagons.lua b/client/wagons.lua index 8c20c5b..ee35392 100644 --- a/client/wagons.lua +++ b/client/wagons.lua @@ -1,33 +1,40 @@ -if Config.Wagons.active then - Citizen.CreateThread(function() - local vehiclePool = {} - local wagon = 0 - local driver = 0 - local horse = 0 - while true do - vehiclePool = GetGamePool('CVehicle') -- Get the list of vehicles (entities) from the pool - for i = 1, #vehiclePool do -- loop through each vehicle (entity) - wagon = vehiclePool[i] - -- Is wagon stopped - if IsEntityAVehicle(wagon) and IsVehicleStopped(wagon) then - -- Get the horse - horse = Citizen.InvokeNative(0xA8BA0BAE0173457B,wagon,0) - -- If vehicle stopped but the horse walks = buggy wagon - if IsPedWalking(horse) then - if not IsEntityAMissionEntity(wagon) then --if the wagon is not a mission entity. Peds spawned naturally by game return false, peds created by script return true by default preventing this from deleting entities intentionally spawned by scripts - -- Delete driver & wagon - driver = Citizen.InvokeNative(0x2963B5C1637E8A27,wagon) - if driver ~= PlayerPedId() then -- Ensure the driver is not a player - if driver then - DeleteEntity(driver) -- Delete driver from wagon if there is one - end - DeleteEntity(wagon) -- Delete buggy wagon - end +local function RemoveVehicleLightPropSets(...) + return Citizen.InvokeNative(0xE31C0CB1C3186D40, ...) +end + +local function RemoveVehiclePropSets(...) + return Citizen.InvokeNative(0x3BCF32FF37EA9F1D, ...) +end + +Citizen.CreateThread(function() + local vehiclePool = {} + local wagon = 0 + local driver = 0 + local horse = 0 + while true do + vehiclePool = GetGamePool('CVehicle') -- Get the list of vehicles (entities) from the pool + for i = 1, #vehiclePool do -- loop through each vehicle (entity) + wagon = vehiclePool[i] + -- Is wagon stopped + if IsEntityAVehicle(wagon) and IsVehicleStopped(wagon) and not IsEntityAMissionEntity(wagon) then + -- Get the horse + horse = Citizen.InvokeNative(0xA8BA0BAE0173457B, wagon, 0) + -- If vehicle stopped but the horse walks = buggy wagon + if IsPedWalking(horse) then + -- Delete driver & wagon + driver = Citizen.InvokeNative(0x2963B5C1637E8A27, wagon) + if driver ~= PlayerPedId() then + if driver then + DeleteEntity(driver) end + RemoveVehicleLightPropSets(wagon) + RemoveVehiclePropSets(wagon) + DeleteEntity(wagon) + print('Delete buggy wagon') end end end - Citizen.Wait(1000) end - end) -end + Citizen.Wait(1000) + end +end) diff --git a/fxmanifest.lua b/fxmanifest.lua index 2d07028..cf51a3f 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,4 +1,4 @@ -fx_version 'adamant' +fx_version 'cerulean' rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.' game 'rdr3' @@ -12,6 +12,7 @@ client_script { } server_script { + 'server/versioncheck.lua', 'server/boats.lua' } @@ -19,4 +20,4 @@ shared_script { 'config.lua' } -version '1.0.0' \ No newline at end of file +version '1.0.1' \ No newline at end of file diff --git a/server/versioncheck.lua b/server/versioncheck.lua new file mode 100644 index 0000000..712ac81 --- /dev/null +++ b/server/versioncheck.lua @@ -0,0 +1,2 @@ +BccUtils = exports['bcc-utils'].initiate() +BccUtils.Versioner.checkFile(GetCurrentResourceName(), 'https://github.com/BryceCanyonCounty/bcc-vehiclefixes') \ No newline at end of file diff --git a/version b/version new file mode 100644 index 0000000..4425f09 --- /dev/null +++ b/version @@ -0,0 +1,2 @@ +<1.0.1> +See GitHub for details!