forked from Simnation/Main
60 lines
2.4 KiB
Lua
60 lines
2.4 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)
|
|
|
|
local CurrentVersion = '1.0'
|
|
|
|
PerformHttpRequest('https://raw.githubusercontent.com/ChemaSanchez/chema_shisha/main/Version.txt', function(Error, NewestVersion, Header)
|
|
PerformHttpRequest('https://raw.githubusercontent.com/ChemaSanchez/chema_shisha/main/Version.txt', function(Error, Changes, Header)
|
|
print('^0')
|
|
print('^6[chema_shisha]^0 Checking for updates...')
|
|
print('^0')
|
|
print('^6[chema_shisha]^0 Version: ^5' .. CurrentVersion .. '^0')
|
|
print('^0')
|
|
if CurrentVersion ~= NewestVersion then
|
|
print('^6[chema_shisha]^0 Your script is ^8outdated^0!')
|
|
print('^0')
|
|
print('^6[chema_shisha] ^3New Version ^5' .. NewestVersion .. ':^0')
|
|
print('^3')
|
|
print('^0')
|
|
print('^6[chema_shisha]^0 You ^8do not have^0 the latest version of ^5chema_shisha^0. Update it: https://github.com/ChemaSanchez/chema_shisha/releases/tag/'.. NewestVersion)
|
|
else
|
|
print('^6[chema_shisha]^0 Script is ^2up to date^0')
|
|
end
|
|
print('^0')
|
|
end)
|
|
end)
|