CLEO Help Force Deploy Parachute

CLEO related
Status
Not open for further replies.

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
I am trying to create a script that will deploy my actor's parachute when certain conditions are met. But It seems like there are no opcode's that can do it. I've been searching around Google for mods/snippets/memory pointers about deploying parachute but I can't find one.

Are there any snippets/memory pointers/documentaries that can allow an actor/ped to deploy his parachute? I will appreciate if somebody can help, Thanks.
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
294
Reaction score
99
Location
UGBASE
I don't know if there's another way but I can't really imagine.

One thing you could do is set your game key state of LMB (FIRE) to 255 (aka force left mouse button).

Patch 0xB73458 (controls) + 0x22 (FIRE-Button) = 255. That should do the trick to activate the parachute.
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
I don't know if there's another way but I can't really imagine.

One thing you could do is set your game key state of LMB (FIRE) to 255 (aka force left mouse button).

Patch 0xB73458 (controls) + 0x22 (FIRE-Button) = 255. That should do the trick to activate the parachute.
I did what you said, but It's not working bro:
Code:
{$CLEO}
0000:

while true
    wait 0
    if or
        0611:   actor $PLAYER_ACTOR performing_animation "FALL_skyDive"
        0611:   actor $PLAYER_ACTOR performing_animation "FALL_SkyDive_Accel"
        0611:   actor $PLAYER_ACTOR performing_animation "FALL_SkyDive_L"
        0611:   actor $PLAYER_ACTOR performing_animation "FALL_SkyDive_R"
    then
        0819: 0@ = actor $PLAYER_ACTOR distance_from_ground
        0AD1: show_formatted_text_highpriority "Ground Distance: %f" time 100 0@
        0A8C: write_memory 0xB7347A size 1 value 255 virtual_protect 0

        // commenting or uncommenting these lines still doesn't deploy parachute
        // wait 0
        // 0A8C: write_memory 0xB7347A size 1 value 0 virtual_protect 0
    end
end
I tried it also with sampfuncs opcode and still not working:
Code:
0B56: set_game_key 17 state 255 // fire weapon

Any other workarounds or methods?
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
294
Reaction score
99
Location
UGBASE
Size should be 4 bytes and not 1 byte IIRC.

And try to write that state without your performing_animation conditions. I remember when I tried to do some sketchy stuff with checking animations, it was never called even though I was performing the animation. As I said try the code with 4 bytes and without your if or conditions to check where the problem is at.
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Size should be 4 bytes and not 1 byte IIRC.

And try to write that state without your performing_animation conditions. I remember when I tried to do some sketchy stuff with checking animations, it was never called even though I was performing the animation. As I said try the code with 4 bytes and without your if or conditions to check where the problem is at.
Either of These three works well, the actor is firing the weapon:
Code:
0A8C: write_memory 0xB7347A size 1 value 255 virtual_protect 0 // it works
0A8C: write_memory 0xB7347A size 2 value 255 virtual_protect 0 // it works too
0A8C: write_memory 0xB7347A size 4 value 255 virtual_protect 0 // it works too
https://gtamods.com/wiki/Memory_Addresses_(SA)
http://gtamodding.ru/wiki/Адреса_Памяти_(SA)
Controls
0xB73458 – Start of controls block.

  • +0x20 = [word] Accelerate:
    • 0 = off
    • 255 = on
  • +0x22 = [word] Brake

But the issue is when my actor CJ is in "SKYDIVE" state, it seems that memory pointer 0xB7347A does not do anything to deploy the parachute:
Code:
{$CLEO}
0000:

while true
    wait 0
        0819: 0@ = actor $PLAYER_ACTOR distance_from_ground
        0AD1: show_formatted_text_highpriority "Ground Distance: %f" time 100 0@
        // 0A8C: write_memory 0xB7347A size 1 value 255 virtual_protect 0
        // 0A8C: write_memory 0xB7347A size 2 value 255 virtual_protect 0
        0A8C: write_memory 0xB7347A size 4 value 255 virtual_protect 0

        // commenting or uncommenting these lines still doesn't deploy parachute
        // wait 0
        // 0A8C: write_memory 0xB7347A size 1 value 0 virtual_protect 0
end
 
Last edited:

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
294
Reaction score
99
Location
UGBASE
Try to force / set state of CTRL. Can't remember if you can activate your parachute with that key but I think it was one of those keys.
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Try to force / set state of CTRL. Can't remember if you can activate your parachute with that key but I think it was one of those keys.
You mean virtually? Like setting the virtual key state?

Well my game key for "Fire Weapon" is both "LCTRL" and "LMB" so yes thoes are the virtual keys. But I have issues when doing virtual keyboard hook since the keypress works even when notepad is opened while gta sa is minimized:
Code:
0C72: set_virtual_key 0x43 down true // types letter C at notepad, lol...
0C72: set_virtual_key 0x1 down true // left clicks mouse at notepad, lol...
 
Last edited:

Parazitas

