Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local interactions = {
- [22530] = true -- prop_bong_01 -- p_cs_lighter_01
- }
- local interacting = false
- Citizen.CreateThread(function ()
- local playerPed
- local playerCoords
- local itemCoords
- local activationRange
- local distance
- local item
- --[[ TODO
- exit_bong
- exit_cam
- exit_fra
- exit_lighter
- ]]
- function Scene (bong, lighter, fn)
- local animDict = "mp_safehousebong@"
- local sceneRot = vector3(0.0, 0.0, GetEntityHeading(PlayerPedId()))
- local sceneCoords = GetEntityCoords(PlayerPedId())
- local particleFlame
- RequestAnimDict(animDict)
- while not HasAnimDictLoaded(animDict) do Wait(0) end
- RequestNamedPtfxAsset('scr_fm_mp_missioncreator')
- while not HasNamedPtfxAssetLoaded('scr_fm_mp_missioncreator') do
- Citizen.Wait(0)
- end
- print('particle loaded')
- local netScene = NetworkCreateSynchronisedScene(sceneCoords, sceneRot, 2, true, false, 1065353216, 0, 1065353216)
- NetworkAddPedToSynchronisedScene(PlayerPedId(), netScene, animDict, "bong_FRA", 8.0, -8.0, 1421, 16, 1148846080, 0)
- NetworkAddEntityToSynchronisedScene(bong, netScene, animDict, "bong_bong", 8.0, -8.0, 137)
- NetworkAddEntityToSynchronisedScene(lighter, netScene, animDict, "bong_lighter", 8.0, -8.0, 137)
- --NetworkForceLocalUseOfSyncedSceneCamera(netScene, animDict, "bong_cam")
- ClearPedTasks(playerPed)
- NetworkStartSynchronisedScene(netScene)
- Citizen.Wait(0)
- local scene = NetworkConvertSynchronisedSceneToSynchronizedScene(netScene)
- local scenePhase = 0.0
- local sparked = false
- while true do
- Citizen.Wait(0)
- scenePhase = GetSynchronizedScenePhase(scene)
- if scenePhase > 0.9 then
- break
- else
- if not sparked and scenePhase > 0.185 then
- sparked = true
- StartParticleFxNonLoopedOnEntity(
- "scr_sh_lighter_sparks",
- lighter,
- 0.0, 0.0, 0.06,
- 0.0, 0.0, 0.0, 1065353216, 0, 0, 0
- )
- end
- if not particleFlame and scenePhase >= 0.194 then
- UseParticleFxAssetNextCall("scr_fm_mp_missioncreator")
- particleFlame = StartParticleFxLoopedOnEntity(
- "scr_sh_lighter_flame",
- lighter,
- 0.0, 0.0, 0.06,
- 0.0, 0.0, 0.0, 1065353216, 0, 0, 0
- )
- SetParticleFxLoopedEvolution(particleFlame, "inhale", 1.0, 0)
- elseif DoesParticleFxLoopedExist(particleFlame) and scenePhase >= 0.438 then
- StopParticleFxLooped(particleFlame, 0)
- particleFlame = 0
- elseif not particleFlame and scenePhase >= 0.495 then
- particleFlame = true
- UseParticleFxAssetNextCall("scr_fm_mp_missioncreator")
- -- StartParticleFxNonLoopedOnPedBone("scr_sh_bong_smoke", PlayerPedId(), -0.025, 0.13, 0.0, 0.0, 0.0, 0.0, 31086, 1065353216, 0, 0, 0)
- end
- end
- end
- ClearPedTasks(playerPed)
- NetworkStopSynchronisedScene(sceneId)
- RemoveAnimDict("mp_safehousebong@")
- end
- while true do
- playerPed = PlayerPedId()
- playerCoords = GetEntityCoords(playerPed)
- activationRange = 10.0
- item = 0
- if not interacting then
- for itemId,_ in pairs(interactions) do
- itemCoords = GetEntityCoords(itemId)
- distance = GetDistanceBetweenCoords(playerCoords, itemCoords, true)
- if distance < activationRange then
- activationRange = distance
- item = itemId
- end
- end
- end
- if DoesEntityExist(item) then
- DisableControlAction(0, 51)
- headsUp('PRESS ~INPUT_CONTEXT~ TO INTERACT') -- -----
- if IsDisabledControlJustPressed(0, 51) then
- if not interacting then
- interacting = true
- local lighterModel = GetHashKey("p_cs_lighter_01")
- local lighter = GetClosestObjectOfType(
- playerCoords,
- 2.0, lighterModel, 0, 0, 1
- )
- if not lighter then
- RequestModel(lighterModel)
- lighter = CreateObject(
- lighterModel, GetEntityCoords(PlayerPedId()), true, false, false
- )
- print('pull lighter out of ass')
- end
- if DoesEntityExist(lighter) then
- Scene(item, lighter)
- interacting = false
- end
- end
- end
- end
- Wait(0)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement