fix(esx_property): report whether the property was actually sold - #136
Open
seltonmt012 wants to merge 1 commit into
Open
fix(esx_property): report whether the property was actually sold#136seltonmt012 wants to merge 1 commit into
seltonmt012 wants to merge 1 commit into
Conversation
attemptSellToPlayer answered the client with the agent's own bank balance, read after the commission had been credited. The buyer, whose money decides the sale, was never part of the answer. Both directions are wrong. A broke agent who sold successfully got "cannot sell" while the property had already changed hands, and a rich agent got a refreshed menu as if the sale went through when the buyer could not pay, had disconnected, or the agent held the wrong job. buyProperty right above already has the shape: put the condition in a local before any money moves, then hand that local to cb. This does the same. Driven against the shipped callback, price 1000 with the default 25 percent commission. The answer disagreed with what happened in four of five cases before and agrees in all five now: buyer can pay, agent broke sold, answered false -> true buyer cannot pay, agent rich not sold, answered true -> false buyer can pay, agent rich sold, answered true, unchanged agent has the wrong job not sold, answered true -> false buyer disconnected not sold, answered true -> false
seltonmt012
force-pushed
the
fix/property-sell-result
branch
from
August 8, 2026 18:25
e63fd74 to
2e7bff4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
attemptSellToPlayertells the client whether the agent can afford the property, measured after the agent was paid, instead of whether the sale happened.Motivation
xPlayeris the estate agent running the command.xTargetis the buyer, and the buyer's money is what decides the sale. The agent's balance has nothing to do with it, and by the time this line runs the agent has already been credited the commission, so the number being compared is not even the one from the start of the call.Both directions go wrong, and the client acts on the answer:
An agent with a thin bank account sells a property and is told "cannot sell" while the keys have already moved. A wealthy agent gets a refreshed menu as if the sale went through when the buyer could not pay, had disconnected, or the agent was not even in the estate agent job.
Implementation Details
buyProperty, directly above in the same file, already has the shape this one is missing: put the condition in a local before any money moves, then hand that local tocb. This change makesattemptSellToPlayermatch it.Driven against the shipped callback with a price of 1000 and the default 25 percent commission:
falsetruetruefalsetruetruetruefalsetruefalseFour of the five answers contradicted what actually happened. The one that was right is the happy path, which is why this holds up in normal use and only shows itself when something goes wrong.
Usage Example
PR Checklist
Nothing about who gets the property or the money changes, only the answer sent back to the client.
Tested headless against the shipped file, not with two clients on a live server.