structura foldere
mutat kq- folders in un singur folder [kq]
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
RegisterNUICallback('GetCryptoData', function(data, cb)
|
||||
TriggerServerCallback('qb-crypto:server:GetCryptoData', function(CryptoData)
|
||||
cb(CryptoData)
|
||||
end, data.crypto)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('BuyCrypto', function(data, cb)
|
||||
TriggerServerCallback('qb-crypto:server:BuyCrypto', function(CryptoData)
|
||||
cb(CryptoData)
|
||||
end, data)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('SellCrypto', function(data, cb)
|
||||
TriggerServerCallback('qb-crypto:server:SellCrypto', function(CryptoData)
|
||||
cb(CryptoData)
|
||||
end, data)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('TransferCrypto', function(data, cb)
|
||||
TriggerServerCallback('qb-crypto:server:TransferCrypto', function(CryptoData)
|
||||
cb(CryptoData)
|
||||
end, data)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('GetCryptoTransactions', function(data, cb)
|
||||
local Data = {
|
||||
CryptoTransactions = PhoneData.CryptoTransactions
|
||||
}
|
||||
cb(Data)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('phone:client:AddTransaction', function(_, _, Message, Title)
|
||||
local Data = {
|
||||
TransactionTitle = Title,
|
||||
TransactionMessage = Message,
|
||||
}
|
||||
PhoneData.CryptoTransactions[#PhoneData.CryptoTransactions + 1] = Data
|
||||
SendNUIMessage({
|
||||
action = 'UpdateTransactions',
|
||||
CryptoTransactions = PhoneData.CryptoTransactions
|
||||
})
|
||||
SendTempNotificationOld({
|
||||
title = Lang('PHONE_NOTIFICATION_STOCK_TITLE'),
|
||||
app = 'stock',
|
||||
text = Message,
|
||||
timeout = 3500,
|
||||
})
|
||||
TriggerServerEvent('phone:server:AddTransaction', Data)
|
||||
end)
|
||||
|
||||
local function ExchangeSuccess()
|
||||
TriggerServerEvent('qb-crypto:server:ExchangeSuccess', math.random(1, 10))
|
||||
end
|
||||
|
||||
local function ExchangeFail()
|
||||
local Odd = 5
|
||||
local RemoveChance = math.random(1, Odd)
|
||||
local LosingNumber = math.random(1, Odd)
|
||||
if RemoveChance == LosingNumber then
|
||||
TriggerServerEvent('qb-crypto:server:ExchangeFail')
|
||||
TriggerServerEvent('qb-crypto:server:SyncReboot')
|
||||
end
|
||||
end
|
||||
|
||||
local function SystemCrashCooldown()
|
||||
Citizen.CreateThread(function()
|
||||
while Crypto.Exchange.RebootInfo.state do
|
||||
if (Crypto.Exchange.RebootInfo.percentage + 1) <= 100 then
|
||||
Crypto.Exchange.RebootInfo.percentage = Crypto.Exchange.RebootInfo.percentage + 1
|
||||
TriggerServerEvent('qb-crypto:server:Rebooting', true, Crypto.Exchange.RebootInfo.percentage)
|
||||
else
|
||||
Crypto.Exchange.RebootInfo.percentage = 0
|
||||
Crypto.Exchange.RebootInfo.state = false
|
||||
TriggerServerEvent('qb-crypto:server:Rebooting', false, 0)
|
||||
end
|
||||
Citizen.Wait(1200)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function HackingSuccess(success)
|
||||
if success then
|
||||
TriggerEvent('mhacking:hide')
|
||||
ExchangeSuccess()
|
||||
else
|
||||
TriggerEvent('mhacking:hide')
|
||||
ExchangeFail()
|
||||
end
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
local sleep = 5000
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
local dist = #(pos - Crypto.Exchange.coords)
|
||||
|
||||
if Config.UseTarget then return end
|
||||
if dist < 15 then
|
||||
sleep = 1
|
||||
if dist < 1.5 then
|
||||
if not Crypto.Exchange.RebootInfo.state then
|
||||
DrawText3D(Crypto.Exchange.coords.x, Crypto.Exchange.coords.y, Crypto.Exchange.coords.z, Lang('PHONE_DRAWTEXT_STOCK_ENTER_USB'), 'stock_enter_usb', 'E')
|
||||
|
||||
if IsControlJustPressed(0, 38) then
|
||||
TriggerServerCallback('qb-crypto:server:HasSticky', function(HasItem)
|
||||
if HasItem then
|
||||
TriggerEvent('mhacking:show')
|
||||
TriggerEvent('mhacking:start', math.random(4, 6), 45, HackingSuccess)
|
||||
else
|
||||
SendTextMessage(Lang('PHONE_NOTIFICATION_STOCK_MISSING_CRYPTOSTICK'), 'error')
|
||||
end
|
||||
end)
|
||||
end
|
||||
else
|
||||
DrawText3Ds(Crypto.Exchange.coords.x, Crypto.Exchange.coords.y, Crypto.Exchange.coords.z, Lang('PHONE_DRAWTEXT_STOCK_REBOOTING') .. ' ' .. Crypto.Exchange.RebootInfo.percentage .. '%')
|
||||
end
|
||||
end
|
||||
end
|
||||
Citizen.Wait(sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('qb-crypto:client:SyncReboot', function()
|
||||
Crypto.Exchange.RebootInfo.state = true
|
||||
SystemCrashCooldown()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('qb-crypto:client:UpdateCryptoWorth', function(crypto, amount, history)
|
||||
Crypto.Worth[crypto] = amount
|
||||
if history ~= nil then
|
||||
Crypto.History[crypto] = history
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('qb-crypto:client:GetRebootState', function(RebootInfo)
|
||||
if RebootInfo.state then
|
||||
Crypto.Exchange.RebootInfo.state = RebootInfo.state
|
||||
Crypto.Exchange.RebootInfo.percentage = RebootInfo.percentage
|
||||
SystemCrashCooldown()
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user