mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 18:28:52 +00:00
Perfrormance improvements, removed marker code
This commit is contained in:
+30
-33
@@ -51,8 +51,8 @@ end)
|
||||
Citizen.CreateThread(function()
|
||||
if not Config.EnableBlips then return end
|
||||
|
||||
for i=1, #Config.ATMS, 1 do
|
||||
local blip = AddBlipForCoord(Config.ATMS[i].x, Config.ATMS[i].y, Config.ATMS[i].z - Config.ZDiff)
|
||||
for i=1, #Config.ATMLocations, 1 do
|
||||
local blip = AddBlipForCoord(Config.ATMLocations[i].x, Config.ATMLocations[i].y, Config.ATMLocations[i].z - Config.ZDiff)
|
||||
SetBlipSprite (blip, Config.BlipSprite)
|
||||
SetBlipDisplay(blip, 4)
|
||||
SetBlipScale (blip, 0.9)
|
||||
@@ -64,72 +64,69 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
-- Render markers
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
for i=1, #Config.ATMS, 1 do
|
||||
if(GetDistanceBetweenCoords(coords, Config.ATMS[i].x, Config.ATMS[i].y, Config.ATMS[i].z, true) < Config.DrawDistance) then
|
||||
DrawMarker(Config.MarkerType, Config.ATMS[i].x, Config.ATMS[i].y, Config.ATMS[i].z - Config.ZDiff, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Activate menu when player is inside marker
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local canSleep = true
|
||||
isInATMMarker = false
|
||||
|
||||
for i=1, #Config.ATMS, 1 do
|
||||
if(GetDistanceBetweenCoords(coords, Config.ATMS[i].x, Config.ATMS[i].y, Config.ATMS[i].z, true) < Config.ZoneSize.x / 2) then
|
||||
for k,v in pairs(Config.ATMLocations) do
|
||||
if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then
|
||||
isInATMMarker = true
|
||||
ESX.ShowHelpNotification(_U('press_e_atm'))
|
||||
canSleep = false
|
||||
end
|
||||
end
|
||||
|
||||
if isInATMMarker and not hasAlreadyEnteredMarker then
|
||||
hasAlreadyEnteredMarker = true
|
||||
canSleep = false
|
||||
end
|
||||
|
||||
if not isInATMMarker and hasAlreadyEnteredMarker then
|
||||
hasAlreadyEnteredMarker = false
|
||||
SetNuiFocus(false)
|
||||
menuIsShowed = false
|
||||
canSleep = false
|
||||
|
||||
SendNUIMessage({
|
||||
hideAll = true
|
||||
})
|
||||
end
|
||||
|
||||
if canSleep then
|
||||
Citizen.Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Menu interactions
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(1)
|
||||
Citizen.Wait(10)
|
||||
|
||||
if menuIsShowed then
|
||||
DisableControlAction(0, 1, true) -- LookLeftRight
|
||||
DisableControlAction(0, 2, true) -- LookUpDown
|
||||
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
|
||||
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
|
||||
else
|
||||
if IsControlJustReleased(0, Keys['E']) and isInATMMarker and IsPedOnFoot(PlayerPedId()) then
|
||||
menuIsShowed = true
|
||||
ESX.TriggerServerCallback('esx:getPlayerData', function(data)
|
||||
SendNUIMessage({
|
||||
showMenu = true,
|
||||
player = {
|
||||
money = data.money,
|
||||
accounts = data.accounts
|
||||
}
|
||||
})
|
||||
end)
|
||||
-- Open UI and display Native Cursor
|
||||
SetNuiFocus(true, true)
|
||||
end
|
||||
elseif IsControlJustReleased(0, Keys['E']) and isInATMMarker and IsPedOnFoot(PlayerPedId()) then
|
||||
menuIsShowed = true
|
||||
ESX.TriggerServerCallback('esx:getPlayerData', function(data)
|
||||
SendNUIMessage({
|
||||
showMenu = true,
|
||||
player = {
|
||||
money = data.money,
|
||||
accounts = data.accounts
|
||||
}
|
||||
})
|
||||
end)
|
||||
|
||||
SetNuiFocus(true, true)
|
||||
elseif (not isInATMMarker and not menuIsShowed) then
|
||||
Citizen.Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
+73
-75
@@ -1,83 +1,81 @@
|
||||
Config = {}
|
||||
Config.MarkerType = 1
|
||||
Config.DrawDistance = 100.0
|
||||
Config.ZoneSize = {x = 3.0, y = 3.0, z = 0.3}
|
||||
Config.MarkerColor = {r = 100, g = 100, b = 204}
|
||||
Config.ZDiff = 2.0
|
||||
Config.BlipSprite = 431
|
||||
Config.Locale = 'fr'
|
||||
|
||||
Config.EnableBlips = false -- for some reason ATM blips are extremly buggy and will bug out the map
|
||||
Config.ATMS = {
|
||||
{ ['x'] = -386.733, ['y'] = 6045.953, ['z'] = 31.501},
|
||||
{ ['x'] = -110.753, ['y'] = 6467.703, ['z'] = 31.784},
|
||||
{ ['x'] = 155.4300, ['y'] = 6641.991, ['z'] = 31.784},
|
||||
{ ['x'] = 174.6720, ['y'] = 6637.218, ['z'] = 31.784},
|
||||
{ ['x'] = 1703.138, ['y'] = 6426.783, ['z'] = 32.730},
|
||||
{ ['x'] = 1735.114, ['y'] = 6411.035, ['z'] = 35.164},
|
||||
{ ['x'] = 1702.842, ['y'] = 4933.593, ['z'] = 42.051},
|
||||
{ ['x'] = 1967.333, ['y'] = 3744.293, ['z'] = 32.272},
|
||||
{ ['x'] = 1174.532, ['y'] = 2705.278, ['z'] = 38.027},
|
||||
{ ['x'] = 2564.399, ['y'] = 2585.100, ['z'] = 38.016},
|
||||
{ ['x'] = 2558.683, ['y'] = 349.6010, ['z'] = 108.050},
|
||||
{ ['x'] = 2558.051, ['y'] = 389.4817, ['z'] = 108.660},
|
||||
{ ['x'] = 1077.692, ['y'] = -775.796, ['z'] = 58.218},
|
||||
{ ['x'] = 1139.018, ['y'] = -469.886, ['z'] = 66.789},
|
||||
{ ['x'] = 1168.975, ['y'] = -457.241, ['z'] = 66.641},
|
||||
{ ['x'] = 1153.884, ['y'] = -326.540, ['z'] = 69.245},
|
||||
{ ['x'] = 236.4638, ['y'] = 217.4718, ['z'] = 106.840},
|
||||
{ ['x'] = 265.0043, ['y'] = 212.1717, ['z'] = 106.780},
|
||||
{ ['x'] = -164.568, ['y'] = 233.5066, ['z'] = 94.919},
|
||||
{ ['x'] = -1827.04, ['y'] = 785.5159, ['z'] = 138.020},
|
||||
{ ['x'] = -1409.39, ['y'] = -99.2603, ['z'] = 52.473},
|
||||
{ ['x'] = -1215.64, ['y'] = -332.231, ['z'] = 37.881},
|
||||
{ ['x'] = -2072.41, ['y'] = -316.959, ['z'] = 13.345},
|
||||
{ ['x'] = -2975.72, ['y'] = 379.7737, ['z'] = 14.992},
|
||||
{ ['x'] = -2962.60, ['y'] = 482.1914, ['z'] = 15.762},
|
||||
{ ['x'] = -3144.13, ['y'] = 1127.415, ['z'] = 20.868},
|
||||
{ ['x'] = -1305.40, ['y'] = -706.240, ['z'] = 25.352},
|
||||
{ ['x'] = -717.614, ['y'] = -915.880, ['z'] = 19.268},
|
||||
{ ['x'] = -526.566, ['y'] = -1222.90, ['z'] = 18.434},
|
||||
{ ['x'] = 149.4551, ['y'] = -1038.95, ['z'] = 29.366},
|
||||
{ ['x'] = -846.304, ['y'] = -340.402, ['z'] = 38.687},
|
||||
{ ['x'] = -1216.27, ['y'] = -331.461, ['z'] = 37.773},
|
||||
{ ['x'] = -56.1935, ['y'] = -1752.53, ['z'] = 29.452},
|
||||
{ ['x'] = -273.001, ['y'] = -2025.60, ['z'] = 30.197},
|
||||
{ ['x'] = 314.187, ['y'] = -278.621, ['z'] = 54.170},
|
||||
{ ['x'] = -351.534, ['y'] = -49.529, ['z'] = 49.042},
|
||||
{ ['x'] = -1570.197, ['y'] = -546.651, ['z'] = 34.955},
|
||||
{ ['x'] = 33.232, ['y'] = -1347.849, ['z'] = 29.497},
|
||||
{ ['x'] = 129.216, ['y'] = -1292.347, ['z'] = 29.269},
|
||||
{ ['x'] = 289.012, ['y'] = -1256.545, ['z'] = 29.440},
|
||||
{ ['x'] = 1686.753, ['y'] = 4815.809, ['z'] = 42.008},
|
||||
{ ['x'] = -302.408, ['y'] = -829.945, ['z'] = 32.417},
|
||||
{ ['x'] = 5.134, ['y'] = -919.949, ['z'] = 29.557},
|
||||
{ ['x'] = -284.037, ['y'] = 6224.385, ['z'] = 31.187},
|
||||
{ ['x'] = -135.165, ['y'] = 6365.738, ['z'] = 31.101},
|
||||
{ ['x'] = -94.9690, ['y'] = 6455.301, ['z'] = 31.784},
|
||||
{ ['x'] = 1821.917, ['y'] = 3683.483, ['z'] = 34.244},
|
||||
{ ['x'] = 540.0420, ['y'] = 2671.007, ['z'] = 42.177},
|
||||
{ ['x'] = 381.2827, ['y'] = 323.2518, ['z'] = 103.270},
|
||||
{ ['x'] = 285.2029, ['y'] = 143.5690, ['z'] = 104.970},
|
||||
{ ['x'] = 157.7698, ['y'] = 233.5450, ['z'] = 106.450},
|
||||
{ ['x'] = -1205.35, ['y'] = -325.579, ['z'] = 37.870},
|
||||
{ ['x'] = -2955.70, ['y'] = 488.7218, ['z'] = 15.486},
|
||||
{ ['x'] = -3044.22, ['y'] = 595.2429, ['z'] = 7.595},
|
||||
{ ['x'] = -3241.10, ['y'] = 996.6881, ['z'] = 12.500},
|
||||
{ ['x'] = -3241.11, ['y'] = 1009.152, ['z'] = 12.877},
|
||||
{ ['x'] = -538.225, ['y'] = -854.423, ['z'] = 29.234},
|
||||
{ ['x'] = -711.156, ['y'] = -818.958, ['z'] = 23.768},
|
||||
{ ['x'] = -256.831, ['y'] = -719.646, ['z'] = 33.444},
|
||||
{ ['x'] = -203.548, ['y'] = -861.588, ['z'] = 30.205},
|
||||
{ ['x'] = 112.4102, ['y'] = -776.162, ['z'] = 31.427},
|
||||
{ ['x'] = 112.9290, ['y'] = -818.710, ['z'] = 31.386},
|
||||
{ ['x'] = 119.9000, ['y'] = -883.826, ['z'] = 31.191},
|
||||
{ ['x'] = -261.692, ['y'] = -2012.64, ['z'] = 30.121},
|
||||
{ ['x'] = -254.112, ['y'] = -692.483, ['z'] = 33.616},
|
||||
{ ['x'] = -1415.909, ['y'] = -211.825, ['z'] = 46.500},
|
||||
{ ['x'] = -1430.122, ['y'] = -211.014, ['z'] = 46.500},
|
||||
{ ['x'] = 287.645, ['y'] = -1282.646, ['z'] = 29.659},
|
||||
{ ['x'] = 295.839, ['y'] = -895.640, ['z'] = 29.217},
|
||||
{ ['x'] = -1315.73, ['y'] = -834.89, ['z'] = 16.96},
|
||||
{ ['x'] = 89.75, ['y'] = 2.35, ['z'] = 68.31}
|
||||
|
||||
Config.ATMLocations = {
|
||||
{ ['x'] = -386.733, ['y'] = 6045.953, ['z'] = 31.501},
|
||||
{ ['x'] = -110.753, ['y'] = 6467.703, ['z'] = 31.784},
|
||||
{ ['x'] = 155.4300, ['y'] = 6641.991, ['z'] = 31.784},
|
||||
{ ['x'] = 174.6720, ['y'] = 6637.218, ['z'] = 31.784},
|
||||
{ ['x'] = 1703.138, ['y'] = 6426.783, ['z'] = 32.730},
|
||||
{ ['x'] = 1735.114, ['y'] = 6411.035, ['z'] = 35.164},
|
||||
{ ['x'] = 1702.842, ['y'] = 4933.593, ['z'] = 42.051},
|
||||
{ ['x'] = 1967.333, ['y'] = 3744.293, ['z'] = 32.272},
|
||||
{ ['x'] = 1174.532, ['y'] = 2705.278, ['z'] = 38.027},
|
||||
{ ['x'] = 2564.399, ['y'] = 2585.100, ['z'] = 38.016},
|
||||
{ ['x'] = 2558.683, ['y'] = 349.6010, ['z'] = 108.050},
|
||||
{ ['x'] = 2558.051, ['y'] = 389.4817, ['z'] = 108.660},
|
||||
{ ['x'] = 1077.692, ['y'] = -775.796, ['z'] = 58.218},
|
||||
{ ['x'] = 1139.018, ['y'] = -469.886, ['z'] = 66.789},
|
||||
{ ['x'] = 1168.975, ['y'] = -457.241, ['z'] = 66.641},
|
||||
{ ['x'] = 1153.884, ['y'] = -326.540, ['z'] = 69.245},
|
||||
{ ['x'] = 236.4638, ['y'] = 217.4718, ['z'] = 106.840},
|
||||
{ ['x'] = 265.0043, ['y'] = 212.1717, ['z'] = 106.780},
|
||||
{ ['x'] = -164.568, ['y'] = 233.5066, ['z'] = 94.919},
|
||||
{ ['x'] = -1827.04, ['y'] = 785.5159, ['z'] = 138.020},
|
||||
{ ['x'] = -1409.39, ['y'] = -99.2603, ['z'] = 52.473},
|
||||
{ ['x'] = -1215.64, ['y'] = -332.231, ['z'] = 37.881},
|
||||
{ ['x'] = -2072.41, ['y'] = -316.959, ['z'] = 13.345},
|
||||
{ ['x'] = -2975.72, ['y'] = 379.7737, ['z'] = 14.992},
|
||||
{ ['x'] = -2962.60, ['y'] = 482.1914, ['z'] = 15.762},
|
||||
{ ['x'] = -3144.13, ['y'] = 1127.415, ['z'] = 20.868},
|
||||
{ ['x'] = -1305.40, ['y'] = -706.240, ['z'] = 25.352},
|
||||
{ ['x'] = -717.614, ['y'] = -915.880, ['z'] = 19.268},
|
||||
{ ['x'] = -526.566, ['y'] = -1222.90, ['z'] = 18.434},
|
||||
{ ['x'] = 149.4551, ['y'] = -1038.95, ['z'] = 29.366},
|
||||
{ ['x'] = -846.304, ['y'] = -340.402, ['z'] = 38.687},
|
||||
{ ['x'] = -1216.27, ['y'] = -331.461, ['z'] = 37.773},
|
||||
{ ['x'] = -56.1935, ['y'] = -1752.53, ['z'] = 29.452},
|
||||
{ ['x'] = -273.001, ['y'] = -2025.60, ['z'] = 30.197},
|
||||
{ ['x'] = 314.187, ['y'] = -278.621, ['z'] = 54.170},
|
||||
{ ['x'] = -351.534, ['y'] = -49.529, ['z'] = 49.042},
|
||||
{ ['x'] = -1570.197, ['y'] = -546.651, ['z'] = 34.955},
|
||||
{ ['x'] = 33.232, ['y'] = -1347.849, ['z'] = 29.497},
|
||||
{ ['x'] = 129.216, ['y'] = -1292.347, ['z'] = 29.269},
|
||||
{ ['x'] = 289.012, ['y'] = -1256.545, ['z'] = 29.440},
|
||||
{ ['x'] = 1686.753, ['y'] = 4815.809, ['z'] = 42.008},
|
||||
{ ['x'] = -302.408, ['y'] = -829.945, ['z'] = 32.417},
|
||||
{ ['x'] = 5.134, ['y'] = -919.949, ['z'] = 29.557},
|
||||
{ ['x'] = -284.037, ['y'] = 6224.385, ['z'] = 31.187},
|
||||
{ ['x'] = -135.165, ['y'] = 6365.738, ['z'] = 31.101},
|
||||
{ ['x'] = -94.9690, ['y'] = 6455.301, ['z'] = 31.784},
|
||||
{ ['x'] = 1821.917, ['y'] = 3683.483, ['z'] = 34.244},
|
||||
{ ['x'] = 540.0420, ['y'] = 2671.007, ['z'] = 42.177},
|
||||
{ ['x'] = 381.2827, ['y'] = 323.2518, ['z'] = 103.270},
|
||||
{ ['x'] = 285.2029, ['y'] = 143.5690, ['z'] = 104.970},
|
||||
{ ['x'] = 157.7698, ['y'] = 233.5450, ['z'] = 106.450},
|
||||
{ ['x'] = -1205.35, ['y'] = -325.579, ['z'] = 37.870},
|
||||
{ ['x'] = -2955.70, ['y'] = 488.7218, ['z'] = 15.486},
|
||||
{ ['x'] = -3044.22, ['y'] = 595.2429, ['z'] = 7.595},
|
||||
{ ['x'] = -3241.10, ['y'] = 996.6881, ['z'] = 12.500},
|
||||
{ ['x'] = -3241.11, ['y'] = 1009.152, ['z'] = 12.877},
|
||||
{ ['x'] = -538.225, ['y'] = -854.423, ['z'] = 29.234},
|
||||
{ ['x'] = -711.156, ['y'] = -818.958, ['z'] = 23.768},
|
||||
{ ['x'] = -256.831, ['y'] = -719.646, ['z'] = 33.444},
|
||||
{ ['x'] = -203.548, ['y'] = -861.588, ['z'] = 30.205},
|
||||
{ ['x'] = 112.4102, ['y'] = -776.162, ['z'] = 31.427},
|
||||
{ ['x'] = 112.9290, ['y'] = -818.710, ['z'] = 31.386},
|
||||
{ ['x'] = 119.9000, ['y'] = -883.826, ['z'] = 31.191},
|
||||
{ ['x'] = -261.692, ['y'] = -2012.64, ['z'] = 30.121},
|
||||
{ ['x'] = -254.112, ['y'] = -692.483, ['z'] = 33.616},
|
||||
{ ['x'] = -1415.909, ['y'] = -211.825, ['z'] = 46.500},
|
||||
{ ['x'] = -1430.122, ['y'] = -211.014, ['z'] = 46.500},
|
||||
{ ['x'] = 287.645, ['y'] = -1282.646, ['z'] = 29.659},
|
||||
{ ['x'] = 295.839, ['y'] = -895.640, ['z'] = 29.217},
|
||||
{ ['x'] = -1315.73, ['y'] = -834.89, ['z'] = 16.96},
|
||||
{ ['x'] = 89.75, ['y'] = 2.35, ['z'] = 68.31}
|
||||
}
|
||||
|
||||
+67
-67
@@ -1,117 +1,117 @@
|
||||
@font-face {
|
||||
font-family: roboto;
|
||||
src: url('../roboto.ttf');
|
||||
font-family: roboto;
|
||||
src: url('../roboto.ttf');
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
font-family: roboto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
font-family: roboto;
|
||||
}
|
||||
|
||||
#cursor {
|
||||
position: absolute;
|
||||
z-index: 999999;
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 999999;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#container{
|
||||
position: absolute;
|
||||
background: linear-gradient(#0c3b97,#3458ae);
|
||||
height: 500px;
|
||||
width: 600px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -250px 0 0 -300px;
|
||||
cursor: default;
|
||||
#container {
|
||||
position: absolute;
|
||||
background: linear-gradient(#0c3b97, #3458ae);
|
||||
height: 500px;
|
||||
width: 600px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -250px 0 0 -300px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#header{
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 75px;
|
||||
background: linear-gradient(#f5f5f5, #adadad);
|
||||
#header {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 75px;
|
||||
background: linear-gradient(#f5f5f5, #adadad);
|
||||
}
|
||||
|
||||
#logo {
|
||||
height: 55px;
|
||||
margin: 10px;
|
||||
height: 55px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
#welcome-text {
|
||||
font-size: 25px;
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 50%;
|
||||
width: 450px;
|
||||
margin: 0 0 0 -225px;
|
||||
color: white;
|
||||
font-size: 25px;
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 50%;
|
||||
width: 450px;
|
||||
margin: 0 0 0 -225px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#menu {
|
||||
position: relative;
|
||||
top: 90%;
|
||||
position: relative;
|
||||
top: 90%;
|
||||
}
|
||||
|
||||
#menu {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 150px;
|
||||
margin: -150px auto 0;
|
||||
width: 500px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 150px;
|
||||
margin: -150px auto 0;
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
#menu div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
input {
|
||||
margin: 0 20px 0 0;
|
||||
background: linear-gradient(#00408e, #02306b);
|
||||
border-radius: 5px;
|
||||
border: 1px solid #4f89d4;
|
||||
color: white;
|
||||
margin: 0 20px 0 0;
|
||||
background: linear-gradient(#00408e, #02306b);
|
||||
border-radius: 5px;
|
||||
border: 1px solid #4f89d4;
|
||||
color: white;
|
||||
}
|
||||
|
||||
input::-webkit-outer-spin-button,
|
||||
input::-webkit-inner-spin-button {
|
||||
/* display: none; <- Crashes Chrome on hover */
|
||||
-webkit-appearance: none;
|
||||
margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
|
||||
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
|
||||
/* display: none; <- Crashes Chrome on hover */
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
/* <-- Apparently some margin are still there even though it's hidden */
|
||||
}
|
||||
|
||||
button {
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
cursor: pointer;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#deposit_btn {
|
||||
width: 250px;
|
||||
height: 50px;
|
||||
font-size: 2em;
|
||||
width: 250px;
|
||||
height: 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#deposit_amount {
|
||||
width: 250px;
|
||||
height: 50px;
|
||||
font-size: 2em;
|
||||
width: 250px;
|
||||
height: 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#withdraw_btn {
|
||||
width : 250px;
|
||||
height: 50px;
|
||||
font-size: 2em;
|
||||
width: 250px;
|
||||
height: 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#withdraw_amount {
|
||||
width : 250px;
|
||||
height : 50px;
|
||||
font-size: 2em;
|
||||
width: 250px;
|
||||
height: 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
+8
-3
@@ -1,5 +1,4 @@
|
||||
$(window).ready(function () {
|
||||
// NUI Callback
|
||||
window.addEventListener('message', function (event) {
|
||||
let data = event.data;
|
||||
|
||||
@@ -7,12 +6,14 @@ $(window).ready(function () {
|
||||
$('#container').fadeIn();
|
||||
$('#menu').fadeIn();
|
||||
$('#deposit_amount').val(data.player.money);
|
||||
|
||||
let bankAmount = 0;
|
||||
for (let i = 0; i < data.player.accounts.length; i++) {
|
||||
if (data.player.accounts[i].name == 'bank') {
|
||||
bankAmount = data.player.accounts[i].money;
|
||||
}
|
||||
}
|
||||
|
||||
$('#withdraw_amount').val(bankAmount);
|
||||
} else if (data.hideAll) {
|
||||
$('#container').fadeOut();
|
||||
@@ -31,14 +32,16 @@ $(window).ready(function () {
|
||||
$.post('http://esx_atm/deposit', JSON.stringify({
|
||||
amount: $('#deposit_amount').val()
|
||||
}));
|
||||
|
||||
$('#deposit_amount').val(0);
|
||||
})
|
||||
|
||||
$('#deposit_amount').on("keyup", function(e) {
|
||||
$('#deposit_amount').on("keyup", function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
$.post('http://esx_atm/deposit', JSON.stringify({
|
||||
amount: $('#deposit_amount').val()
|
||||
}));
|
||||
|
||||
$('#deposit_amount').val(0);
|
||||
}
|
||||
});
|
||||
@@ -47,14 +50,16 @@ $(window).ready(function () {
|
||||
$.post('http://esx_atm/withdraw', JSON.stringify({
|
||||
amount: $('#withdraw_amount').val()
|
||||
}));
|
||||
|
||||
$('#withdraw_amount').val(0);
|
||||
});
|
||||
|
||||
$('#withdraw_amount').on("keyup", function(e) {
|
||||
$('#withdraw_amount').on("keyup", function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
$.post('http://esx_atm/withdraw', JSON.stringify({
|
||||
amount: $('#withdraw_amount').val()
|
||||
}));
|
||||
|
||||
$('#withdraw_amount').val(0);
|
||||
}
|
||||
});
|
||||
|
||||
+5
-8
@@ -8,7 +8,8 @@ AddEventHandler('esx_atm:deposit', function(amount)
|
||||
amount = tonumber(amount)
|
||||
|
||||
if not tonumber(amount) then return end
|
||||
amount = round(amount)
|
||||
amount = ESX.Math.Round(amount)
|
||||
|
||||
if amount == nil or amount <= 0 or amount > xPlayer.getMoney() then
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount'))
|
||||
else
|
||||
@@ -23,11 +24,11 @@ AddEventHandler('esx_atm:withdraw', function(amount)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
amount = tonumber(amount)
|
||||
local accountMoney = xPlayer.getAccount('bank').money
|
||||
|
||||
if not tonumber(amount) then return end
|
||||
amount = round(amount)
|
||||
local accountMoney = 0
|
||||
accountMoney = xPlayer.getAccount('bank').money
|
||||
amount = ESX.Math.Round(amount)
|
||||
|
||||
if amount == nil or amount <= 0 or amount > accountMoney then
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount'))
|
||||
else
|
||||
@@ -36,7 +37,3 @@ AddEventHandler('esx_atm:withdraw', function(amount)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('withdraw_money', amount))
|
||||
end
|
||||
end)
|
||||
|
||||
function round(x)
|
||||
return x>=0 and math.floor(x+0.5) or math.ceil(x-0.5)
|
||||
end
|
||||
Reference in New Issue
Block a user