Zum Hauptinhalt springen

v3.4.0

Runs on Qbox, and the vehicle sale no longer pays the seller before the buyer has actually paid.

Requires msk_core 4.0.0 or newer

Every framework call in this resource goes through the rewritten bridge. On msk_core 3.x the player object arrives without its methods and nothing works. Update msk_core along with this script.

Security

  • Money could be created out of nothing when selling a vehicle. Both framework branches credited the seller before taking the money from the buyer:

    Seller.addAccountMoney('bank', offer.price)
    Buyer.removeAccountMoney('bank', offer.price)

    A deduction that failed for any reason left the seller paid and the buyer's balance untouched. The money is taken first now, and only a successful deduction credits the seller. RemoveMoney refuses on an insufficient balance and says so, so the deduction itself decides instead of the check in front of it.

Added

  • Qbox support. Qbox uses the same player_vehicles and players layout as QBCore, verified against qbx_core.sql and qbx_vehicles/vehicles.sql.

Fixed

  • Nothing was ever set up for a player on ESX. The keyring item and the conversion of the old storage method hung on esx:playerLoaded on the server and on QBCore:Client:OnPlayerLoaded / OnPlayerUnload on the client. msk_core turns every framework's own load event into msk_core:playerLoaded, which is what the resource listens to now, on all three frameworks.

  • The load and logout handlers were net events. Server side those events are local, and as net events any client could fire them with an arbitrary player id. They are AddEventHandler now.

  • The job rank was read under two different names. grade_name on ESX, grade.name on QBCore, and neither existed on Qbox. It is gradeName everywhere now.

  • GetPlayerVehicles returned an empty list, and offline players showed up as their raw identifier in the dashboard. Both branched on Config.Framework, which msk_core detects now, so the value stayed at 'AUTO' and every branch was skipped. They ask MSK.Bridge.Framework.Type instead and cover Qbox with the same path as QBCore. A vehicle row with unreadable property JSON no longer takes GetPlayerVehicles down either.

Changed

  • Config.Framework in config/static.lua is no longer read. The line stays so an existing config does not break, but changing it has no effect. Pin the framework in msk_core's config.lua instead.

  • Framework detection is gone from this resource. It sat at the top of client/main.lua and server/main.lua, knew only ESX and QBCore, and msk_core has already detected the framework when those files load. The table names are still resolved per framework, because that is what actually differs.

  • The client no longer keeps its own copy of the player data. client/main.lua mirrored esx:setPlayerData, esx:setJob and QBCore:Player:SetPlayerData into a local table that nothing else in the resource read. msk_core keeps that copy itself, use MSK.GetPlayerData().

  • Usable items are registered through MSK.RegisterItem, which covers ESX, QBCore and Qbox in one call.

  • The player helpers (GetPlayerFromId, GetPlayerFromIdentifier, GetPlayerSource, GetPlayerIdentifier, GetPlayerJob) keep their names, because the rest of the resource calls them, but each is one line now instead of one branch per framework.

Changed files

fxmanifest.lua
config/static.lua
client/main.lua
client/encrypted.lua
server/main.lua
server/functions.lua
server/storage.lua
server/admin/api.lua
server/admin/permissions.lua