-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathserver.lua
More file actions
63 lines (46 loc) · 1.73 KB
/
Copy pathserver.lua
File metadata and controls
63 lines (46 loc) · 1.73 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--Copyright ZAUB1
--N'hesitez pas a rejoindre mon discord : https://discord.gg/yFuSEGj
--Et a me contacter directement pour tout bug ou suggestions
--ESX INIT--
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
--EVENTS--
RegisterServerEvent('pizza:pourboire') --Paie a la livraison d'une pizza + pourboire eventuel
AddEventHandler('pizza:pourboire', function(pourboire)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.addMoney(pourboire)
end)
RegisterServerEvent("pizza:paiefinale") --Paie "bonus" lors de la fin de service
AddEventHandler("pizza:paiefinale", function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local flouzefin = math.random(10, 100)
xPlayer.addMoney(flouzefin)
TriggerClientEvent("pNotify:SendNotification", source, {
text = "Voici votre petit bonus final : " .. flouzefin .. "$",
type = "success",
queue = "global",
timeout = 4000,
layout = "bottomRight"
})
end)
RegisterServerEvent("pizza:itemadd") --Ajout temporaire de l'item "pizza"
AddEventHandler("pizza:itemadd", function(nbPizza)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.addInventoryItem('pizza', tonumber(nbPizza))
end)
RegisterServerEvent("pizza:itemrm") --Rm de l'item "pizza"
AddEventHandler("pizza:itemrm", function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.removeInventoryItem('pizza', 1)
end)
RegisterServerEvent("pizza:deleteAllPizz") --Rm de l'item "pizza"
AddEventHandler("pizza:deleteAllPizz", function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local pizzanbr = xPlayer.getInventoryItem('pizza').count
xPlayer.removeInventoryItem('pizza', pizzanbr)
end)