Skip to content

Fix rental adoption in the collector job - #1

Open
AnthoHansen wants to merge 1 commit into
loopfivem:mainfrom
AnthoHansen:fix/collection-rental-adoption
Open

AnthoHansen wants to merge 1 commit into
loopfivem:mainfrom
AnthoHansen:fix/collection-rental-adoption

Conversation

@AnthoHansen

Copy link
Copy Markdown

Fix rental adoption in the collector job

The collector job could adopt scooters that should not be collectable, and it paid the same as fleet scooters for them. With the default Config.Price = 0 this let players earn money with no limit by collecting their own (or a friend's) free rentals. It also accepted any loop_scooter spawned by a client.

Changes

  • server/collection.lua adoptable() and server/main.lua ScootRentalCollectable(): only a live rental (a vehicle with the loopScoot state that matches an entry in rentals) can be adopted. Anything else is refused with err.scooterBusyOrGone.
  • ScootRentalCollectable(): the renter cannot collect their own rental (err.rentalInUse). The guard radius check for other collectors is unchanged.
  • New Config.Collection.payPerRental (default 0). Adopted rentals are paid at that rate instead of payPerScooter. Fleet scooters still pay payPerScooter.
  • An adopted rental that is dropped, or still in the truck when the shift ends, is removed instead of joining the fleet. Before, it got a fleet entry and respawned at its pickup spot forever, so the number of scooters on the map could keep growing.
  • README: documented payPerRental.

No locale keys added (existing messages reused). No client changes.

Testing

Syntax-checked with luac 5.4. Not tested in game yet; suggested checks (Qbox):

  • Fleet scooter: pickup, load, hand in, paid payPerScooter.
  • Abandoned rental of another player (renter away): pickup, load, hand in, paid payPerRental.
  • Own rental: pickup refused.
  • Rental of another player who is next to it: refused (unchanged).
  • Adopted rental dropped on the ground: removed, does not respawn.

- Only live rentals can be adopted. A loop_scooter the server did not
  rent out (no loopScoot state, or no matching rental) is refused.
- A renter can no longer collect their own rental.
- Adopted rentals pay Config.Collection.payPerRental (default 0)
  instead of payPerScooter.
- An adopted rental that is dropped, or left in the truck when the
  shift ends, is removed instead of joining the fleet and respawning
  at its pickup spot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant