Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. local interactions = {
  2. [22530] = true -- prop_bong_01 -- p_cs_lighter_01
  3. }
  4.  
  5. local interacting = false
  6.  
  7.  
  8. Citizen.CreateThread(function ()
  9. local playerPed
  10. local playerCoords
  11. local itemCoords
  12. local activationRange
  13. local distance
  14. local item
  15.  
  16. --[[ TODO
  17. exit_bong
  18. exit_cam
  19. exit_fra
  20. exit_lighter
  21. ]]
  22.  
  23. function Scene (bong, lighter, fn)
  24. local animDict = "mp_safehousebong@"
  25. local sceneRot = vector3(0.0, 0.0, GetEntityHeading(PlayerPedId()))
  26. local sceneCoords = GetEntityCoords(PlayerPedId())
  27. local particleFlame
  28.  
  29. RequestAnimDict(animDict)
  30. while not HasAnimDictLoaded(animDict) do Wait(0) end
  31.  
  32. RequestNamedPtfxAsset('scr_fm_mp_missioncreator')
  33. while not HasNamedPtfxAssetLoaded('scr_fm_mp_missioncreator') do
  34. Citizen.Wait(0)
  35. end
  36.  
  37. print('particle loaded')
  38.  
  39. local netScene = NetworkCreateSynchronisedScene(sceneCoords, sceneRot, 2, true, false, 1065353216, 0, 1065353216)
  40. NetworkAddPedToSynchronisedScene(PlayerPedId(), netScene, animDict, "bong_FRA", 8.0, -8.0, 1421, 16, 1148846080, 0)
  41. NetworkAddEntityToSynchronisedScene(bong, netScene, animDict, "bong_bong", 8.0, -8.0, 137)
  42. NetworkAddEntityToSynchronisedScene(lighter, netScene, animDict, "bong_lighter", 8.0, -8.0, 137)
  43. --NetworkForceLocalUseOfSyncedSceneCamera(netScene, animDict, "bong_cam")
  44.  
  45. ClearPedTasks(playerPed)
  46. NetworkStartSynchronisedScene(netScene)
  47.  
  48. Citizen.Wait(0)
  49.  
  50. local scene = NetworkConvertSynchronisedSceneToSynchronizedScene(netScene)
  51. local scenePhase = 0.0
  52. local sparked = false
  53.  
  54. while true do
  55. Citizen.Wait(0)
  56. scenePhase = GetSynchronizedScenePhase(scene)
  57. if scenePhase > 0.9 then
  58. break
  59. else
  60. if not sparked and scenePhase > 0.185 then
  61. sparked = true
  62. StartParticleFxNonLoopedOnEntity(
  63. "scr_sh_lighter_sparks",
  64. lighter,
  65. 0.0, 0.0, 0.06,
  66. 0.0, 0.0, 0.0, 1065353216, 0, 0, 0
  67. )
  68. end
  69.  
  70. if not particleFlame and scenePhase >= 0.194 then
  71. UseParticleFxAssetNextCall("scr_fm_mp_missioncreator")
  72. particleFlame = StartParticleFxLoopedOnEntity(
  73. "scr_sh_lighter_flame",
  74. lighter,
  75. 0.0, 0.0, 0.06,
  76. 0.0, 0.0, 0.0, 1065353216, 0, 0, 0
  77. )
  78. SetParticleFxLoopedEvolution(particleFlame, "inhale", 1.0, 0)
  79. elseif DoesParticleFxLoopedExist(particleFlame) and scenePhase >= 0.438 then
  80. StopParticleFxLooped(particleFlame, 0)
  81. particleFlame = 0
  82. elseif not particleFlame and scenePhase >= 0.495 then
  83. particleFlame = true
  84. UseParticleFxAssetNextCall("scr_fm_mp_missioncreator")
  85. -- StartParticleFxNonLoopedOnPedBone("scr_sh_bong_smoke", PlayerPedId(), -0.025, 0.13, 0.0, 0.0, 0.0, 0.0, 31086, 1065353216, 0, 0, 0)
  86. end
  87. end
  88. end
  89.  
  90. ClearPedTasks(playerPed)
  91. NetworkStopSynchronisedScene(sceneId)
  92. RemoveAnimDict("mp_safehousebong@")
  93. end
  94.  
  95. while true do
  96. playerPed = PlayerPedId()
  97. playerCoords = GetEntityCoords(playerPed)
  98. activationRange = 10.0
  99. item = 0
  100.  
  101. if not interacting then
  102. for itemId,_ in pairs(interactions) do
  103. itemCoords = GetEntityCoords(itemId)
  104. distance = GetDistanceBetweenCoords(playerCoords, itemCoords, true)
  105. if distance < activationRange then
  106. activationRange = distance
  107. item = itemId
  108. end
  109. end
  110. end
  111.  
  112. if DoesEntityExist(item) then
  113. DisableControlAction(0, 51)
  114. headsUp('PRESS ~INPUT_CONTEXT~ TO INTERACT') -- -----
  115. if IsDisabledControlJustPressed(0, 51) then
  116. if not interacting then
  117. interacting = true
  118. local lighterModel = GetHashKey("p_cs_lighter_01")
  119. local lighter = GetClosestObjectOfType(
  120. playerCoords,
  121. 2.0, lighterModel, 0, 0, 1
  122. )
  123.  
  124. if not lighter then
  125. RequestModel(lighterModel)
  126. lighter = CreateObject(
  127. lighterModel, GetEntityCoords(PlayerPedId()), true, false, false
  128. )
  129.  
  130. print('pull lighter out of ass')
  131. end
  132.  
  133. if DoesEntityExist(lighter) then
  134. Scene(item, lighter)
  135. interacting = false
  136. end
  137. end
  138. end
  139. end
  140.  
  141. Wait(0)
  142. end
  143. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement