forked from flolgl/fivem_adsystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsv.lua
32 lines (25 loc) · 1.08 KB
/
sv.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent("pub:check_money")
AddEventHandler("pub:check_money", function(text, title)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local price = 50
if xPlayer.getAccount('bank').money >= price then
xPlayer.removeAccountMoney('bank', price)
--TriggerClientEvent('pub:notif', _source, "Paiement accepté", 25)
TriggerClientEvent('pub:notif', _source, "You payment was accepted", 25)
TriggerClientEvent('pub:sendpub', -1, text, title)
--[[
/* * Uncomment the 3 lines under this one if you want to add money the money a society
* You could also add your log event here
*/
TriggerEvent('esx_addonaccount:getSharedAccount', 'society_weazel', function(account)
account.addMoney(price)
end)
--]]
else
--TriggerClientEvent('pub:notif', _source, "Paiement refusé", 208)
TriggerClientEvent('pub:notif', _source, "You payment was declined", 208)
end
end)