v3.4.0
Runs on Qbox, and the vehicle sale no longer pays the seller before the buyer has actually paid.
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.
RemoveMoneyrefuses 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_vehiclesandplayerslayout as QBCore, verified againstqbx_core.sqlandqbx_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:playerLoadedon the server and onQBCore:Client:OnPlayerLoaded/OnPlayerUnloadon the client. msk_core turns every framework's own load event intomsk_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
AddEventHandlernow. -
The job rank was read under two different names.
grade_nameon ESX,grade.nameon QBCore, and neither existed on Qbox. It isgradeNameeverywhere now. -
GetPlayerVehiclesreturned an empty list, and offline players showed up as their raw identifier in the dashboard. Both branched onConfig.Framework, which msk_core detects now, so the value stayed at'AUTO'and every branch was skipped. They askMSK.Bridge.Framework.Typeinstead and cover Qbox with the same path as QBCore. A vehicle row with unreadable property JSON no longer takesGetPlayerVehiclesdown either.
Changed
-
Config.Frameworkinconfig/static.luais 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'sconfig.luainstead. -
Framework detection is gone from this resource. It sat at the top of
client/main.luaandserver/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.luamirroredesx:setPlayerData,esx:setJobandQBCore:Player:SetPlayerDatainto a local table that nothing else in the resource read. msk_core keeps that copy itself, useMSK.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