forked from Simnation/Main
37 lines
1.3 KiB
Lua
37 lines
1.3 KiB
Lua
local QBCore = exports['qb-core']:GetCoreObject()
|
|
|
|
RegisterNetEvent("chema_shisha:pay")
|
|
AddEventHandler("chema_shisha:pay", function(entity)
|
|
local src = source
|
|
local Player = QBCore.Functions.GetPlayer(src)
|
|
|
|
Player.Functions.RemoveMoney("cash", 20, "shisha-session")
|
|
end)
|
|
|
|
RegisterServerEvent("eff_smokes")
|
|
AddEventHandler("eff_smokes", function(entity)
|
|
TriggerClientEvent("c_eff_smokes", -1, entity)
|
|
end)
|
|
|
|
QBCore.Functions.CreateUseableItem('shisha', function(source, item)
|
|
local Player = QBCore.Functions.GetPlayer(source)
|
|
|
|
if Player.Functions.RemoveItem(item.name, 1, item.slot) then
|
|
TriggerClientEvent('QBCore:Notify', source, 'The shisha was set up.', 'success')
|
|
TriggerClientEvent("chema_shisha:spawn", -1, entity)
|
|
end
|
|
end)
|
|
|
|
QBCore.Commands.Add("deleteshisha", "Delete your shisha and get it back in inventory", {}, false, function(source)
|
|
local Player = QBCore.Functions.GetPlayer(source)
|
|
|
|
TriggerClientEvent("chema_shisha:delete", -1, entity)
|
|
Player.Functions.AddItem("shisha", 1)
|
|
TriggerClientEvent('QBCore:Notify', source, 'Shisha removed and returned to inventory', 'success')
|
|
end)
|
|
|
|
QBCore.Commands.Add("shisha", "Spawn a shisha", {}, false, function(source)
|
|
local Player = QBCore.Functions.GetPlayer(source)
|
|
|
|
TriggerClientEvent("chema_shisha:spawn", -1, entity, Player)
|
|
end)
|