Installation
Install the legacy crypto resource, compile its TypeScript files and connect its banking functions.
Required dependencies
Database storage used by the crypto resource.
Required for npm dependencies and TypeScript compilation.
Installation steps
- 01
Extract the resource
Copy the extracted folder into your server resources directory.
- 02
Install dependencies
Open a terminal in the source directory and install the npm packages.
npm install - 03
Configure the source
Open the source-files directory in your editor and update the required settings.
- 04
Compile the resource
Build the TypeScript files before starting the resource.
dev/compile.bat
warning
If you have not compiled your code the resource will not start!
Important file locations
source-files/src/shared/editable-config.tsShared TypeScript resource settings.
source-files/src/shared/translations.tsServer- and client-side translations.
html/js/translations.jsBrowser interface translations.
Compiling
The dev folder inside the base resource contains three batch files:
dev/installdeps.batRun once to install the required dependencies and create the node_modules folder.
dev/compile.batBuild the TypeScript files.
dev/developer.batWatch the TypeScript files and rebuild them automatically when they change.
Setting up the config
Banking functions
Connect the resource to your framework's bank and notification functions.
- Default
- ESX
- QBCore
exports('avcrypto_getBank', function(source)
return 66666
end)
exports('avcrypto_setBank', function(source, amount)
print(string.format('%s setBank function is missing.', amount))
end)
exports('avcrypto_notification', function(source, message)
print(message)
end)
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
exports('avcrypto_getBank', function(source)
local Amount = 0
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
local Bank = xPlayer.getAccount('bank')
if Bank then
Amount = Bank.money
end
end
return Amount
end)
exports('avcrypto_setBank', function(source, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
xPlayer.setAccountMoney('bank', amount)
end
end)
exports('avcrypto_notification', function(source, message)
-- Your notification export here.
print(message)
end)
local QBCore = exports["qb-core"]:GetCoreObject()
exports('avcrypto_getBank', function(source)
local Amount = 0
local qbPlayer = QBCore.Functions.GetPlayer(source)
if qbPlayer then
local bank = qbPlayer.Functions.GetMoney("bank")
if bank then
Amount = bank.money
end
end
return Amount
end)
exports('avcrypto_setBank', function(source, amount)
local qbPlayer = QBCore.Functions.GetPlayer(source)
if qbPlayer then
qbPlayer.Functions.SetMoney("bank", amount)
end
end)
exports('avcrypto_notification', function(source, message)
-- Your notification export here.
print(message)
end)