CLEO Help Drive-by Animation Sync

CLEO related
Status
Not open for further replies.

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
Hello, I have a drive-by cleo script, it works exactly the same as drive-by.cs around the internet. But there is one thing that I noticed about drive-by cleo scripts. When I drive-by, only I can see that my actor doing the driveby animation(actor pointing the gun out of the car), while All players other than me will see my actor just sitting on the car. That is why I created a script demo that can sync driveby using raknet packets(but requires sampfuncs):
Code:
{$CLEO}
0000:

const
    ISENABLED = 31@
    ISDRIVEBY = 30@
end
ISENABLED = true
ISDRIVEBY = false

{
your driveby script here! and toggle ISDRIVEBY var between 0/1 to sync driveby animation
}

const
PARAM_BITSTREAM = 0
PARAM_PACKETID = 1
PACKET_PASSENGER_SYNC = 211
BS_TYPE_BYTE = 0
BS_TYPE_SHORT = 2
end
:outpacket
if and
    ISDRIVEBY == true
    0449:   actor $PLAYER_ACTOR in_a_car
then
    0BE5: raknet 15@ = get_hook_param PARAM_PACKETID
    if 15@ == PACKET_PASSENGER_SYNC
    then
        0BE5: raknet 15@ = get_hook_param PARAM_BITSTREAM
        0BEB: raknet bit_stream 15@ ignore_bits 8
        0BE7: raknet 14@ = bit_stream_read 15@ type BS_TYPE_SHORT
        03C0: 13@ = actor $PLAYER_ACTOR car
        0B2C: samp 13@ = get_vehicle_id_by_car_handle 13@
        if 003B:   13@ == 14@  // my vehicle
        then
            0BE7: raknet 14@ = bit_stream_read 15@ type BS_TYPE_BYTE
            0B11: 14@ = 14@ OR 64 // set msb to 0x10 (driveby true)
            0BEC: raknet bit_stream 15@ set_write_offset 24
            0B40: raknet bit_stream 15@ write 14@ type BS_TYPE_BYTE size 1
            0BEC: raknet bit_stream 15@ set_write_offset 200
        end
    end
end
0BE0: raknet hook_ret true



Well that fixes my problem, but I was wondering if there is a better way of syncing the driveby animation other than my script above. Sharing it is appreciated.
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
What about run animation opcode?
0605: actor $PLAYER_ACTOR perform_animation_sequence "ParkSit_W_loop" IFP_file "BEACH" 4.0 loop 0 0 0 0 time 1
 
Last edited:

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
What about run animation opcode?
0605: actor $PLAYER_ACTOR perform_animation_sequence "ParkSit_W_loop" IFP_file "BEACH" 4.0 loop 0 0 0 0 time 1

I tried it, but driveby gets interrupted by that opcode. My actor cannot perform driveby when I add that opcode. He simply go back inside at the same time he points the gun out of the car.
 
Status
Not open for further replies.
Top