CLEO Help About Sync Car with Packets

CLEO related
Status
Not open for further replies.

lol7

Active member
Joined
Apr 3, 2013
Messages
120
Reaction score
1
Location
Blumenau, Santa Catarina, Brasil
I wanna an example of how to use it properly, because my script was supposed to stuck the other player's car in the ground, but the only result I got from it was the enemy just being back again to the previous position of his car: at the time I pressed a button (if you guys know what I mean). And if I edit the script so that it try serious times to stuck his car in the ground, I get banned (car spam).

Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP

thread "troll"
 if
   8AF7: get_samp_base_to 0@
 then
     0A93: end_custom_thread
 end
 repeat
     wait 400
 until 0AFA: is_samp_structures_available
30@ = 0


:NONAME_20
wait 0
if and
0AB0:   key_pressed 16
0AB0:   key_pressed 66
else_jump @NONAME_20
jump @NONAME_30

:NONAME_30
wait 0
Actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@)  // SEARCHING START POS
3@ = 3000.0 // SEARCH RADIUS
gosub @AIC_GETACTOR  // GET ACTOR WICH IS AT POS 0@ 1@ 2@ TO 26@
if 
056D:   actor 26@ defined
else_jump @NONAME_30
jump @NONAME_40

:NONAME_40
wait 0 
if
   Actor.Driving(26@)
jf @NONAME_20 
0@ = Actor.CurrentCar(26@)
$MR_S0BEIT = Actor.CurrentCar($PLAYER_ACTOR)
jump @NONAME_99 

:NONAME_99
wait 0
if
056E:   car $MR_S0BEIT defined 
056E:   car 0@ defined 
jump @NONAME_120 

:NONAME_120
wait 0 
if 
   not Actor.InCar($PLAYER_ACTOR, 0@)
jf @NONAME_20 
if
   Actor.InCar($PLAYER_ACTOR, $MR_S0BEIT)
jf @NONAME_20
wait 0 
33@ = 0  
20@ = 0
20@ *= 10
0B2E: 21@ = read_samp_memory 0x12D60 size 2
0B2D: write samp_memory 0x12D60 value 0xC390 size 2
0B2E: 22@ = read_samp_memory 0x13FA0 size 2
0B2D: write samp_memory 0x13FA0 value 0xC390 size 2
0B2E: 23@ = read_samp_memory 0x4830 size 1
0B2D: write samp_memory 0x4830 value 0xC3 size 1
for $TROLL = 0 to 1
Car.Angle($SATAN) = 275.0
0731: set_car $SATAN y_angle_to 85.0
0AB1: @SYNC_VEHICLE 1 HANDLE 0@
end
0B2D: write samp_memory 0x12D60 value 21@ size 2
0B2D: write samp_memory 0x13FA0 value 22@ size 2
0B2D: write samp_memory 0x4830 value 23@ size 1
30@ = 0
jump @NONAME_20  

