Skip to content

Commit

Permalink
Small update (#2)
Browse files Browse the repository at this point in the history
* Update wagons.lua

- updated to remove vehicle propsets
- credit to Kad

* Update fxmanifest.lua

- update fx version
- add version check file path
- version bump

* Update README.md

- add bcc-utils dependency for version check

* Create versioncheck.lua

* Create version
  • Loading branch information
JusCampin authored Sep 24, 2024
1 parent 5be4d84 commit 27fa588
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 30 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
63 changes: 35 additions & 28 deletions client/wagons.lua
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 3 additions & 2 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -12,11 +12,12 @@ client_script {
}

server_script {
'server/versioncheck.lua',
'server/boats.lua'
}

shared_script {
'config.lua'
}

version '1.0.0'
version '1.0.1'
2 changes: 2 additions & 0 deletions server/versioncheck.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BccUtils = exports['bcc-utils'].initiate()
BccUtils.Versioner.checkFile(GetCurrentResourceName(), 'https://github.com/BryceCanyonCounty/bcc-vehiclefixes')
2 changes: 2 additions & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<1.0.1>
See GitHub for details!

0 comments on commit 27fa588

Please sign in to comment.