Skip to content

pick random preview vehicle colours on the server (PlayerTextDrawGetPreviewVehCol fix) - #1286

Open
noiseXYZ wants to merge 1 commit into
openmultiplayer:masterfrom
noiseXYZ:fix/textdraw-preview-colours
Open

noiseXYZ wants to merge 1 commit into
openmultiplayer:masterfrom
noiseXYZ:fix/textdraw-preview-colours

Conversation

@noiseXYZ

Copy link
Copy Markdown

Fixes #1071

When a model preview textdraw shows a vehicle and the colours were never set, the server keeps them as -1 and sends -1 to the client. The client then picks a random colour from carcols on its own, so the server never knows what is actually shown, and "(Player)TextDrawGetPreviewVehCol" returns "-1, -1". This change makes the server pick the colours instead, using "getRandomVehilceColour" (the same that vehicles use when spawned with -1 colours). The picked colors is what gets sent to clients and what the get returns, so they always match.

Details:

  • The value passed to "SetPreviewVehCol" is still kept as is, so -1 keeps meaning "random". A new pair is picked when the preview model or the colours change.
  • Showing the textdraw again keeps the same colours.

before, each client picked its own random colour on every show, so different players could see different colours on the same global textdraw. Now the colour is picked once per textdraw and everyone sees the same one, which makes more sense to me.

Tested on Windows with latest 1.6.7.3218 realase.

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.

PlayerTextDrawGetPreviewVehicleColours

2 participants