-
-
Notifications
You must be signed in to change notification settings - Fork 2
Configurações de itens e shop e outras
renildomarcio edited this page Jun 10, 2019
·
2 revisions
INSERT INTO `items` (`name`, `label`, `limit`) VALUES
('phone', 'Telefone', 1)
;
INSERT INTO shops (id, name, item, price) VALUES (98, 'TwentyFourSeven', 'phone', 175), (99, 'RobsLiquor', 'phone', 175), (100, 'LTDgasoline', 'phone', 175);
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustPressed(1, KeyOpenClose) and GetLastInputMethod( 0 ) then
TooglePhone()
end
if menuIsOpen == true then
for _, value in ipairs(KeyToucheCloseEvent) do
if IsControlJustPressed(1, value.code) then
SendNUIMessage({keyUp = value.event})
end
end
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustPressed(1, KeyOpenClose) and GetLastInputMethod( 0 ) then
ESX.TriggerServerCallback('gcphone:getItemAmount', function(qtty)
if qtty > 0 then
TooglePhone()
else
TriggerEvent('esx:showNotification', "Você não tem nenhum ~r~Telefone~s~")
end
end, 'phone')
end
if menuIsOpen == true then
for _, value in ipairs(KeyToucheCloseEvent) do
if IsControlJustPressed(1, value.code) then
SendNUIMessage({keyUp = value.event})
end
end
end
end
end)
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj)
ESX = obj
end)
ESX.RegisterServerCallback('gcphone:getItemAmount', function(source, cb, item)
local xPlayer = ESX.GetPlayerFromId(source)
local qtty = xPlayer.getInventoryItem(item).count
cb(qtty)
end)