mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 14:56:02 +01:00
chargePlayer & fundPlayer server events/fixes
This commit is contained in:
51
wrapper.lua
51
wrapper.lua
@@ -1003,31 +1003,58 @@ AddStateBagChangeHandler(GetCurrentResourceName()..':setVehicleProperties', '',
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent(GetCurrentResourceName()..":server:ChargePlayer", function(cost, type) local src = source
|
RegisterNetEvent(GetCurrentResourceName()..":server:ChargePlayer", function(cost, type, newsrc)
|
||||||
if Config.System.Debug then print("^6Bridge^7: ^2Charging ^2Player: '^6"..cost.."^7'", type) end
|
local src = newsrc or source
|
||||||
|
local fundResource = ""
|
||||||
if type == "cash" then
|
if type == "cash" then
|
||||||
if GetResourceState(OXInv):find("start") then
|
if GetResourceState(OXInv):find("start") then fundResource = OXInv
|
||||||
exports[OXInv]:RemoveItem(src, "money", cost)
|
exports[OXInv]:RemoveItem(src, "money", cost)
|
||||||
if Config.System.Debug then print("^6Bridge^7: ^2Charging ^2Player: '^6"..cost.."^7'", type, OXInv) end
|
elseif GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then fundResource = QBExport
|
||||||
elseif GetResourceState(QBExport):find("start") then
|
|
||||||
Core.Functions.GetPlayer(src).Functions.RemoveMoney("cash", cost)
|
Core.Functions.GetPlayer(src).Functions.RemoveMoney("cash", cost)
|
||||||
if Config.System.Debug then print("^6Bridge^7: ^2Charging ^2Player: '^6"..cost.."^7'", type, QBExport) end
|
elseif GetResourceState(ESXExport):find("start") then fundResource = ESXExport
|
||||||
elseif GetResourceState(ESXExport):find("start") then
|
|
||||||
local Player = ESX.GetPlayerFromId(src)
|
local Player = ESX.GetPlayerFromId(src)
|
||||||
Player.removeMoney(cost, "")
|
Player.removeMoney(cost, "")
|
||||||
if Config.System.Debug then print("^6Bridge^7: ^2Charging ^2Player: '^6"..cost.."^7'", type, ESXExport) end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if type == "bank" then
|
if type == "bank" then
|
||||||
if GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then
|
if GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then fundResource = QBExport
|
||||||
Core.Functions.GetPlayer(src).Functions.RemoveMoney("bank", cost)
|
Core.Functions.GetPlayer(src).Functions.RemoveMoney("bank", cost)
|
||||||
if Config.System.Debug then print("^6Bridge^7: ^2Charging ^2Player: '^6"..cost.."^7'", type, QBExport) end
|
elseif GetResourceState(ESXExport):find("start") then fundResource = ESXExport
|
||||||
elseif GetResourceState(ESXExport):find("start") then
|
|
||||||
local Player = ESX.GetPlayerFromId(src)
|
local Player = ESX.GetPlayerFromId(src)
|
||||||
Player.removeMoney(cost, "")
|
Player.removeMoney(cost, "")
|
||||||
if Config.System.Debug then print("^6Bridge^7: ^2Charging ^2Player: '^6"..cost.."^7'", type, ESXExport) end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if fundResource == "" then print("error - check exports.lua")
|
||||||
|
else
|
||||||
|
if Config.System.Debug then print("^6Bridge^7: ^2Charging ^2Player^7: '^6"..cost.."^7'", type, fundResource) end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent(GetCurrentResourceName()..":server:FundPlayer", function(fund, type, newsrc)
|
||||||
|
local src = newsrc or source
|
||||||
|
local fundResource = ""
|
||||||
|
if type == "cash" then
|
||||||
|
if GetResourceState(OXInv):find("start") then fundResource = OXInv
|
||||||
|
exports[OXInv]:AddItem(src, "money", fund)
|
||||||
|
elseif GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then fundResource = QBExport
|
||||||
|
Core.Functions.GetPlayer(src).Functions.AddMoney("cash", fund)
|
||||||
|
elseif GetResourceState(ESXExport):find("start") then fundResource = ESXExport
|
||||||
|
local Player = ESX.GetPlayerFromId(src)
|
||||||
|
Player.addMoney(fund, "")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if type == "bank" then
|
||||||
|
if GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then fundResource = QBExport
|
||||||
|
Core.Functions.GetPlayer(src).Functions.AddMoney("bank", fund)
|
||||||
|
elseif GetResourceState(ESXExport):find("start") then fundResource = ESXExport
|
||||||
|
local Player = ESX.GetPlayerFromId(src)
|
||||||
|
Player.addMoney(fund, "")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if fundResource == "" then print("error - check exports.lua")
|
||||||
|
else
|
||||||
|
if Config.System.Debug then print("^6Bridge^7: ^2Funding ^2Player^7: '^2"..fund.."^7'", type, fundResource) end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function createUseableItem(item, funct)
|
function createUseableItem(item, funct)
|
||||||
|
|||||||
Reference in New Issue
Block a user