Update client.lua

This commit is contained in:
Andyyy7666
2021-12-31 15:18:22 +01:00
committed by GitHub
parent ef9c27ae20
commit 074413a267

View File

@@ -5,9 +5,6 @@
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6 -- -- For support join my discord: https://discord.gg/Z9Mxu72zZ6 --
------------------------------------------------------------------------ ------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
--PlaySoundFrontend(-1, "PIN_BUTTON", "ATM_SOUNDS", 1)
local display = false local display = false
local balance = nil local balance = nil
@@ -19,29 +16,58 @@ local atmModels = {
} }
local days = { local days = {
[0] = "Sunday", "Sunday",
[1] = "Monday", "Monday",
[2] = "Tuesday", "Tuesday",
[3] = "Wednesday", "Wednesday",
[4] = "Thursday", "Thursday",
[5] = "Friday", "Friday",
[6] = "Saturday" "Saturday"
} }
local months = { -- Get the time
[1] = "January", function getTime()
[2] = "February", local hours = GetClockHours()
[3] = "March", local minutes = GetClockMinutes()
[4] = "April", if hours <= 9 then
[5] = "May", hours = "0" .. hours
[6] = "June", end
[7] = "July", if minutes <= 9 then
[8] = "August", minutes = "0" .. minutes
[9] = "September", end
[10] = "October", return hours .. ":" .. minutes
[11] = "November", end
[12] = "December"
} -- Alert on top left of screen
function alert(msg)
BeginTextCommandDisplayHelp("STRING")
AddTextComponentSubstringPlayerName(msg)
EndTextCommandDisplayHelp(0, 0, 1, -1)
end
-- Check if player is near an atm
function IsNearATM()
local playerCoords = GetEntityCoords(PlayerPedId(), 0)
for k, v in pairs(atmModels) do
ATM = GetCoordsAndRotationOfClosestObjectOfType(playerCoords.x, playerCoords.y, playerCoords.z, 0.7, tonumber(v), 0)
if ATM == 1 then
return true
end
end
end
-- Hide/Show ui
function SetDisplay(bool)
display = bool
SetNuiFocus(bool, bool)
SendNUIMessage({
status = bool,
playerName = exports["ND_Core"]:getCharacterInfo(1) .. " " .. exports["ND_Core"]:getCharacterInfo(2),
balance = "Account Balance: $" .. exports["ND_Core"]:getCharacterInfo(8) .. ".00",
date = days[GetClockDayOfWeek() + 1],
time = getTime()
})
end
RegisterNUICallback("close", function(data) RegisterNUICallback("close", function(data)
PlaySoundFrontend(-1, "PIN_BUTTON", "ATM_SOUNDS", 1) PlaySoundFrontend(-1, "PIN_BUTTON", "ATM_SOUNDS", 1)
@@ -77,67 +103,3 @@ Citizen.CreateThread(function()
end end
end end
end) end)
-- Hide/Show ui
function SetDisplay(bool)
display = bool
SetNuiFocus(bool, bool)
SendNUIMessage({
status = bool,
playerName = exports["ND_Core"]:getCharacterInfo(1) .. " " .. exports["ND_Core"]:getCharacterInfo(2),
balance = "Account Balance: $" .. exports["ND_Core"]:getCharacterInfo(8) .. ".00",
date = getDay() .. ", " .. getMonth() .. " " .. GetClockDayOfMonth() .. ", " .. GetClockYear(),
time = getTime()
})
end
-- Get the time
function getTime()
local hours = GetClockHours()
local minutes = GetClockMinutes()
if hours <= 9 then
hours = "0" .. hours
end
if minutes <= 9 then
minutes = "0" .. minutes
end
return hours .. ":" .. minutes
end
-- Get the day of the week
function getDay()
local currentDay = GetClockDayOfWeek()
for k, v in pairs(days) do
if currentDay == k then
return v
end
end
end
-- Get Month of the year
function getMonth()
local currentMonth = GetClockMonth()
for k, v in pairs(months) do
if currentMonth == k then
return v
end
end
end
-- Alert on top left of screen
function alert(msg)
BeginTextCommandDisplayHelp("STRING")
AddTextComponentSubstringPlayerName(msg)
EndTextCommandDisplayHelp(0, 0, 1, -1)
end
-- Check if player is near an atm
function IsNearATM()
local playerCoords = GetEntityCoords(PlayerPedId(), 0)
for k, v in pairs(atmModels) do
ATM = GetCoordsAndRotationOfClosestObjectOfType(playerCoords.x, playerCoords.y, playerCoords.z, 0.7, tonumber(v), 0)
if ATM == 1 then
return true
end
end
end