@@ -2,6 +2,7 @@ local config = require 'config.server'
2
2
local defaultSpawn = require ' config.shared' .defaultSpawn
3
3
local logger = require ' modules.logger'
4
4
local storage = require ' server.storage.main'
5
+ local triggerEventHooks = require ' modules.hooks'
5
6
local maxJobsPerPlayer = GetConvarInt (' qbx:max_jobs_per_player' , 1 )
6
7
local maxGangsPerPlayer = GetConvarInt (' qbx:max_gangs_per_player' , 1 )
7
8
local setJobReplaces = GetConvar (' qbx:setjob_replaces' , ' true' ) == ' true'
@@ -1208,6 +1209,12 @@ function AddMoney(identifier, moneyType, amount, reason)
1208
1209
1209
1210
if amount < 0 or not player .PlayerData .money [moneyType ] then return false end
1210
1211
1212
+ if not triggerEventHooks (' addMoney' , {
1213
+ source = player .PlayerData .source ,
1214
+ moneyType = moneyType ,
1215
+ amount = amount
1216
+ }) then return false end
1217
+
1211
1218
player .PlayerData .money [moneyType ] += amount
1212
1219
1213
1220
if not player .Offline then
@@ -1249,6 +1256,12 @@ function RemoveMoney(identifier, moneyType, amount, reason)
1249
1256
1250
1257
if amount < 0 or not player .PlayerData .money [moneyType ] then return false end
1251
1258
1259
+ if not triggerEventHooks (' removeMoney' , {
1260
+ source = player .PlayerData .source ,
1261
+ moneyType = moneyType ,
1262
+ amount = amount
1263
+ }) then return false end
1264
+
1252
1265
for _ , mType in pairs (config .money .dontAllowMinus ) do
1253
1266
if mType == moneyType then
1254
1267
if (player .PlayerData .money [moneyType ] - amount ) < 0 then
@@ -1298,6 +1311,12 @@ function SetMoney(identifier, moneyType, amount, reason)
1298
1311
1299
1312
if amount < 0 or not player .PlayerData .money [moneyType ] then return false end
1300
1313
1314
+ if not triggerEventHooks (' setMoney' , {
1315
+ source = player .PlayerData .source ,
1316
+ moneyType = moneyType ,
1317
+ amount = amount
1318
+ }) then return false end
1319
+
1301
1320
player .PlayerData .money [moneyType ] = amount
1302
1321
1303
1322
if not player .Offline then
0 commit comments