We provide various open source functions into our Advanced Money Laundering resource that enables you to add further customization and/or add third-party resource integrations.
Client
The functions below can be found in lation_laundering/client/functions.lua
CanOpenMenu() - Function that allows or rejects a player from opening main menu
-- Function that allows or rejects a player from opening main menuCanOpenMenu=function()-- Example implementation to show how this works-- First, we're checking if the player is deadlocal dead =IsPedDeadOrDying(cache.ped, false)-- If the variable "dead" is true, it'll return false below-- Which will not allow the menu to openif dead then-- Here is where you would display a notification providing-- Some information to the player about why the menu won't openreturnfalseend-- If "dead" is false, then the code proceeds to here-- Which now returns "true", allowing the menu to openreturntrueend
CanBuyKey() - Function that allows or rejects a player from purchasing warehouse key
-- Function that allows or rejects a player from purchasing warehouse keyCanBuyKey=function()-- This function works the same as the above CanOpenMenu-- Except obviously for the purchasing of the warehouse key-- We'll provide another example implementation below:-- Let's say we wanted to restrict buying keys to gangs only-- You would obviously replace "true" with your gang system export-- That would check if a player was in a gang or notlocal inGang =true-- Next we add an if-then statement below, so if not inGang then..ifnot inGang then-- We return false! Thus not allowing the player to purchase-- A warehouse key if they are not a gang member. We would also-- Likely inform the player here with a notification like:-- ShowNotification('You must be a gang member to purchase this', 'error')returnfalseend-- If the player IS a gang member, then we'll make it to this part of-- The code and then simply return true, allowing them to purchase a keyreturntrueend
CanEnterWarehouse() - Function that runs to verify conditions before allowing entry
-- Function that runs to verify conditions before allowing warehouse entryCanEnterWarehouse=function()-- Initialize variableslocal result, isPolice =true, false-- Check if police exception existsif Config.Police.warehouseAccess thenlocal player =GetPlayerData()for _, job inpairs(Config.Police.jobs) doif player.job.name == job then isPolice =trueendendend-- Check if player has the keylocal hasKey =HasItem(Config.Items.key, 1)ifnot hasKey andnot isPolice thenShowNotification(Strings.Notify.notAuthorized, 'error') result =falseend-- Check if we're enforcing level requirementif Config.Warehouse.requireLvl thenlocal level = exports.lation_laundering:GetData('level')if level < Config.Warehouse.unlockAt andnot isPolice thenShowNotification(Strings.Notify.notAuthorized, 'error') result =falseendend-- If you want to add custom requirements to entering the warehouse-- This is where you would make that happenreturn resultend
StartedCounting() - Function that's triggered when started counting money
-- Function that's triggered when started counting money-- This function can be used for anything, but by default-- It disables the ability to open your inventory during-- The money counting processStartedCounting=function()-- Check if ox_inventory is runningifGetResourceState('ox_inventory') =='started' then LocalPlayer.state.invBusy =trueend-- Check if qb-inventory is runningifGetResourceState('qb-inventory') =='started' then LocalPlayer.state.inv_busy =trueend-- Check if qs-inventory is runningifGetResourceState('qs-inventory') =='started' then exports['qs-inventory']:setInventoryDisabled(true)endend
StoppedCounting() - Function that's triggered when stopped counting money
-- Function that's triggered when stopped counting money-- As mentioned above, this function can be used for anything-- After a player has completed counting money, it will -- Re-enable access to their inventoryStoppedCounting=function()-- Check if ox_inventory is runningifGetResourceState('ox_inventory') =='started' then LocalPlayer.state.invBusy =falseend-- Check if qb-inventory is runningifGetResourceState('qb-inventory') =='started' then LocalPlayer.state.inv_busy =falseend-- Check if qs-inventory is runningifGetResourceState('qs-inventory') =='started' then exports['qs-inventory']:setInventoryDisabled(false)endend
StartedLaundering() - Function that's triggered when starting contracts
-- Function that's triggered when starting contractsStartedLaundering=function()end
StoppedLaundering() - Function that's triggered when stopped contracts
-- Function that's triggered when stopping contractsStoppedLaundering=function()end