CLEO Help Move camera back and forth between two points

CLEO related
Status
Not open for further replies.

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Hello, I am creating a script where a camera follows a player actor, and the camera can move back and forth, the direction of the camera movement is between My Player(Point1) and the Target Player(Point2). Here is the script that I have so far.

Code:
{$CLEO .cs}
0000:

const
    TARGETPLAYER = 31@
    CAMOFFSET = 30@
end

0B34: samp register_client_command "camfollow" to_label @lockcam
0B34: samp register_client_command "camoffset" to_label @changeoffset

TARGETPLAYER = -1 // no player
CAMOFFSET = 0.0

while true
    wait 0
    if TARGETPLAYER >= 0
    then
        0B20: samp 0@ = actor_handle_by_samp_player_id TARGETPLAYER
        067E: put_camera_on_actor $PLAYER_ACTOR offset CAMOFFSET CAMOFFSET CAMOFFSET target_actor 0@ tilt 0.0 switchstyle 2 // I have problem here with the proper offsets
    end
end

:lockcam
0B35: samp 0@ = get_last_command_params
if 0AD4: 0@ = scan_string 0@ format "%d" 1@
then
    if SAMP.IsPlayerConnected(1@)
    then
        0085: TARGETPLAYER = 1@ // (int)
        0B36: samp 0@ = get_player_nickname 1@
        chatmsg "CALOCK on Player ID: {00ff00}%d , Name: {ff0000}%s. To Disable simply lock on -1 player" 0xFFFF00 1@ 0@
    else
        02EB: restore_camera_with_jumpcut
        chatmsg "CAMLOCK: Target Player does not exist, Camera Restored!" 0xFFFF00
    end
else chatmsg "CAMLOCK: INVALID FORMAT!" 0xFFFF00
end
0B43: samp cmd_ret

:changeoffset
0B35: samp 0@ = get_last_command_params
if 0AD4: 0@ = scan_string 0@ format "%f" 1@
then
    0087: CAMOFFSET = 1@ // (float)
    chatmsg "CALOCK: Offset Now is %f" 0xFFFF00 1@
else chatmsg "CAMLOCK: INVALID FORMAT!" 0xFFFF00
end
0B43: samp cmd_ret

But I am having problem about the movement of the camera :(. As you can See, I want to put the camera between Point1(my player) and Point2(target player) with an offset. Is there any snippet where I can get the proper camera offset so that I can manually move the camera back and forth between point1 and point 2? I really need it thanks :).
 
Last edited:

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
I posted here because My brain got twisted when I am dealing with Trigonometry with this sh*t. The thing that is in my mind is It needs three right triangles where the hypotenuse of thos three triangles are equal to "CAMOFFSET".
 
Status
Not open for further replies.
Top