CLEO Help Cruise control with the back and for airplanes

CLEO related
Status
Not open for further replies.

JoeVitollo

Member
Joined
Aug 28, 2018
Messages
18
Reaction score
0
Hello! I use cruise control without activation on the "=" key, that is, after I take my finger on "W" it goes alone at constant speed, well I want to make a cruise control that goes with the back (to give the car back) I go to "S" and when I take the finger on the button to go back.
I made this code:
Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
if 
0AA9:   is_game_version_original 
else_jump @NONAME_30 
7@ = 5503856 
jump @NONAME_40 

:NONAME_30
7@ = 5505040 

:NONAME_40
0AA7: call_function 7@ num_params 1 pop 1 0 10@  

:NONAME_55
wait 0 
if and
   Actor.Driving($PLAYER_ACTOR)
84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle 
else_jump @NONAME_558 
if 
  1@ == 0 
else_jump @NONAME_127 
if 
key_down 83 
else_jump @NONAME_120 
1@ = 1 

:NONAME_120
jump @NONAME_308 

:NONAME_127
if 
  1@ == 1 
else_jump @NONAME_174 
if 
   not key_down 83
else_jump @NONAME_167 
1@ = 2 

:NONAME_167
jump @NONAME_308 

:NONAME_174
if 
  2@ == 0 
else_jump @NONAME_294 
if 
80E1:   not player 0 pressed_key 16 
else_jump @NONAME_287 
1@ = 0 
0@ = Actor.CurrentCar($PLAYER_ACTOR)
02E3: 4@ = car 0@ speed 
if 
  4@ > 1.0 
else_jump @NONAME_287 
4@ += 0.25 
2@ = 1 
wait 100 
03CC: enable_car 0@ stuck_check_distance_to 1.0 time_to 500 

:NONAME_287
jump @NONAME_308 

:NONAME_294
1@ = 0 
gosub @NONAME_590 

:NONAME_308
if 
  2@ == 1 
else_jump @NONAME_551 
if 
83CE:   not car 0@ stuck 
else_jump @NONAME_544 
02E3: 3@ = car 0@ speed 
0087: 5@ = 4@ // (float) 
0063: 5@ -= 3@ // (float) 
if 
  0 > 5@ 
else_jump @NONAME_398 
6@ = 28 
jump @NONAME_405 

:NONAME_398
6@ = 32 

:NONAME_405
if and
80E1:   not player 0 pressed_key 14 
80E1:   not player 0 pressed_key 16 
else_jump @NONAME_530 
0097: make 5@ absolute_float 
5@ *= 10.0 
if 
  5@ > 90.0 
else_jump @NONAME_474 
5@ = 90.0 

:NONAME_474
02F6: 8@ = sine 5@ // (float) 
8@ *= 255.0 
0092: 9@ = float 8@ to_integer 
0A8E: 11@ = 10@ + 6@ // int 
0A8C: write_memory 11@ size 2 value 9@ virtual_protect 0 
jump @NONAME_537 

:NONAME_530
gosub @NONAME_590 

:NONAME_537
jump @NONAME_551 

:NONAME_544
gosub @NONAME_590 

:NONAME_551
jump @NONAME_583 

:NONAME_558
if 
  2@ == 1 
else_jump @NONAME_583 
gosub @NONAME_590 

:NONAME_583
jump @NONAME_55 

:NONAME_590
wait 100 
2@ = 0 
03CD: disable_car 0@ stuck_check 
return

I mean, in a nutshell I changed the start key, the problem is the next, after taking the finger on the "S" it instead of continuing to go back with the same speed, the car catches the speed with the front, and continues to go with speed which I went last time on "S", I briefly want to go with the car in the back when I press "S".
an you help me make this cruise control go the car with your back?
Another question would be, how can I make cruise control for flying machines? example for helicopters or planes?

I know it can but I have no idea how.
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
Now it works 100% i tested it. Cleo 4.1 sampfuncs...
press x to enable it and keep the current speed.


PHP:
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY


WHILE TRUE
    WAIT 0
    IF and
    04AB:   actor $PLAYER_ACTOR driving_plane
    0AB0: 88 // Key_X
    THEN
        repeat
            wait 0
        until 8AB0: 88
        03C0: 1@ = actor $PLAYER_ACTOR car
        02E3: 2@ = car 1@ speed
        
        repeat
        wait 0
            if
            84AB:   actor $PLAYER_ACTOR driving_plane
            then
                break
            end
            
            02E3: 3@ = car 1@ speed
            printf "CurrentSpeed: %0.1f/%0.1f" 1000 3@ 2@
            if
            001D:   2@ > 3@  // (int)
            then
                0AB1: call @keyPress 2 key 87 time 100
            else
                0AB1: call @keyPress 2 key 83 time 100
            end
        until 0AB0: 88
        
        
        
        repeat
        wait 0
        until 8AB0: 88   
    END
END




:keyPress
// 0@ - key, 1@ - time
// Example: 0AB1: call @keyPress 2 key 0@ time 1@

if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
     then
         0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
         wait 1@
         0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
     end
end
0AB2: ret 0




:FAKE_KEYPRESS
1@ = 0xB73458
005A: 1@ += 0@  // (int)
0A8C: write_memory 1@ size 1 value 255 virtual_protect 0
0AB2: ret 0

{
Offset        Slot     
+ 0x0        Right                       
+ 0x1        Left                           
+ 0x2        Backwards                   
+ 0x3        Forward                       
+ 0x4        Look right                   
+ 0x5        Look left                   
+ 0x6        Look down                       
+ 0x7        Look up                           
+ 0x8        Action           
+ 0xA        Previous weapon/target               
+ 0xC        Aim weapon                   
+ 0xE        Next weapon/target               
+ 0x10        Group CTRL forward                   
+ 0x12        Group CTRL back                       
+ 0x14        Conversation - NO                   
+ 0x16        Conversation - YES                   
+ 0x1A        Change camera                   
+ 0x1C        Jump                           
+ 0x1E        Enter+exit                       
+ 0x20        Sprint                           
+ 0x22        Fire                           
+ 0x24        Crouch                           
+ 0x26        Look behind                       
+ 0x28        Unused                           
+ 0x2A        Walk                           
}
 

Attachments

  • AirControl.cs
    20.2 KB · Views: 4
Status
Not open for further replies.
Top