diff --git a/client/exporthandler.lua b/client/exporthandler.lua new file mode 100644 index 0000000..f3ac7e3 --- /dev/null +++ b/client/exporthandler.lua @@ -0,0 +1,13 @@ +local function exportHandler(exportName, func) + AddEventHandler(('__cfx_export_LegacyFuel_%s'):format(exportName), function(setCB) + setCB(func) + end) +end + +exportHandler('GetFuel', function(vehicle) + return GetFuel(vehicle) +end) + +exportHandler('SetFuel', function(vehicle, fuel) + SetFuel(vehicle, fuel) +end) diff --git a/fxmanifest.lua b/fxmanifest.lua index e07b61d..7172a11 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -9,7 +9,8 @@ client_scripts { 'client/fuel_cl.lua', 'client/electric_cl.lua', 'client/station_cl.lua', - 'client/utils.lua' + 'client/utils.lua', + 'client/exporthandler.lua', } server_scripts { @@ -53,3 +54,5 @@ data_file 'DLC_ITYP_REQUEST' 'stream/[electric_nozzle]/electric_nozzle_typ.ytyp' data_file 'DLC_ITYP_REQUEST' 'stream/[electric_charger]/electric_charger_typ.ytyp' provide 'cdn-syphoning' -- This is used to override cdn-syphoning(https://github.com/CodineDev/cdn-syphoning) if you have it installed. If you don't have it installed, don't worry about this. If you do, we recommend removing it and using this instead. + +provide 'LegacyFuel' \ No newline at end of file