--================================================================================================--
--== VARIABLES - DO NOT EDIT ==--
--================================================================================================--
ESX = nil
inMenu = true
local atbank = false
local bankMenu = true
function playAnim(animDict, animName, duration)
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do Citizen.Wait(0) end
TaskPlayAnim(PlayerPedId(), animDict, animName, 1.0, -1.0, duration, 49, 1, false, false, false)
RemoveAnimDict(animDict)
end
--================================================================================================
--== THREADING - DO NOT EDIT ==
--================================================================================================
--===============================================
--== Base ESX Threading ==
--===============================================
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
--===============================================
--== Core Threading ==
--===============================================
if bankMenu then
Citizen.CreateThread(function()
while true do
Wait(0)
if nearBank() or nearATM() then
DisplayHelpText(_U('atm_open'))
if IsControlJustPressed(1, 38) then
playAnim('mp_common', 'givetake1_a', 2500)
Citizen.Wait(2500)
inMenu = true
SetNuiFocus(true, true)
SendNUIMessage({type = 'openGeneral'})
TriggerServerEvent('bank:balance')
local ped = GetPlayerPed(-1)
end
end
if IsControlJustPressed(1, 322) then
inMenu = false
SetNuiFocus(false, false)
SendNUIMessage({type = 'close'})
end
end
end)
end
--===============================================
--== Map Blips ==
--===============================================
--BANK
Citizen.CreateThread(function()
if Config.ShowBlips then
for k,v in ipairs(Config.Bank)do
local blip = AddBlipForCoord(v.x, v.y, v.z)
SetBlipSprite (blip, v.id)
SetBlipDisplay(blip, 4)
SetBlipScale (blip, 0.8)
SetBlipColour (blip, 5)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(_U('bank_blip'))
EndTextCommandSetBlipName(blip)
end
end
end)
--ATM
Citizen.CreateThread(function()
if Config.ShowBlips and Config.OnlyBank == false then
for k,v in ipairs(Config.ATM)do
local blip = AddBlipForCoord(v.x, v.y, v.z)
SetBlipSprite (blip, v.id)
SetBlipDisplay(blip, 277)
SetBlipScale (blip, 0.4)
SetBlipColour (blip, 5)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(_U('atm_blip'))
EndTextCommandSetBlipName(blip)
end
end
end)
--===============================================
--== Deposit Event ==
--===============================================
RegisterNetEvent('currentbalance1')
AddEventHandler('currentbalance1', function(balance)
local id = PlayerId()
local playerName = GetPlayerName(id)
SendNUIMessage({
type = "balanceHUD",
balance = balance,
player = playerName
})
end)
--===============================================
--== Deposit Event ==
--===============================================
RegisterNUICallback('deposit', function(data)
TriggerServerEvent('bank:deposit', tonumber(data.amount))
TriggerServerEvent('bank:balance')
end)
--===============================================
--== Withdraw Event ==
--===============================================
RegisterNUICallback('withdrawl', function(data)
TriggerServerEvent('bank:withdraw', tonumber(data.amountw))
TriggerServerEvent('bank:balance')
end)
--===============================================
--== Balance Event ==
--===============================================
RegisterNUICallback('balance', function()
TriggerServerEvent('bank:balance')
end)
RegisterNetEvent('balance:back')
AddEventHandler('balance:back', function(balance)
SendNUIMessage({type = 'balanceReturn', bal = balance})
end)
--===============================================
--== Transfer Event ==
--===============================================
RegisterNUICallback('transfer', function(data)
TriggerServerEvent('bank:transfer', data.to, data.amountt)
TriggerServerEvent('bank:balance')
end)
--===============================================
--== Result Event ==
--===============================================
RegisterNetEvent('bank:result')
AddEventHandler('bank:result', function(type, message)
SendNUIMessage({type = 'result', m = message, t = type})
end)
--===============================================
--== NUIFocusoff ==
--===============================================
RegisterNUICallback('NUIFocusOff', function()
inMenu = false
SetNuiFocus(false, false)
TriggerEvent("mythic_progbar:client:progress", {
name = "bank_action",
duration = 7500,
label = "Kartını alıyorsun.",
useWhileDead = false,
canCancel = false,
controlDisables = {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
},
prop = {
}
}, function(status)
if not status then
-- Do Something If Event Wasn't Cancelled
end
end)
playAnim('mp_common', 'givetake1_a', 2500)
Citizen.Wait(2500)
SendNUIMessage({type = 'closeAll'})
end)
--===============================================
--== Capture Bank Distance ==
--===============================================
function nearBank()
local player = GetPlayerPed(-1)
local playerloc = GetEntityCoords(player, 0)
for _, search in pairs(Config.Bank) do
local distance = GetDistanceBetweenCoords(search.x, search.y, search.z, playerloc['x'], playerloc['y'], playerloc['z'], true)
if distance <= 3 then
return true
end
end
end
function nearATM()
local player = GetPlayerPed(-1)
local playerloc = GetEntityCoords(player, 0)
for _, search in pairs(Config.ATM) do
local distance = GetDistanceBetweenCoords(search.x, search.y, search.z, playerloc['x'], playerloc['y'], playerloc['z'], true)
if distance <= 2 then
return true
end
end
end
function DisplayHelpText(str)
SetTextComponentFormat("STRING")
AddTextComponentString(str)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end