Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JuniorDjjr/e7ca214f59cc31171f73cbc299ebf0e6 to your computer and use it in GitHub Desktop.
Save JuniorDjjr/e7ca214f59cc31171f73cbc299ebf0e6 to your computer and use it in GitHub Desktop.
SCRIPT_START
{
LVAR_INT scplayer camMode
LVAR_FLOAT x y z targetX targetY targetZ curX curY curZ
GET_PLAYER_CHAR 0 scplayer
WHILE TRUE
WAIT 0
GET_CURRENT_CAMERA_MODE camMode
IF camMode = CAMERAMODE_FOLLOWPED
IF IS_CHAR_DOING_TASK_ID scplayer TASK_SIMPLE_STEALTH_KILL
OR IS_CHAR_DOING_TASK_ID scplayer TASK_COMPLEX_KILL_PED_ON_FOOT_STEALTH
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer 0.0 0.0 0.0 (curX curY curZ)
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer 1.0 -0.8 0.5 (x y z)
IF IS_LINE_OF_SIGHT_CLEAR curX curY curZ x y z TRUE TRUE FALSE TRUE FALSE
GOSUB SetCamera
ELSE
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer -1.0 -0.8 0.5 (x y z)
IF IS_LINE_OF_SIGHT_CLEAR curX curY curZ x y z TRUE TRUE FALSE TRUE FALSE
GOSUB SetCamera
ENDIF
ENDIF
ENDIF
ENDIF
ENDWHILE
SetCamera:
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer 0.0 1.0 0.0 (targetX targetY targetZ)
SET_FIXED_CAMERA_POSITION x y z 0.0 0.0 0.0
POINT_CAMERA_AT_POINT targetX targetY targetZ 1
WAIT 1500
RESTORE_CAMERA
RETURN
}
SCRIPT_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment