-
Notifications
You must be signed in to change notification settings - Fork 1
/
sv.lua
49 lines (34 loc) · 1.25 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
RegisterServerEvent("Night:pawnserver")
AddEventHandler("Night:pawnserver", function(itemName, amount, price)
local xPlayer = ESX.GetPlayerFromId(source)
local item = xPlayer.getInventoryItem(itemName)
local locationItem = Config.shop[least]
local amount = tonumber(amount)
if amount <= 20 then
if price * amount > Config.totalselling then
if Config.usingdiscordhook then
local pawnshop = {
['Player'] = xPlayer.source,
['Log'] = 'default',
['Title'] = 'Pawnshop',
['Message'] = ''.. GetPlayerName(xPlayer.source) ..' tried to exploit pawnshop trigger!!',
['Color'] = 'blue'
}
TriggerEvent('Boost-Logs:SendLog', pawnshop)
return
DropPlayer(source, 'try again later bud')
else
return
DropPlayer(source, 'try again later bud')
end
end
else
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'you cant sell more than 20 items'})
end
if (item.count < amount) then
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'you dont have enought of this item bud!'})
elseif amount <= 20 then
xPlayer.removeInventoryItem(item.name, amount)
xPlayer.addAccountMoney('black_money', price * amount)
end
end)