mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 14:56:02 +01:00
return values (boolean)
- added return values on following functions :fundPlayer :chargePlayer - added check for Config.System in Notify.lua
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
--- triggerNotify("Alert", "You have been warned for misconduct.", "error", playerId)
|
--- triggerNotify("Alert", "You have been warned for misconduct.", "error", playerId)
|
||||||
--- ```
|
--- ```
|
||||||
function triggerNotify(title, message, type, src)
|
function triggerNotify(title, message, type, src)
|
||||||
|
if not Config.System or not Config.System.Notify then debugPrint("Notify triggered but not set up") return end
|
||||||
if Config.System.Notify == "okok" then
|
if Config.System.Notify == "okok" then
|
||||||
if not src then
|
if not src then
|
||||||
TriggerEvent('okokNotify:Alert', title, message, 6000, type)
|
TriggerEvent('okokNotify:Alert', title, message, 6000, type)
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ end
|
|||||||
--- chargePlayer(100, "cash", playerId)
|
--- chargePlayer(100, "cash", playerId)
|
||||||
--- ```
|
--- ```
|
||||||
function chargePlayer(cost, moneyType, newsrc)
|
function chargePlayer(cost, moneyType, newsrc)
|
||||||
|
local is_success = false
|
||||||
local src = newsrc or source
|
local src = newsrc or source
|
||||||
local fundResource = ""
|
local fundResource = ""
|
||||||
if cost < 0 then
|
if cost < 0 then
|
||||||
@@ -184,33 +185,35 @@ function chargePlayer(cost, moneyType, newsrc)
|
|||||||
end
|
end
|
||||||
if moneyType == "cash" then
|
if moneyType == "cash" then
|
||||||
if isStarted(OXInv) then fundResource = OXInv
|
if isStarted(OXInv) then fundResource = OXInv
|
||||||
exports[OXInv]:RemoveItem(src, "money", cost)
|
is_success = exports[OXInv]:RemoveItem(src, "money", cost)
|
||||||
|
|
||||||
elseif isStarted(QBExport) or isStarted(QBXExport) then
|
elseif isStarted(QBExport) or isStarted(QBXExport) then
|
||||||
fundResource = QBExport
|
fundResource = QBExport
|
||||||
Core.Functions.GetPlayer(src).Functions.RemoveMoney("cash", cost)
|
is_success = Core.Functions.GetPlayer(src).Functions.RemoveMoney("cash", cost)
|
||||||
|
|
||||||
elseif isStarted(RSGExport) then
|
elseif isStarted(RSGExport) then
|
||||||
fundResource = RSGExport
|
fundResource = RSGExport
|
||||||
Core.Functions.GetPlayer(src).Functions.RemoveMoney("cash", cost)
|
is_success = Core.Functions.GetPlayer(src).Functions.RemoveMoney("cash", cost)
|
||||||
|
|
||||||
elseif isStarted(ESXExport) then
|
elseif isStarted(ESXExport) then
|
||||||
fundResource = ESXExport
|
fundResource = ESXExport
|
||||||
ESX.GetPlayerFromId(src).removeMoney(cost, "")
|
ESX.GetPlayerFromId(src).removeMoney(cost, "")
|
||||||
|
is_success = true
|
||||||
|
|
||||||
end
|
end
|
||||||
elseif moneyType == "bank" then
|
elseif moneyType == "bank" then
|
||||||
if isStarted(QBExport) or isStarted(QBXExport) then
|
if isStarted(QBExport) or isStarted(QBXExport) then
|
||||||
fundResource = QBExport
|
fundResource = QBExport
|
||||||
Core.Functions.GetPlayer(src).Functions.RemoveMoney("bank", cost)
|
is_success = Core.Functions.GetPlayer(src).Functions.RemoveMoney("bank", cost)
|
||||||
|
|
||||||
elseif isStarted(RSGExport) then
|
elseif isStarted(RSGExport) then
|
||||||
fundResource = RSGExport
|
fundResource = RSGExport
|
||||||
Core.Functions.GetPlayer(src).Functions.RemoveMoney("bank", cost)
|
is_success = Core.Functions.GetPlayer(src).Functions.RemoveMoney("bank", cost)
|
||||||
|
|
||||||
elseif isStarted(ESXExport) then
|
elseif isStarted(ESXExport) then
|
||||||
fundResource = ESXExport
|
fundResource = ESXExport
|
||||||
ESX.GetPlayerFromId(src).removeMoney(cost, "")
|
ESX.GetPlayerFromId(src).removeMoney(cost, "")
|
||||||
|
is_success = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -219,6 +222,7 @@ function chargePlayer(cost, moneyType, newsrc)
|
|||||||
else
|
else
|
||||||
debugPrint("^6Bridge^7: ^2Charging ^2Player^7: '^6"..cost.."^7'", moneyType, fundResource)
|
debugPrint("^6Bridge^7: ^2Charging ^2Player^7: '^6"..cost.."^7'", moneyType, fundResource)
|
||||||
end
|
end
|
||||||
|
return is_success
|
||||||
end
|
end
|
||||||
RegisterNetEvent(getScript()..":server:ChargePlayer", function(cost, moneyType, newsrc)
|
RegisterNetEvent(getScript()..":server:ChargePlayer", function(cost, moneyType, newsrc)
|
||||||
debugPrint(GetInvokingResource())
|
debugPrint(GetInvokingResource())
|
||||||
@@ -240,39 +244,42 @@ end)
|
|||||||
--- fundPlayer(150, "cash", playerId)
|
--- fundPlayer(150, "cash", playerId)
|
||||||
--- ```
|
--- ```
|
||||||
function fundPlayer(fund, moneyType, newsrc)
|
function fundPlayer(fund, moneyType, newsrc)
|
||||||
|
local is_success = false
|
||||||
local src = newsrc or source
|
local src = newsrc or source
|
||||||
local fundResource = ""
|
local fundResource = ""
|
||||||
|
|
||||||
if moneyType == "cash" then
|
if moneyType == "cash" then
|
||||||
if isStarted(OXInv) then
|
if isStarted(OXInv) then
|
||||||
fundResource = OXInv
|
fundResource = OXInv
|
||||||
exports[OXInv]:AddItem(src, "money", fund)
|
is_success = exports[OXInv]:AddItem(src, "money", fund)
|
||||||
|
|
||||||
elseif isStarted(QBExport) or isStarted(QBXExport) then
|
elseif isStarted(QBExport) or isStarted(QBXExport) then
|
||||||
fundResource = QBExport
|
fundResource = QBExport
|
||||||
Core.Functions.GetPlayer(src).Functions.AddMoney("cash", fund)
|
is_success = Core.Functions.GetPlayer(src).Functions.AddMoney("cash", fund)
|
||||||
|
|
||||||
elseif isStarted(RSGExport) then
|
elseif isStarted(RSGExport) then
|
||||||
fundResource = RSGExport
|
fundResource = RSGExport
|
||||||
Core.Functions.GetPlayer(src).Functions.AddMoney("cash", fund)
|
is_success = Core.Functions.GetPlayer(src).Functions.AddMoney("cash", fund)
|
||||||
|
|
||||||
elseif isStarted(ESXExport) then
|
elseif isStarted(ESXExport) then
|
||||||
fundResource = ESXExport
|
fundResource = ESXExport
|
||||||
ESX.GetPlayerFromId(src).addMoney(fund, "")
|
ESX.GetPlayerFromId(src).addMoney(fund, "")
|
||||||
|
is_success = true
|
||||||
|
|
||||||
end
|
end
|
||||||
elseif moneyType == "bank" then
|
elseif moneyType == "bank" then
|
||||||
if isStarted(QBExport) or isStarted(QBXExport) then
|
if isStarted(QBExport) or isStarted(QBXExport) then
|
||||||
fundResource = QBExport
|
fundResource = QBExport
|
||||||
Core.Functions.GetPlayer(src).Functions.AddMoney("bank", fund)
|
is_success = Core.Functions.GetPlayer(src).Functions.AddMoney("bank", fund)
|
||||||
|
|
||||||
elseif isStarted(RSGExport) then
|
elseif isStarted(RSGExport) then
|
||||||
fundResource = RSGExport
|
fundResource = RSGExport
|
||||||
Core.Functions.GetPlayer(src).Functions.AddMoney("bank", fund)
|
is_success = Core.Functions.GetPlayer(src).Functions.AddMoney("bank", fund)
|
||||||
|
|
||||||
elseif isStarted(ESXExport) then
|
elseif isStarted(ESXExport) then
|
||||||
fundResource = ESXExport
|
fundResource = ESXExport
|
||||||
ESX.GetPlayerFromId(src).addMoney(fund, "")
|
ESX.GetPlayerFromId(src).addMoney(fund, "")
|
||||||
|
is_success = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -281,6 +288,7 @@ function fundPlayer(fund, moneyType, newsrc)
|
|||||||
else
|
else
|
||||||
debugPrint("^6Bridge^7: ^2Funding Player: '^2"..fund.."^7'", moneyType, fundResource)
|
debugPrint("^6Bridge^7: ^2Funding Player: '^2"..fund.."^7'", moneyType, fundResource)
|
||||||
end
|
end
|
||||||
|
return is_success
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user