:AIC_GETACTOR
0395: clear_area 1 at 0@ 1@ 2@ radius 100000.0
0006: 16@ = 305868
0006: 5@ = @AIC_TESTACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH
//:AIC_GETOBJECT
//0006: 16@ = 305871
//0006: 17@ = @AIC_TESTOBJECTHANDLE
//0006: 20@ = 412
//:AIC_GETVEHICLE
//0006: 16@ = 305869
//0006: 17@ = @AIC_TESTVEHICLEHANDLE
//0006: 18@ = -1
//0006: 20@ = 2584
//0256:   player $PLAYER_CHAR defined
//004D: jump_if_false @AIC_STARTSEARCH
//00DF:   actor $PLAYER_ACTOR driving
//004D: jump_if_false @AIC_STARTSEARCH
//03C0: 18@ = actor $PLAYER_ACTOR car
//0002: jump @AIC_STARTSEARCH
:AIC_STARTSEARCH      
008B: 16@ = &0(16@,1i) // CPool*
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 8 )^ = 7@  // CPool.Size
0A8D: 11@ = read_memory 16@ size 4 virtual_protect 0        // CPool.pUnits
0006: 26@ = -1
0006: 10@ = 0
:AIC_SEARCHLOOPMAIN
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 11@ + 20 )^ = 4@  // xyz*
8039:   not  4@ == 0
004D: jump_if_false @AIC_SEARCHLOOPNEXT
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 48 )^ = 12@  // x
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 52 )^ = 13@  // y
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 56 )^ = 14@  // z
050A: 15@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 12@ 13@ 14@
0025:   3@ > 15@ // (float)
004D: jump_if_false @AIC_SEARCHLOOPNEXT
0085: 26@ = 10@ // (int) // counter
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 4 )^ = 4@ // CPool.flags
005A: 4@ += 26@ // (int)
0A8D: 4@ = read_memory 4@ size 1 virtual_protect 0
0012: 26@ *= 256
005A: 26@ += 4@ // (int)
0002: jump 5@
:AIC_TESTACTORHANDLE
056D:   is 26@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
003C:   $PLAYER_ACTOR == 26@ // (int)
0118:   actor 26@ dead
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE
//:AIC_TESTOBJECTHANDLE
//0001: wait 0
//83CA:   not object 26@ exists
//004D: jump_if_false @AIC_NEWSEARCHRADIUS
//:AIC_TESTVEHICLEHANDLE
//056E:   is 26@ valid_vehicle_handle
//004D: jump_if_false @AIC_NOHANDLE
//00D6: if or
//003B:   $PLAYER_ACTOR == 26@ // (int)
//0119:   car 26@ wrecked
///004D: jump_if_false @AIC_NEWSEARCHRADIUS
//0002: jump @AIC_NOHANDLE
:AIC_NOHANDLE
0006: 26@ = -1
0002: jump @AIC_SEARCHLOOPNEXT
:AIC_NEWSEARCHRADIUS
if
056D:   actor 26@ defined
jf @AIC_NOHANDLE                                        
0085: 3@ = 15@
:AIC_SEARCHLOOPNEXT
005A: 11@ += 6@ // (int)
000A: 10@ += 1
002D:   10@ >= 7@ // (int)
004D: jump_if_false @AIC_SEARCHLOOPMAIN
0051: return
:AIC_READMEMOFFSET
0A8E: 0@ = 0@ + 1@ // int
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AB2: ret 1 0@

const
PACKET_VEHICLE_SYNC = 219
BS_TYPE_BYTE = 0
BS_TYPE_ARRAY = 5
end

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

:Quaternion_get 
0C0C: 1@ = struct 0@ offset 0 size 4
0C0C: 2@ = struct 0@ offset 4 size 4
0C0C: 3@ = struct 0@ offset 8 size 4
0C0C: 4@ = struct 0@ offset 16 size 4
0C0C: 5@ = struct 0@ offset 20 size 4
0C0C: 6@ = struct 0@ offset 24 size 4
0C0C: 7@ = struct 0@ offset 32 size 4
0C0C: 8@ = struct 0@ offset 36 size 4
0C0C: 9@ = struct 0@ offset 40 size 4
 
005B: 10@ = 1@
005B: 10@ += 5@
005B: 10@ += 9@
 
if 0021: 10@ > 0.0
then
0007: 0@ = 0.5
000B: 10@ += 1.0
01FB: sqrt 10@ store_to 10@
0073: 0@ /= 10@  //s
0007: 15@ = 0.25
0073: 15@ /= 0@ //w
005B: 16@ = 8@  //x
0063: 16@ -= 6@
006B: 16@ *= 0@
005B: 17@ = 3@  //y
0063: 17@ -= 7@
006B: 17@ *= 0@
005B: 18@ = 4@  //z
0063: 18@ -= 2@
006B: 18@ *= 0@
else if and
    0025: 1@ > 5@
    0025: 1@ > 9@
    then
    0007: 0@ = 2.0
    0007: 10@ = 1.0
    005B: 10@ += 1@
    0063: 10@ -= 5@
    0063: 10@ -= 9@
    01FB: sqrt 10@ store_to 10@
    006B: 0@ *= 10@ //s
    005B: 15@ = 8@ //w
    0063: 15@ -= 6@
    0073: 15@ /= 0@
    0007: 16@ = 0.25 //x
    006B: 16@ *= 0@
    005B: 17@ = 2@
    005B: 17@ += 4@
    0073: 17@ /= 0@
    005B: 18@ = 3@
    005B: 18@ += 7@
    0073: 18@ /= 0@
    else if 0025: 5@ > 9@
        then
        0007: 0@ = 2.0
        0007: 10@ = 1.0
        005B: 10@ += 5@
        0063: 10@ -= 1@
        0063: 10@ -= 9@
        01FB: sqrt 10@ store_to 10@
        006B: 0@ *= 10@ //s
        005B: 15@ = 3@ //w
        0063: 15@ -= 7@
        0073: 15@ /= 0@
        005B: 16@ = 2@ //x
        005B: 16@ += 4@
        0073: 16@ /= 0@
        0007: 17@ = 0.25 //y
        006B: 17@ *= 0@
        005B: 18@ = 6@  //z
        005B: 18@ += 8@
        0073: 18@ /= 0@
        else
        0007: 0@ = 2.0
        0007: 10@ = 1.0
        005B: 10@ += 9@
        0063: 10@ -= 1@
        0063: 10@ -= 5@
        01FB: sqrt 10@ store_to 10@
        006B: 0@ *= 10@ //s
        005B: 15@ = 4@ //w
        0063: 15@ -= 2@
        0073: 15@ /= 0@
        005B: 16@ = 3@ //x
        005B: 16@ += 7@
        0073: 16@ /= 0@
        005B: 17@ = 6@  //y
        005B: 17@ += 8@
        0073: 17@ /= 0@
        0007: 18@ = 0.25 //z
        006B: 18@ *= 0@
        end
    end
