[Code-Snippet] Detailed hacking animation


Hey everyone, this is the animation you may have seen in GTA 5 Online heist Pacific Standard Bank.
This is a snippet, not a script. This means it won’t do anything unless you implement it to an existing resource.
Just paste this into your script (client-side (duh!)), and trigger it whenever you want to use. Check the comments for some info.
Also, this is the resource_manifest_version you need for this to work “44febabe-d386-4d18-afbe-5e627f4af937”
Hope this helps you.
First Person Video: Watch Hacking Animation First Person by utku | Streamable
Third Person Video: Watch Hacking Animation Third Person by utku | Streamable

RegisterNetEvent("utku:hackinganim")
AddEventHandler("utku:hackinganim", function()
    local animDict = "anim@heists@ornate_bank@hack"

    RequestAnimDict(animDict)
    RequestModel("hei_prop_hst_laptop")
    RequestModel("hei_p_m_bag_var22_arm_s")
    RequestModel("hei_prop_heist_card_hack_02")

    while not HasAnimDictLoaded(animDict)
        or not HasModelLoaded("hei_prop_hst_laptop")
        or not HasModelLoaded("hei_p_m_bag_var22_arm_s")
        or not HasModelLoaded("hei_prop_heist_card_hack_02") do
        Citizen.Wait(100)
    end
    local ped = PlayerPedId()
    local targetPosition, targetRotation = (vec3(GetEntityCoords(ped))), vec3(GetEntityRotation(ped))
    local animPos = GetAnimInitialOffsetPosition(animDict, "hack_enter", 253.34, 228.25, 101.39, 253.34, 228.25, 101.39, 0, 2) -- Animasyon kordinatları, buradan lokasyonu değiştirin // These are fixed locations so if you want to change animation location change here
    local animPos2 = GetAnimInitialOffsetPosition(animDict, "hack_loop", 253.34, 228.25, 101.39, 253.34, 228.25, 101.39, 0, 2)
    local animPos3 = GetAnimInitialOffsetPosition(animDict, "hack_exit", 253.34, 228.25, 101.39, 253.34, 228.25, 101.39, 0, 2)
    -- part1
    FreezeEntityPosition(ped, true)
    local netScene = NetworkCreateSynchronisedScene(animPos, targetRotation, 2, false, false, 1065353216, 0, 1.3)
    NetworkAddPedToSynchronisedScene(ped, netScene, animDict, "hack_enter", 1.5, -4.0, 1, 16, 1148846080, 0)
    local bag = CreateObject(GetHashKey("hei_p_m_bag_var22_arm_s"), targetPosition, 1, 1, 0)
    NetworkAddEntityToSynchronisedScene(bag, netScene, animDict, "hack_enter_bag", 4.0, -8.0, 1)
    local laptop = CreateObject(GetHashKey("hei_prop_hst_laptop"), targetPosition, 1, 1, 0)
    NetworkAddEntityToSynchronisedScene(laptop, netScene, animDict, "hack_enter_laptop", 4.0, -8.0, 1)
    local card = CreateObject(GetHashKey("hei_prop_heist_card_hack_02"), targetPosition, 1, 1, 0)
    NetworkAddEntityToSynchronisedScene(card, netScene, animDict, "hack_enter_card", 4.0, -8.0, 1)
    -- part2
    local netScene2 = NetworkCreateSynchronisedScene(animPos2, targetRotation, 2, false, false, 1065353216, 0, 1.3)
    NetworkAddPedToSynchronisedScene(ped, netScene2, animDict, "hack_loop", 1.5, -4.0, 1, 16, 1148846080, 0)
    NetworkAddEntityToSynchronisedScene(bag, netScene2, animDict, "hack_loop_bag", 4.0, -8.0, 1)
    NetworkAddEntityToSynchronisedScene(laptop, netScene2, animDict, "hack_loop_laptop", 4.0, -8.0, 1)
    NetworkAddEntityToSynchronisedScene(card, netScene2, animDict, "hack_loop_card", 4.0, -8.0, 1)
    -- part3
    local netScene3 = NetworkCreateSynchronisedScene(animPos3, targetRotation, 2, false, false, 1065353216, 0, 1.3)
    NetworkAddPedToSynchronisedScene(ped, netScene3, animDict, "hack_exit", 1.5, -4.0, 1, 16, 1148846080, 0)
    NetworkAddEntityToSynchronisedScene(bag, netScene3, animDict, "hack_exit_bag", 4.0, -8.0, 1)
    NetworkAddEntityToSynchronisedScene(laptop, netScene3, animDict, "hack_exit_laptop", 4.0, -8.0, 1)
    NetworkAddEntityToSynchronisedScene(card, netScene3, animDict, "hack_exit_card", 4.0, -8.0, 1)
    --event başlangıç
    SetPedComponentVariation(ped, 5, 0, 0, 0) -- çantayı yok ediyoruz eğer varsa // removes bag from ped so no 2 bags
    SetEntityHeading(ped, 63.60) -- Animasyon düzgün oturması için yön // for proper animation direction

    NetworkStartSynchronisedScene(netScene)
    Citizen.Wait(4500) -- Burayı deneyerek daha iyi hale getirebilirsiniz // You can try editing this to make transitions perfect
    NetworkStopSynchronisedScene(netScene)

    NetworkStartSynchronisedScene(netScene2)
    Citizen.Wait(4500)
    NetworkStopSynchronisedScene(netScene2)

    NetworkStartSynchronisedScene(netScene3)
    Citizen.Wait(4500)
    NetworkStopSynchronisedScene(netScene3)

    DeleteObject(bag)
    DeleteObject(laptop)
    DeleteObject(card)
    FreezeEntityPosition(ped, false)
    SetPedComponentVariation(ped, 5, 45, 0, 0) -- çantayı pede geri veriyor // gives bag back to ped
end)

