Advertisement
RanggaBS

GTA SA dead camera

Sep 9th, 2022
1,081
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.02 KB | None | 0 0
  1. --[[
  2.     GTA SA - Dead Camera test
  3.     Author: RBS ID
  4. ]]
  5.  
  6. -- print  ped  variable when using find all peds code
  7. function ped_test()
  8.     for _, ped in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
  9.         TextPrintString("_: " .. tostring(_) .. "\nped: " .. tostring(ped), 1, 1)
  10.     end
  11. end
  12.  
  13. function main()
  14.     while not SystemIsReady() do
  15.         Wait(0)
  16.     end
  17.  
  18.     local cam = {
  19.         pos = {
  20.             x = 0, y = 0, z = 0,    h = 0
  21.         },
  22.         look = {
  23.             x = 0, y = 0, z = 0,    h = 0
  24.         }
  25.     }
  26.  
  27.     local toggle = false
  28.  
  29.     local temp = {
  30.  
  31.     }
  32.  
  33.     local timer = {
  34.         startCamToFadeIn = GetTimer()
  35.     }
  36.  
  37.     while 1 < 2 do
  38.         Wait(0)
  39.        
  40.         --ped_test()
  41.  
  42.         if IsButtonBeingReleased(14, 0) then
  43.             toggle = not toggle
  44.             if not toggle then
  45.                 Wait(1)
  46.                 CameraFade(100, 1)
  47.                 PlayerSetControl(1)
  48.                 CameraReturnToPlayer()
  49.             else
  50.                 PlayerSetControl(0)
  51.                 cam.pos.h = 0
  52.                 cam.pos.x, cam.pos.y, cam.pos.z = PlayerGetPosXYZ()
  53.                 cam.pos.z = cam.pos.z + 3
  54.                 cam.look.x, cam.look.y, cam.look.z = PlayerGetPosXYZ()
  55.                 timer.startCamToFadeIn = GetTimer()
  56.             end
  57.         end
  58.  
  59.         --cam.pos.x, cam.pos.y, cam.pos.z = PlayerGetPosXYZ()
  60.         --cam.pos.y = cam.pos.y - 0.5
  61.         --cam.pos.z = cam.pos.z + 3
  62.  
  63.         if toggle then
  64.  
  65.             cam.pos.x, cam.pos.y, temp[1] = PlayerGetPosXYZ()
  66.             --cam.look.x, cam.look.y, cam.look.z = PlayerGetPosXYZ()
  67.  
  68.             cam.pos.h = cam.pos.h + 0.04
  69.             cam.pos.h = cam.pos.h < -math.pi and math.pi or (cam.pos.h > math.pi and -math.pi or cam.pos.h)
  70.  
  71.             cam.pos.x, cam.pos.z = cam.pos.x-math.sin(cam.pos.h)*3, cam.pos.z+0.02
  72.             cam.look.x, cam.look.y = cam.pos.x, cam.pos.y
  73.  
  74.             CameraSetXYZ(
  75.                 cam.pos.x, cam.pos.y+3, cam.pos.z,
  76.                 cam.pos.x, cam.pos.y, temp[1]
  77.             )
  78.             TextPrintString("WASTED", 0.1, 1)
  79.             if GetTimer() >= timer.startCamToFadeIn+3000 then
  80.                 CameraFade(3000, 0)
  81.             end
  82.         end
  83.  
  84.        
  85.  
  86.         --TextPrintString("Pos X: " .. tostring(cam.pos.x) .. ", Y: " .. tostring(cam.pos.y) .. ", Z: " .. tostring(cam.pos.z) .. "\nLook X: " .. tostring(cam.look.x) .. ", Y: " .. tostring(cam.look.y) .. ", Z: " .. tostring(cam.look.z), 1, 2)
  87.  
  88.     end
  89. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement