[SNIPPET] Sync Car with Packets

Opcode.eXe

Well-Known Member
Joined
Feb 18, 2013
Messages
1,279
Likes
27
Points
98
Location
( ͡° ͜ʖ ͡°)
Website
www.youtube.com
10
#1
Wanna make a iTroll mod without using "put_actor_in_car"? Wanna make Car Teleport hacks so everyone can see it? Here you go:


Code:
const
PACKET_VEHICLE_SYNC = 219
BS_TYPE_BYTE = 0
BS_TYPE_ARRAY = 5
end

//0AB1: @SYNC_VEHICLE 1 HANDLE [email protected]
:SYNC_VEHICLE
IF
0B2C: [email protected] = get_vehicle_id_by_car_handle [email protected]
THEN  
    0AC8: [email protected] = allocate_memory_size 63 // struct stInCarData ( size = 63 )
    0C0D: struct [email protected] offset 0 size 2 = [email protected] // sVehicleID;
    0C0D: struct [email protected] offset 2 size 2 = 0 // sLeftRightKeys; 
    0C0D: struct [email protected] offset 4 size 2 = 0 // sUpDownKeys;
    0C0D: struct [email protected] offset 6 size 2 = 0 // sKeys;        
    0A97: [email protected] = car [email protected] struct  
    [email protected] += 0x14
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
    0AB1: call_scm_func @Quaternion_get 1 matrix_pointer [email protected] Quat_x [email protected] Quat_y [email protected] Quat_z [email protected] Quat_w [email protected]        
    0C0D: struct [email protected] offset 8  size 4   = [email protected]
    0C0D: struct [email protected] offset 12 size 4   = [email protected]
    0C0D: struct [email protected] offset 16 size 4   = [email protected]
    0C0D: struct [email protected] offset 20 size 4   = [email protected] 
    0407: store_coords_to [email protected] [email protected] [email protected] from_car [email protected] with_offset 0.0 0.0 0.0
    0C0D: struct [email protected] offset 24 size 4   = [email protected]
    0C0D: struct [email protected] offset 28 size 4   = [email protected]
    0C0D: struct [email protected] offset 32 size 4   = [email protected]    
    0A97: [email protected] = car [email protected] struct
    [email protected] += 68   //Snippet by OpcodeXe
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
    [email protected] += 0x4
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
    [email protected] += 0x4
    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
    0C0D: struct [email protected] offset 36  size 4   = [email protected]
    0C0D: struct [email protected] offset 40  size 4   = [email protected]
    0C0D: struct [email protected] offset 44  size 4   = [email protected]    
    0227: [email protected] = car [email protected] health
    0093: [email protected] = integer [email protected] to_float    
    0C0D: struct [email protected] offset 48  size 4   = [email protected]  // car hp
    0226: [email protected] = actor $PLAYER_ACTOR health
    0C0D: struct [email protected] offset 52  size 1   = [email protected]   // PLAYER
    04DD: [email protected] = actor $PLAYER_ACTOR armour
    0C0D: struct [email protected] offset 53  size 1   = [email protected]   // ARMOUR
    0C0D: struct [email protected] offset 54  size 1   = 0   // weapon    
    0C0D: struct [email protected] offset 55  size 1   = 0   // siren
    0C0D: struct [email protected] offset 56  size 1   = 0   
    0C0D: struct [email protected] offset 57  size 2   = 0   
    0C0D: struct [email protected] offset 59  size 4   = 0.0 // train speed    
    0B3D: raknet [email protected] = new_bit_stream
    0B40: raknet bit_stream [email protected] write PACKET_VEHICLE_SYNC type BS_TYPE_BYTE size 1
    0B40: raknet bit_stream [email protected] write [email protected] type BS_TYPE_ARRAY size 63
    0B8B: raknet send bit_stream [email protected]
    0B3E: raknet delete_bit_stream [email protected]
    0AC9: free_allocated_memory [email protected]
END
0AB2: 0


:Quaternion_get 
0C0C: [email protected] = struct [email protected] offset 0 size 4
0C0C: [email protected] = struct [email protected] offset 4 size 4
0C0C: [email protected] = struct [email protected] offset 8 size 4
0C0C: [email protected] = struct [email protected] offset 16 size 4
0C0C: [email protected] = struct [email protected] offset 20 size 4
0C0C: [email protected] = struct [email protected] offset 24 size 4
0C0C: [email protected] = struct [email protected] offset 32 size 4
0C0C: [email protected] = struct [email protected] offset 36 size 4
0C0C: [email protected] = struct [email protected] offset 40 size 4
 
005B: [email protected] = [email protected]
005B: [email protected] += [email protected]
005B: [email protected] += [email protected]
 
if 0021: [email protected] > 0.0
then
0007: [email protected] = 0.5
000B: [email protected] += 1.0
01FB: sqrt [email protected] store_to [email protected]
0073: [email protected] /= [email protected]  //s
0007: [email protected] = 0.25
0073: [email protected] /= [email protected] //w
005B: [email protected] = [email protected]  //x
0063: [email protected] -= [email protected]
006B: [email protected] *= [email protected]
005B: [email protected] = [email protected]  //y
0063: [email protected] -= [email protected]
006B: [email protected] *= [email protected]
005B: [email protected] = [email protected]  //z
0063: [email protected] -= [email protected]
006B: [email protected] *= [email protected]
else if and
    0025: [email protected] > [email protected]
    0025: [email protected] > [email protected]
    then
    0007: [email protected] = 2.0
    0007: [email protected] = 1.0
    005B: [email protected] += [email protected]
    0063: [email protected] -= [email protected]
    0063: [email protected] -= [email protected]
    01FB: sqrt [email protected] store_to [email protected]
    006B: [email protected] *= [email protected] //s
    005B: [email protected] = [email protected] //w
    0063: [email protected] -= [email protected]
    0073: [email protected] /= [email protected]
    0007: [email protected] = 0.25 //x
    006B: [email protected] *= [email protected]
    005B: [email protected] = [email protected]
    005B: [email protected] += [email protected]
    0073: [email protected] /= [email protected]
    005B: [email protected] = [email protected]
    005B: [email protected] += [email protected]
    0073: [email protected] /= [email protected]
    else if 0025: [email protected] > [email protected]
        then
        0007: [email protected] = 2.0
        0007: [email protected] = 1.0
        005B: [email protected] += [email protected]
        0063: [email protected] -= [email protected]
        0063: [email protected] -= [email protected]
        01FB: sqrt [email protected] store_to [email protected]
        006B: [email protected] *= [email protected] //s
        005B: [email protected] = [email protected] //w
        0063: [email protected] -= [email protected]
        0073: [email protected] /= [email protected]
        005B: [email protected] = [email protected] //x
        005B: [email protected] += [email protected]
        0073: [email protected] /= [email protected]
        0007: [email protected] = 0.25 //y
        006B: [email protected] *= [email protected]
        005B: [email protected] = [email protected]  //z
        005B: [email protected] += [email protected]
        0073: [email protected] /= [email protected]
        else
        0007: [email protected] = 2.0
        0007: [email protected] = 1.0
        005B: [email protected] += [email protected]
        0063: [email protected] -= [email protected]
        0063: [email protected] -= [email protected]
        01FB: sqrt [email protected] store_to [email protected]
        006B: [email protected] *= [email protected] //s
        005B: [email protected] = [email protected] //w
        0063: [email protected] -= [email protected]
        0073: [email protected] /= [email protected]
        005B: [email protected] = [email protected] //x
        005B: [email protected] += [email protected]
        0073: [email protected] /= [email protected]
        005B: [email protected] = [email protected]  //y
        005B: [email protected] += [email protected]
        0073: [email protected] /= [email protected]
        0007: [email protected] = 0.25 //z
        006B: [email protected] *= [email protected]
        end
    end
end           
0AB2: ret 4 [email protected] [email protected] [email protected] [email protected]
 

DzkAy

Well-Known Member
Joined
Feb 20, 2014
Messages
472
Likes
0
Points
16
10
#8
Re: Sync Car with Packets

Can we do something to get the specify vehicle ? I mean closest , selected , etc. .. vehicle ?
[email protected] in this case mean the vehicle handle of what ? closest ?
 

DzkAy

Well-Known Member
Joined
Feb 20, 2014
Messages
472
Likes
0
Points
16
10
#10
Re: Sync Car with Packets

Opcode.eXe link said:
Do you even CLEO?

You get the car handle by yourself...
aw ok , i get it , i thought it get the car handle itself..
 

Hidend

Well-Known Member
Joined
Mar 4, 2013
Messages
438
Likes
0
Points
66
#11
Re: Sync Car with Packets

Opcode.eXe link said:
What?  :no:

This has NOTHING to do with pizdarvanka.
Maybe only the style: In your view = nothing; others = see u in a car.
Ooooh, now i understand
 

m1zg4rd_PL

Well-Known Member
Joined
Jul 19, 2013
Messages
222
Likes
0
Points
66
#13
Re: Sync Car with Packets

I wonder if it could be possible to fix kicking victim from his car and burn it etc.  :computer_guy:
Maybe if we put actor in that car as passenger first and then do the magic, victim will stay in car?
 
OP
OP
Opcode.eXe

Opcode.eXe

Well-Known Member
Joined
Feb 18, 2013
Messages
1,279
Likes
27
Points
98
Location
( ͡° ͜ʖ ͡°)
Website
www.youtube.com
10
#14
Re: Sync Car with Packets

m1zg4rd link said:
I wonder if it could be possible to fix kicking victim from his car and burn it etc.  :computer_guy:
Maybe if we put actor in that car as passenger first and then do the magic, victim will stay in car?
Its possible. There's an Passenger Sync Packet. We just have to first send the passanger sync, then driver sync. I dont wanna make a passenger sync function now: i dont need it^^
 
Joined
May 19, 2014
Messages
17
Likes
0
Points
1
1
#15
Re: Sync Car with Packets

I made a cleo script that controls a player's vehicle (actually it was a script from TH3RMAL, I just removed and add some codes to it. So, I thank you very much TH3RMAL. :stoned:) and if the driver get outs of his car because he/she can't control it, then he/she and the other players will see the vehicle still move but no driver. It's like an invisible driver cleo, but you must also be in a car. It was really more fun with a bike than a car  :trollface:

It was really fun because the admins can't ban me because they don't know who the hell is driver it and when they spec me, they see me driving another car. But the problem is that when I get too far other players can then see me :(

But now I stopped scripting and playing gta samp because of school  :eek:key:
 

MaryKate

Active Member
Joined
Feb 7, 2014
Messages
28
Likes
0
Points
1
1
#18
Re: Sync Car with Packets

Whenever i try to compile i get the error message

"Not enough actual parameters. Expected 4 params."

for the line

Code:
0B40: raknet bit_stream [email protected] write PACKET_VEHICLE_SYNC type BS_TYPE_BYTE size 1
anyone know how i fix that?
 

springfield

Well-Known Member
Staff member
Joined
Feb 18, 2005
Messages
2,935
Likes
17
Points
88
Website
www.ugbase.eu
#19
Re: Sync Car with Packets

Steezus link said:
Whenever i try to compile i get the error message

"Not enough actual parameters. Expected 4 params."

for the line

Code:
0B40: raknet bit_stream [email protected] write PACKET_VEHICLE_SYNC type BS_TYPE_BYTE size 1
anyone know how i fix that?
add in your script

Code:
const
PACKET_VEHICLE_SYNC = 219
BS_TYPE_BYTE = 0
BS_TYPE_ARRAY = 5
end
or just replace text with numbers
 
Top