local atms = {
"prop_atm_01",
"prop_atm_02",
"prop_atm_03",
"prop_fleeca_atm",
}
alreadyOnATM = false
function exitATM ()
RequestAnimDict("amb@prop_human_atm@male@enter")
while (not HasAnimDictLoaded("amb@prop_human_atm@male@enter")) do
Citizen.Wait(1)
end
TaskPlayAnim(PlayerPedId(),"amb@prop_human_atm@male@enter", "enter", 1.0, 1.0, 3000, 0, 1, true, true, true)
Citizen.Wait(3000)
RequestAnimDict("amb@prop_human_atm@male@idle_a")
while (not HasAnimDictLoaded("amb@prop_human_atm@male@idle_a")) do
Citizen.Wait(1)
end
TaskPlayAnim(PlayerPedId(),"amb@prop_human_atm@male@idle_a", "idle_c", 1.0, -1.0, -1, 0, 1, true, true, true)
ClearPedTasks(GetPlayerPed(-1))
Citizen.Wait(6500)
alreadyOnATM = false
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(8)
for i = 1, #atms do
local nearestatm = GetClosestObjectOfType(GetEntityCoords(GetPlayerPed(-1), true), 0.6, GetHashKey(atms[i]), false)
if DoesEntityExist(nearestatm) then
if not alreadyOnATM then
SetTextFont(0)
SetTextProportional(1)
SetTextScale(0.0, 0.3)
SetTextColour(0, 255, 0, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString("Pressione E para acessar o Caixa Eletrônico.")
DrawText(0.01, 0.02)
end
if IsControlJustPressed(0, 38) then
if alreadyOnATM then
-- Do something before closing ATM.
exitATM()
else
print(GetEntityForwardVector(nearestatm), GetEntityRotation(nearestatm))
SetEntityHeading(GetPlayerPed(-1), GetEntityCoords(nearestatm))
RequestAnimDict("amb@prop_human_atm@male@enter")
while (not HasAnimDictLoaded("amb@prop_human_atm@male@enter")) do
Citizen.Wait(1)
end
TaskPlayAnim(PlayerPedId(),"amb@prop_human_atm@male@enter", "enter", 1.0, 1.0, 3000, 0, 1, true, true, true)
Citizen.Wait(3000)
RequestAnimDict("amb@prop_human_atm@male@base")
while (not HasAnimDictLoaded("amb@prop_human_atm@male@base")) do
Citizen.Wait(1)
end
TaskPlayAnim(PlayerPedId(),"amb@prop_human_atm@male@base", "base", 1.0, -1.0, -1, 2, 1, true, true, true)
alreadyOnATM = true
end
end
end
end
end
end)
Or just download (1.3 KB) it as a resource and start it on your config file.
It’s animated only, press E to enter ATM and E again to show the exit animation.
Anyone can improve it, it’s already an improved version of this script created by shredxt.
I’m posting in hope this’ll save time for people like me.