God
Joined
Jan 2, 2017
Messages
3,133
Solutions
5
Reaction score
885
Location
Lithuania
You mean virtually? Like setting the virtual key state?

Well my game key for "Fire Weapon" is both "LCTRL" and "LMB" so yes thoes are the virtual keys. But I have issues when doing virtual keyboard hook since the keypress works even when notepad is opened while gta sa is minimized:
Code:
0C72: set_virtual_key 0x43 down true // types letter C at notepad, lol...
0C72: set_virtual_key 0x1 down true // left clicks mouse at notepad, lol...
Use anti pause
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Use anti pause
I have SAMP Addon with anti-esc. But I don't know how that will help about the problem.

My actual situation was:
  1. There are multiple SAMP instances(3 Bots).
  2. The bots sometimes do Skydiving(they are independent to each other).
  3. That's why I am creating a script that will open the parachute of the BOT when it is skydiving.
    • Problem:
      • Opcode 0C72 Hooks the keyboard, So that means when a script triggers 0C72: set_virtual_key 0x43 down true . All GTA SAMP Instances will trigger the Fire button at the same time, and I don't want that.
      • Opcode 0B56 Does not deploy the parachute. This is a good opcode because the keypress will only happen inside the GTA SAMP of this script. But just can't help me with deploying the parachute.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,133
Solutions
5
Reaction score
885
Location
Lithuania
This also makes same?
PHP:
:Set_Game_Key
// 0AB1: @Set_Game_key 2 KeyOffSet 0x57 State 255
2@ = 0xB731A8
0@ *= 2
005A: 2@ += 0@  // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0

PHP:
:Set_Virtual_Key
{
    255 = true
    0 = false
    0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 state 255
}
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@  // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
This also makes same?
PHP:
:Set_Game_Key
// 0AB1: @Set_Game_key 2 KeyOffSet 0x57 State 255
2@ = 0xB731A8
0@ *= 2
005A: 2@ += 0@  // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0

PHP:
:Set_Virtual_Key
{
    255 = true
    0 = false
    0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 state 255
}
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@  // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0

I Don't know how to get the keyoffset of that snippet. What is the keyoffset of pressing key "A" and "Left CTRL" and "Left Mouse Button"?
Also:
Code:
0AB1: @Set_Game_key 2 KeyOffSet 0x57 State 255 // what key does this press? doesn't do anything inside the game
0AB1: @Set_Game_key 2 KeyOffSet 0x41 State 255 // was supposed to press key 'A'? doesn't do anything inside the game
0AB1: @Set_Game_key 2 KeyOffSet 0x01 State 255 // was supposed to press 'LMB'? doesn't do anything inside the game
And this might be what I was looking for But bro can you give me list of keyoffsets like Left CTRL or Left Mouse Button. The Kyeoffset is very confusing:
Code:
0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 time 800 // this works, and does not hook the keyboard, only affects the GTA SA of the script. presses key W???
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,133
Solutions
5
Reaction score
885
Location
Lithuania

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
Some key offsets can be different from this link, so you can use CE to get them (read below).

LCTRL and others.
Not sure about game key snippet , but with virtually key snippet it worked very well.
http://ugbase.eu/index.php?threads/snippet-set-virtual-or-game-key.19933/#post-129236

And this is how i get it.
http://ugbase.eu/index.php?threads/snippet-set-virtual-or-game-key.19933/#post-129241
Problem Solved using your Virtual Key Snippet, Thanks. But I was wondering what is the use of your Game Key State Snippet? And where do you apply it as an example? Just curious.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,133
Solutions
5
Reaction score
885
Location
Lithuania
Problem Solved using your Virtual Key Snippet, Thanks. But I was wondering what is the use of your Game Key State Snippet? And where do you apply it as an example? Just curious.

1. Idk, i just found pointers while i played with CE, i was curious how SF developers made opcodes.
But it seems like whey use c++ keys or something like that.

2. I planned use it to make vehicle recorder without SF, but i never understand how that damn angles worked to press keys xD
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Using this Reference, the Final result:
Code:
{$CLEO}
0000: Auto-Deploy Parachute by AJOM

while true
    wait 0
    if or
        0611:   actor $PLAYER_ACTOR performing_animation "FALL_skyDive"
        0611:   actor $PLAYER_ACTOR performing_animation "FALL_SkyDive_Accel"
        0611:   actor $PLAYER_ACTOR performing_animation "FALL_SkyDive_L"
        0611:   actor $PLAYER_ACTOR performing_animation "FALL_SkyDive_R"
    then
        0819: 0@ = actor $PLAYER_ACTOR distance_from_ground
        if 0@ <= 60.0
        then
            0A8C: write_memory 0xB734F2 size 1 value 255 virtual_protect 0 // 0xB734D0 + 0x22 = Pointer -> Force Fire Weapon | 255 = Press for 1 Frame then Release
            0ACD: show_text_highpriority "AJOM: Deploying Parachute!" time 2000
        end
    end
end
Case Closed!
 
Status
Not open for further replies.
Top