ajom
Well-known member
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):
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.
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.