Hooks
Server-sided hooks in server/hooks.lua
Each hook is an empty function in server/hooks.lua. The script calls it when something happens, and you add your own code inside it, for example to log to Discord, reward a player or trigger another resource. A hook that errors only prints a message to the console and never interrupts the script.
OnBusinessPurchased
Called when a player successfully buys a business.
function OnBusinessPurchased(identifier, businessType, locationId, price)
endParameters
identifier–string– The identifier of the new owner.businessType–string– The business type, for example"coffee_shop".locationId–integer– The ID of the business's location.price–integer– The amount paid.
OnBusinessAbandoned
Called when a player abandons their business. The owner gets no refund and all progress is lost.
function OnBusinessAbandoned(identifier, businessId, businessType, locationId)
endParameters
identifier–string– The identifier of the former owner.businessId–integer– The business ID.businessType–string– The business type.locationId–integer– The ID of the business's location.
OnBusinessTransferred
Called when a business is successfully transferred to another player.
Parameters
fromIdentifier–string– The identifier of the previous owner.toIdentifier–string– The identifier of the new owner.businessId–integer– The business ID.businessType–string– The business type.locationId–integer– The ID of the business's location.
OnStockOrderCompleted
Called when a stock delivery mission is completed successfully.
Parameters
identifier–string– The identifier of the business owner.businessId–integer– The business ID.businessType–string– The business type.unitsOrdered–integer– The units that were originally paid for.unitsDelivered–integer– The units actually delivered, after any cargo damage.cost–integer– The amount paid for the order.
OnMoneyLaundered
Called when dirty cash has been laundered into a business's Safe. It never fires for a failed or retried save.
Parameters
identifier–string– The identifier of the business owner.businessId–integer– The business ID.businessType–string– The business type.amount–integer– The gross dirty cash that was laundered.coveredAmount–integer– The part that landed as covered funds (backed by stock, safe from raids).exposedAmount–integer– The part that landed as exposed funds (can be seized in a raid).
OnCashBagCreated
Called when the owner finishes counting a withdrawal and receives a cash bag.
Parameters
ownerIdentifier–string– The identifier of the player who withdrew the bag.bagId–integer– The cash bag ID.businessId–integer– The business the money came from.amount–integer– The gross amount taken from the Safe.exposed–integer– The part of the amount that was exposed cash, which decides the chance of the deposit being flagged.
OnCashBagDeposited
Called when a deposited cash bag clears into the depositor's bank.
Parameters
depositorIdentifier–string– The identifier of the player who deposited the bag and got the money.ownerIdentifier–string– The identifier of the player who withdrew the bag (the same player, unless the bag was stolen).businessId–integer– The business the money came from.gross–integer– The amount taken from the Safe.net–integer– The amount paid into the bank after tax.bagId–integer– The cash bag ID.
OnCashBagConfiscated
Called when police confiscate a flagged cash bag deposit. The money is gone, so this is only a notification point, for example to reward the officer or log to Discord.
Parameters
officerIdentifier–string– The identifier of the officer.depositorIdentifier–string– The identifier of the player who made the deposit.ownerIdentifier–string– The identifier of the player who withdrew the bag.businessId–integer– The business the money came from.amount–integer– The gross amount that was seized.bagId–integer– The cash bag ID.
OnCashBagLost
Called for each cash bag that was still being deposited when the server restarted. The bag is gone and the money was not paid out. The row stays in moneywash_cashbags with the state lost, so you can log it or refund the depositor yourself.
Parameters
depositorIdentifier–string– The identifier of the player who deposited the bag.ownerIdentifier–string– The identifier of the player who withdrew the bag.businessId–integer– The business the money came from.amount–integer– The gross amount.bagId–integer– The cash bag ID.
OnBusinessRaided
Called when a raid finishes and the exposed cash in the Safe has been seized. The money is gone, so this is only a notification point, for example to reward the officer or log to Discord.
Parameters
officerIdentifier–string– The identifier of the officer.ownerIdentifier–string– The identifier of the business owner.businessId–integer– The business ID.seizedAmount–integer– The exposed cash that was seized.
OnBusinessBooksReviewed
Called when an owner delivers a sealed review folder and the accountant applies it. It only fires on a completed delivery, never on a cancel or a timeout.
Parameters
identifier–string– The identifier of the business owner.businessId–integer– The business ID.reduction–number– The suspicion points removed.fee–integer– The fee paid from the bank.suspicionBefore–number– The suspicion before the review.suspicionAfter–number– The suspicion after the review.receiptsUsed–integer– The number of receipts consumed.
OnContractShiftEnded
Called when a launder contract shift ends, for any reason.
Parameters
identifier–string– The player's identifier.reason–string– Why the shift ended:"player"(the player ended it),"died","dropped"(the player disconnected),"stopped"(the resource stopped),"missed"(a contact was kept waiting),"no_dirty_cash"or"switched"(another character is now on the source).handovers–integer– The completed handovers.cleaned–integer– The dirty cash handed over.paid–integer– The clean money paid out.
OnContractHandover
Called when a launder contract handover is completed and paid.
Parameters
identifier–string– The player's identifier.dirtyAmount–integer– The dirty cash handed over.paidAmount–integer– The clean money paid out, after the contact's cut.handovers–integer– The completed handovers this shift, including this one.
OnContractBetrayed
Called when a launder contract contact betrays the player and keeps the cash. The player can still recover the cash until the betrayal time is up.
Parameters
identifier–string– The player's identifier.dirtyAmount–integer– The dirty cash the contact ran off with.
Last updated