Hope this is the right category.

14 Likes

i don’t think this is supposed to be in #development:releases

Very cool, thanks for sharing!

Copy pasted it directly into lua client file.
Made a testcircle, press button to test - when entered "TriggerEvent(‘EVENTNAME’)
And then the copied version into that eventhandler.
Probs spawn, but nothing moves, not even the ped. Any help? :slight_smile:

do props do the animation or they also stay still?

Just stands still

Laptop and other stuff appears aswell. But no movement for them. Seems like the Synchronized scene doesnt start at all. Does it take something special to run a sychronized scene?

weird. do you position your ped before animation starts ?

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0) 
				if GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()), 253.34, 228.25, 101.39, true ) < 5 then
					DrawMarker(27,253.34, 228.25, 101.39-0.9,0,0,0,0,0,Rotation,1.501,1.5001,0.5001,255,0,0,200,0,0,0,true)
					DrawText3Ds(253.34, 228.25, 101.39, "~w~Tryk ~g~[E]~w~ for at teste.", 3.0, 7)
						if IsControlJustPressed(1, 38) then
							TriggerEvent('kaz_hackinganimation')
						end
				end
	end
end)

This is all i have, together with your code currently, just to test?
Ofcourse the 3dstext aswell.

Maybe because my Resource manifest is outdated? Can u perhabs post urs?

not sure if that’s the problem but worth the shot I guess “44febabe-d386-4d18-afbe-5e627f4af937”

There we go, thanks alotto :wink:

wasn’t expecting that I should add it :smiley:

Hehe yeah, i was spending alot of time on it aswell because i couldn’t fiqure it out so went into extremes xD

Anyways, i don’t know much about synchronizedScenes atm, but nice to see they exists! Do you know if its possible to make one loop ( The “Hack_loop” )?

Yes, they do exist, but some of them are broken I think. For example, thermal charge animation won’t work in some parts of the interiors. Sometimes objects spawn sometimes they don’t. Little frustrating there.
I don’t get what you mean by make one loop…

Aight, thanks for the answers and thanks for the release! always good to learn new stuff :smiley:
With loop i ment idle / repeat but ye, i think i fiqured it out :slight_smile:

Hey I have an issue I keep like going into a wall? When I do the animation and then fall under I have the right bank interior idk if its just me help would be great

Uploading: image.png…

What is the best way to find the perfect coordinates and rotation to do this animation on a different location ?

I appreciate you being interested brother !
First i had to stop development due to my actual job but i decided to quit the job and focus on development instead so im currently in the progress of starting up my buisness , i hope to open up shop again around new year ! <3

Thanks man !
the cuffs will 100 % come back but it will be updated