end           
0AB2: ret 4 15@ 16@ 17@ 18@

The only thing I could do so far, and that was synced, was:
Code:
0224: set_car 0@ health_to 0

Let me explain the other way:

The thing is: I don't know how to make more action with the car, because the script is not able to do so. Example:

Code:
for $TROLL = 0 to 1
Car.Angle($SATAN) = 275.0  // first action
0731: set_car $SATAN y_angle_to 85.0 // second action
0AB1: @SYNC_VEHICLE 1 HANDLE 0@ // sync the actions
end

However, I can just make one action, and it's only:

Code:
0223: set_actor 0@ health_to 0

What I want: I want to be able to do more actions than to just set fire on that car. Thanks in advance.
 

lol7

Active member
Joined
Apr 3, 2013
Messages
120
Reaction score
1
Location
Blumenau, Santa Catarina, Brasil
I'm so sorry for this drama, people. That was my blindness and my bad. The script should be replace:

Code:
for $TROLL = 0 to 1
Car.Angle($SATAN) = 275.0  // first action
0731: set_car $SATAN y_angle_to 85.0 // second action
0AB1: @SYNC_VEHICLE 1 HANDLE 0@ // sync the actions
end

with:

Code:
33@ = 0
repeat
Car.Angle(0@) = 275.0 
0731: set_car 0@ y_angle_to 85.0
0AB1: @SYNC_VEHICLE 1 HANDLE 0@
until 33@ == 300
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
lol7 link said:
I'm so sorry for this drama, people. That was my blindness and my bad. The script should be replace:

Code:
for $TROLL = 0 to 1
Car.Angle($SATAN) = 275.0  // first action
0731: set_car $SATAN y_angle_to 85.0 // second action
0AB1: @SYNC_VEHICLE 1 HANDLE 0@ // sync the actions
end

with:

Code:
33@ = 0
repeat
Car.Angle(0@) = 275.0 
0731: set_car 0@ y_angle_to 85.0
0AB1: @SYNC_VEHICLE 1 HANDLE 0@
until 33@ == 300

use this:
until 33@ > 300
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
lol7 link said:
The problem is: I get instant ban. That's why I'm gonna sadly use 036A: put_actor $PLAYER_ACTOR in_car UNDEFINED  :forever_opcode_alone:

Its the same.

You get banned because you send over 1000packets in a second. xD

Turn:

33@ = 0
repeat
Car.Angle(0@) = 275.0
0731: set_car 0@ y_angle_to 85.0
0AB1: @SYNC_VEHICLE 1 HANDLE 0@
until 33@ == 300

Into:


Car.Angle(0@) = 275.0
0731: set_car 0@ y_angle_to 85.0
0AB1: @SYNC_VEHICLE 1 HANDLE 0@
WAIT 100
Car.Angle(0@) = 275.0
0731: set_car 0@ y_angle_to 85.0
0AB1: @SYNC_VEHICLE 1 HANDLE 0@
WAIT 100
 
Status
Not open for further replies.
Top