Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Happy Holidays from the GTANet team!

Help with cleo-based targeting system (not aimbot)


ElNepeDeMaeve
 Share

Recommended Posts

ElNepeDeMaeve

Hello everyone, I need your help with a problem that I have in the development of a mod. The case is the following: I am creating a weapon pack and for now everything works fine using the default weapon settings of the game (I have added new weapons with the help of the fastman92limitadjuster script) however I need to precisely control the rate of fire of the weapons (not with the game's animation-based system), as well as their sound (with the fastman92 script I can't customize or add new sounds) so I opted to do it using a cleo mod. So far I have created the following code: (it is worth mentioning that this is the first time I have used cleo for something, therefore I don't really know how this works) So far what the cleo mod does is fire a bullet from the position of the weapon up to 100 units in front of the character, reproducing the desired sound. So what is the problem? I can't create a targeting system that follows the game's sights. The bullet is only projected at a 90 ° position but cannot go up or down, nor is it aligned with the game's sight. So if anyone can help me get the bullet where it needs to go I would really appreciate it. This is the last detail that I am missing, and for me it is a bit frustrating not being able to publish the mod because of this.

 

{$CLEO .cs}

thread 'TESTMOD'

:TESTMOD_01
wait 0
if and
0256:   player $PLAYER_CHAR defined
044B:   actor $PLAYER_ACTOR on_foot
00E1:   player 0 pressed_key 6
00E1:   player 0 pressed_key 17 
004D: jump_if_false @TESTMOD_01
if
02D8:   actor $PLAYER_ACTOR current_weapon == 30
004D: jump_if_false @TESTMOD_31
0881: set_player $PLAYER_CHAR able_to_shoot_weapons 0
0002: jump @TESTMOD_11

:TESTMOD_11
wait 0
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 
Object.Create([email protected], #AK47, [email protected], [email protected], [email protected])
Object.CollisionDetection([email protected], False)
070A: AS_actor $PLAYER_ACTOR attach_to_object [email protected] offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1
[email protected] = AudioStream.Load("cleo_sound/shoot.wav")
0002: jump @TESTMOD_21

:TESTMOD_21
wait 0
0400: store_coords_to [email protected] [email protected] [email protected] from_object [email protected] with_offset 0.78 -0.06  0.13
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 100.0 0.0
06BC: create_M4_shoot_from [email protected] [email protected] [email protected] target [email protected] [email protected] [email protected] energy 1
AudioStream.PerformAction([email protected], PLAY)
wait 1000
0002: jump @TESTMOD_01

:TESTMOD_31
wait 0
Object.RemoveReferences([email protected])
Object.Destroy([email protected])
AudioStream.Release([email protected])

 

5i11Rd5.png

pZ8LvMj.png

Link to comment
Share on other sites

 

the target of crosshair is not the same as your target

coords of $PLAYER_ACTOR with_offset 0.0 100.0 0.0 is a little bit beside that

a little bit beside becomes by big distance very much beside

04C4: store_coords_to 7@ 8@ 9@ from_actor $PLAYER_ACTOR with_offset 0.0 100.0 0.0
06BC: create_M4_shoot_from 4@ 5@ 6@ target 7@ 8@ 9@ energy 1

 

you need to get the aim point
Wesser  found a way by 0AA6: call_method 0x514970 struct 0xB6F028

 

the code block where he embetted the script messed up because of forums software change

find it inside the spoiler below

Spoiler

 

{
 FUNCTIONS INCLUDED:

-   getAimPoint
     Type: GET
       Description: Get the point where player is looking/aiming at.

-   getLaserPoint
     Type: GET
       Description: Get laser point between 2 points.

-   getCollisionBetweenPoints
     Type: GET
       Description: Get the collision point coords between 2 points.

-   getLocalVarOffset
     Type: GET
       Description: Get local var offset from thread pointer.
}

{$CLEO}

0000: NOP

0A8C: write_memory 0xC1704C size 1 value 105 virtual_protect 0 // 60fps

// Disable crosshair
0A8C: write_memory 0x58FBBF size 4 value 0x90909090 virtual_protect 1
0A8C: write_memory 0x58FBC3 size 1 value 0x90 virtual_protect 1

while true
 wait 0
 0470: 0@ = actor $PLAYER_ACTOR current_weapon
 0@ *= 0x70
 0@ += 0xC8AAB8
 0@ += 0x8
 0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // weapon range
 00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
 0AB1: call_scm_func @getAimPoint 4 range 0@ from 1@ 2@ 3@ camera_to 4@ 5@ 6@ point_to 7@ 8@ 9@
 0AB1: call_scm_func @getLaserPoint 6 from 4@ 5@ 6@ to 7@ 8@ 9@ store_to 10@ 11@ 12@
 04D5: create_corona_at 10@ 11@ 12@ radius 0.05 type 0 flare 0 RGB 255 0 0
end

:getAimPoint
{
 Parameters:
   Passed:
     0@ - aiming range
     1@ - start point X
     2@ - start point Y
     3@ - start point Z
   Result:
     4@ - camera point X
     5@ - camera point Y
     6@ - camera point Z
     7@ - aim point X
     8@ - aim point Y
     9@ - aim point Z

 Example:
   0AB1: call_scm_func @getAimPoint 4 range 20.0 from 0.0 0.0 0.0 camera_to 1@ 2@ 3@ point_to 4@ 5@ 6@
}
0A9F: 12@ = current_thread_pointer
0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 4 store_to 10@
0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 7 store_to 11@
0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint 11@ pCamera 10@ fOriginZ 3@ fOriginY 2@ fOriginX 1@ fRange 0@ // CCamera__Find3rdPersonCamTargetVector
0AB2: ret 6 4@ 5@ 6@ 7@ 8@ 9@

:getLaserPoint
{
 Parameters:
   Passed:
     0@ - start point X
     1@ - start point Y
     2@ - start point Z
     3@ - end point X
     4@ - end point Y
     5@ - end point Z
   Result:
     6@ - middle point X
     7@ - middle point Y
     8@ - middle point Z

 Example:
   0AB1: call_scm_func @getLaserPoint 6 from 0.0 0.0 0.0 to 1.0 0.0 0.0 store_to 1@ 2@ 3@
}
0A96: 11@ = actor $PLAYER_ACTOR struct
0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0@ 1@ 2@ to 3@ 4@ 5@ solid 1 car 1 actor 1 object 1 particle 1 cartyre 1 water 0 ignore_entity 11@ see_through 0 camera_objects 0 shoot_through 0 store_to 6@ 7@ 8@ distance_to 9@ entity_to 10@
0AB2: ret 3 6@ 7@ 8@

:getCollisionBetweenPoints
{
 Parameters:
   Passed:
     0@ - start point X
     1@ - start point Y
     2@ - start point Z
     3@ - end point X
     4@ - end point Y
     5@ - end point Z
     6@ - is solid
     7@ - is car
     8@ - is actor
     9@ - is object
     10@ - is particle
     11@ - is car tyre
     12@ - is water
     13@ - entity to ignore (offset)
     14@ - no see-through stuff
     15@ - no camera objects
     16@ - no shoot-through stuff
   Result:
     17@ - collision point X
     18@ - collision point Y
     19@ - collision point Z
     20@ - distance
     21@ - entity

 Example:
   0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0.0 0.0 0.0 to 1.0 0.0 0.0 solid 0 car 1 actor 0 object 0 particle 0 cartyre 1 water 0 ignore_entity 0x0 see_through 0 camera_objects 0 shoot_through 0 store_to 1@ 2@ 3@ distance_to 4@ entity_to 5@
}
if
 13@ <> 0x0
then
 0A8C: write_memory 0xB7CD68 size 4 value 13@ virtual_protect 0
end
0A8C: write_memory 0xB7CD70 size 1 value 11@ virtual_protect 0
0A9F: 26@ = current_thread_pointer
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 0 store_to 22@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 3 store_to 23@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 17 store_to 24@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 21 store_to 25@
0AA7: call_function 0x56BA00 num_params 12 pop 12 bIgnoreShootThroughStuff 16@ bIgnoreSomeObjectsForCamera 15@ bIgnoreSeeThroughStuff 14@ bDummy 10@ bObject 9@ bActor 8@ bCar 7@ bBuilding 6@ pEntity 25@ pPoint 24@ pTarget 23@ pOrigin 22@ bReturn 31@ // CWorld__ProcessLineOfSight
if
 13@ <> 0x0
then
 0A8C: write_memory 0xB7CD68 size 4 value 0x0 virtual_protect 0
end
if
 31@ <> 0
then
 if and
   17@ <> 0.0
   18@ <> 0.0
   19@ <> 0.0
 then
   050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 17@ 18@ 19@
   if
     12@ == 1
   then
     0A9F: 26@ = current_thread_pointer
     0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 27 store_to 30@
     0AA7: call_function 0x6E61B0 num_params 7 pop 7 pPoint 30@ fTargetZ 5@ fTargetY 4@ fTargetX 3@ fOriginZ 2@ fOriginY 1@ fOriginX 0@ bResult 31@ // CWorld__TestLineAgainstWater
     if
       31@ <> 0  
     then
       0087: 17@ = 27@
       0087: 18@ = 28@
       0087: 19@ = 29@
       050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 27@ 28@ 29@
     end
   end
   0AB2: ret 5 17@ 18@ 19@ 20@ 21@
 end
end
0AB2: ret 5 3@ 4@ 5@ 0.0 0x0

:getLocalVarOffset
{
 Parameters:
   Passed:
     0@ - thread pointer
     1@ - var number
   Result:
     1@ - var value

 Example:
   0AB1: call_scm_func @getLocalVarOffset 2 thread 0@ var 0 store_to 1@
}
if
 0@ <> 0
then
 1@ *= 0x4
 0A8E: 2@ = 0@ + 0xDC // mission flag
 if
   2@ == 1
 then
   1@ += 0xA48960 // mission locals
 else
   005A: 1@ += 0@
   1@ += 0x3C
 end
else
 1@ = 0
end
0AB2: ret 1 1@ 

 

 

 

 

 

Edited by ZAZ
Link to comment
Share on other sites

ElNepeDeMaeve
On 12/17/2020 at 5:22 AM, ZAZ said:

 

the target of crosshair is not the same as your target

coords of $PLAYER_ACTOR with_offset 0.0 100.0 0.0 is a little bit beside that

a little bit beside becomes by big distance very much beside

04C4: store_coords_to 7@ 8@ 9@ from_actor $PLAYER_ACTOR with_offset 0.0 100.0 0.0
06BC: create_M4_shoot_from 4@ 5@ 6@ target 7@ 8@ 9@ energy 1

 

you need to get the aim point
Wesser  found a way by 0AA6: call_method 0x514970 struct 0xB6F028

 

the code block where he embetted the script messed up because of forums software change

find it inside the spoiler below

  Reveal hidden contents

 


{
 FUNCTIONS INCLUDED:

-   getAimPoint
     Type: GET
       Description: Get the point where player is looking/aiming at.

-   getLaserPoint
     Type: GET
       Description: Get laser point between 2 points.

-   getCollisionBetweenPoints
     Type: GET
       Description: Get the collision point coords between 2 points.

-   getLocalVarOffset
     Type: GET
       Description: Get local var offset from thread pointer.
}

{$CLEO}

0000: NOP

0A8C: write_memory 0xC1704C size 1 value 105 virtual_protect 0 // 60fps

// Disable crosshair
0A8C: write_memory 0x58FBBF size 4 value 0x90909090 virtual_protect 1
0A8C: write_memory 0x58FBC3 size 1 value 0x90 virtual_protect 1

while true
 wait 0
 0470: 0@ = actor $PLAYER_ACTOR current_weapon
 0@ *= 0x70
 0@ += 0xC8AAB8
 0@ += 0x8
 0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // weapon range
 00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
 0AB1: call_scm_func @getAimPoint 4 range 0@ from 1@ 2@ 3@ camera_to 4@ 5@ 6@ point_to 7@ 8@ 9@
 0AB1: call_scm_func @getLaserPoint 6 from 4@ 5@ 6@ to 7@ 8@ 9@ store_to 10@ 11@ 12@
 04D5: create_corona_at 10@ 11@ 12@ radius 0.05 type 0 flare 0 RGB 255 0 0
end

:getAimPoint
{
 Parameters:
   Passed:
     0@ - aiming range
     1@ - start point X
     2@ - start point Y
     3@ - start point Z
   Result:
     4@ - camera point X
     5@ - camera point Y
     6@ - camera point Z
     7@ - aim point X
     8@ - aim point Y
     9@ - aim point Z

 Example:
   0AB1: call_scm_func @getAimPoint 4 range 20.0 from 0.0 0.0 0.0 camera_to 1@ 2@ 3@ point_to 4@ 5@ 6@
}
0A9F: 12@ = current_thread_pointer
0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 4 store_to 10@
0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 7 store_to 11@
0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint 11@ pCamera 10@ fOriginZ 3@ fOriginY 2@ fOriginX 1@ fRange 0@ // CCamera__Find3rdPersonCamTargetVector
0AB2: ret 6 4@ 5@ 6@ 7@ 8@ 9@

:getLaserPoint
{
 Parameters:
   Passed:
     0@ - start point X
     1@ - start point Y
     2@ - start point Z
     3@ - end point X
     4@ - end point Y
     5@ - end point Z
   Result:
     6@ - middle point X
     7@ - middle point Y
     8@ - middle point Z

 Example:
   0AB1: call_scm_func @getLaserPoint 6 from 0.0 0.0 0.0 to 1.0 0.0 0.0 store_to 1@ 2@ 3@
}
0A96: 11@ = actor $PLAYER_ACTOR struct
0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0@ 1@ 2@ to 3@ 4@ 5@ solid 1 car 1 actor 1 object 1 particle 1 cartyre 1 water 0 ignore_entity 11@ see_through 0 camera_objects 0 shoot_through 0 store_to 6@ 7@ 8@ distance_to 9@ entity_to 10@
0AB2: ret 3 6@ 7@ 8@

:getCollisionBetweenPoints
{
 Parameters:
   Passed:
     0@ - start point X
     1@ - start point Y
     2@ - start point Z
     3@ - end point X
     4@ - end point Y
     5@ - end point Z
     6@ - is solid
     7@ - is car
     8@ - is actor
     9@ - is object
     10@ - is particle
     11@ - is car tyre
     12@ - is water
     13@ - entity to ignore (offset)
     14@ - no see-through stuff
     15@ - no camera objects
     16@ - no shoot-through stuff
   Result:
     17@ - collision point X
     18@ - collision point Y
     19@ - collision point Z
     20@ - distance
     21@ - entity

 Example:
   0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0.0 0.0 0.0 to 1.0 0.0 0.0 solid 0 car 1 actor 0 object 0 particle 0 cartyre 1 water 0 ignore_entity 0x0 see_through 0 camera_objects 0 shoot_through 0 store_to 1@ 2@ 3@ distance_to 4@ entity_to 5@
}
if
 13@ <> 0x0
then
 0A8C: write_memory 0xB7CD68 size 4 value 13@ virtual_protect 0
end
0A8C: write_memory 0xB7CD70 size 1 value 11@ virtual_protect 0
0A9F: 26@ = current_thread_pointer
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 0 store_to 22@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 3 store_to 23@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 17 store_to 24@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 21 store_to 25@
0AA7: call_function 0x56BA00 num_params 12 pop 12 bIgnoreShootThroughStuff 16@ bIgnoreSomeObjectsForCamera 15@ bIgnoreSeeThroughStuff 14@ bDummy 10@ bObject 9@ bActor 8@ bCar 7@ bBuilding 6@ pEntity 25@ pPoint 24@ pTarget 23@ pOrigin 22@ bReturn 31@ // CWorld__ProcessLineOfSight
if
 13@ <> 0x0
then
 0A8C: write_memory 0xB7CD68 size 4 value 0x0 virtual_protect 0
end
if
 31@ <> 0
then
 if and
   17@ <> 0.0
   18@ <> 0.0
   19@ <> 0.0
 then
   050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 17@ 18@ 19@
   if
     12@ == 1
   then
     0A9F: 26@ = current_thread_pointer
     0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 27 store_to 30@
     0AA7: call_function 0x6E61B0 num_params 7 pop 7 pPoint 30@ fTargetZ 5@ fTargetY 4@ fTargetX 3@ fOriginZ 2@ fOriginY 1@ fOriginX 0@ bResult 31@ // CWorld__TestLineAgainstWater
     if
       31@ <> 0  
     then
       0087: 17@ = 27@
       0087: 18@ = 28@
       0087: 19@ = 29@
       050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 27@ 28@ 29@
     end
   end
   0AB2: ret 5 17@ 18@ 19@ 20@ 21@
 end
end
0AB2: ret 5 3@ 4@ 5@ 0.0 0x0

:getLocalVarOffset
{
 Parameters:
   Passed:
     0@ - thread pointer
     1@ - var number
   Result:
     1@ - var value

 Example:
   0AB1: call_scm_func @getLocalVarOffset 2 thread 0@ var 0 store_to 1@
}
if
 0@ <> 0
then
 1@ *= 0x4
 0A8E: 2@ = 0@ + 0xDC // mission flag
 if
   2@ == 1
 then
   1@ += 0xA48960 // mission locals
 else
   005A: 1@ += 0@
   1@ += 0x3C
 end
else
 1@ = 0
end
0AB2: ret 1 1@ 

 

 

 

 

 

I really appreciate your help, however, I still have not managed to solve the problem. With the code you provided me, I have made progress, but the problem I have now is that when I fire the bullet it goes from the point of aim towards the weapon, in other words, it does the opposite trajectory. Is there something that I am overlooking?

 

{$CLEO .cs}

thread 'TESTMOD'

:TESTMOD_01
wait 0
if and
0256:   player $PLAYER_CHAR defined
044B:   actor $PLAYER_ACTOR on_foot
00E1:   player 0 pressed_key 6
00E1:   player 0 pressed_key 17 
004D: jump_if_false @TESTMOD_01
if
02D8:   actor $PLAYER_ACTOR current_weapon == 30
004D: jump_if_false @TESTMOD_31
0881: set_player $PLAYER_CHAR able_to_shoot_weapons 0
0002: jump @TESTMOD_11

:TESTMOD_11
wait 0
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 
Object.Create([email protected], #AK47, [email protected], [email protected], [email protected])
Object.CollisionDetection([email protected], False)
070A: AS_actor $PLAYER_ACTOR attach_to_object [email protected] offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1
0002: jump @TESTMOD_21

:TESTMOD_21
wait 0
0400: store_coords_to [email protected] [email protected] [email protected] from_object [email protected] with_offset 0.78 -0.06  0.13
//04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 1.0 0.0 0.0
0470: [email protected] = actor $PLAYER_ACTOR current_weapon
 [email protected] *= 0x70
 [email protected] += 0xC8AAB8
 [email protected] += 0x8
 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // weapon range
 00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]
 0AB1: call_scm_func @TESTMOD_41 4 range [email protected] from [email protected] [email protected] [email protected] camera_to [email protected] [email protected] [email protected] point_to [email protected] [email protected] [email protected]
06BC: create_M4_shoot_from [email protected] [email protected] [email protected] target [email protected] [email protected] [email protected] energy 1
0002: jump @TESTMOD_01

:TESTMOD_41
0A9F: [email protected] = current_thread_pointer
0AB1: call_scm_func @TESTMOD_51 2 thread [email protected] var 4 store_to [email protected]
0AB1: call_scm_func @TESTMOD_51 2 thread [email protected] var 7 store_to [email protected]
0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint [email protected] pCamera [email protected] fOriginZ [email protected] fOriginY [email protected] fOriginX [email protected] fRange [email protected] // CCamera__Find3rdPersonCamTargetVector
0AB2: return 6 [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]

:TESTMOD_51
if
 [email protected] <> 0
then
 [email protected] *= 0x4
 0A8E: [email protected] = [email protected] + 0xDC // mission flag
 if
   [email protected] == 1
 then
   [email protected] += 0xA48960 // mission locals
 else
   005A: [email protected] += [email protected]
   [email protected] += 0x3C
 end
else
 [email protected] = 0
end
0AB2: ret 1 [email protected]

:TESTMOD_31
wait 0
//Object.RemoveReferences([email protected])
//Object.Destroy([email protected])
//AudioStream.Release([email protected])

 

VuoZe54.png

Link to comment
Share on other sites

 



{$CLEO}
thread 'Fn514970'

//Press backspace to show a light beam, fixed for 2 seconds
//it have the aimpoint as target
//turn mouse camera immediately after keypress to see the beam from side

while true
    wait 0
    if 
        0256:   player $PLAYER_CHAR defined
    then
        if and
            0AB0:   key_pressed 8//----------------------------key = Backspace
            044B:   actor $PLAYER_ACTOR on_foot
            84AD:  not actor $PLAYER_ACTOR in_water
        then            
            0470: 0@ = actor $PLAYER_ACTOR current_weapon
            0@ *= 0x70
            0@ += 0xC8AAB8
            0@ += 0x8
            0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // weapon range
            00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
            0AB1: call_scm_func @getAimPoint 4 range 0@ from 1@ 2@ 3@ camera_to 4@ 5@ 6@ point_to 7@ 8@ 9@
            0AB1: call_scm_func @getLaserPoint 6 from 4@ 5@ 6@ to 7@ 8@ 9@ store_to 10@ 11@ 12@
            06B1: 31@ = create_searchlight_at 4@ 5@ 6@ radius 0.1 target 10@ 11@ 12@ radius 0.2 
            wait 2000                        
            06B2: destroy_searchlight 31@
        end
    end
end



:getAimPoint
0A9F: 12@ = current_thread_pointer
0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 4 store_to 10@
0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 7 store_to 11@
0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint 11@ pCamera 10@ fOriginZ 3@ fOriginY 2@ fOriginX 1@ fRange 0@ // CCamera__Find3rdPersonCamTargetVector
0AB2: ret 6 4@ 5@ 6@ 7@ 8@ 9@

:getLaserPoint
0A96: 11@ = actor $PLAYER_ACTOR struct
0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0@ 1@ 2@ to 3@ 4@ 5@ solid 1 car 1 actor 1 object 1 particle 1 cartyre 1 water 0 ignore_entity 11@ see_through 0 camera_objects 0 shoot_through 0 store_to 6@ 7@ 8@ distance_to 9@ entity_to 10@
0AB2: ret 3 6@ 7@ 8@

:getCollisionBetweenPoints
if
 13@ <> 0x0
then
 0A8C: write_memory 0xB7CD68 size 4 value 13@ virtual_protect 0
end
0A8C: write_memory 0xB7CD70 size 1 value 11@ virtual_protect 0
0A9F: 26@ = current_thread_pointer
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 0 store_to 22@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 3 store_to 23@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 17 store_to 24@
0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 21 store_to 25@
0AA7: call_function 0x56BA00 num_params 12 pop 12 bIgnoreShootThroughStuff 16@ bIgnoreSomeObjectsForCamera 15@ bIgnoreSeeThroughStuff 14@ bDummy 10@ bObject 9@ bActor 8@ bCar 7@ bBuilding 6@ pEntity 25@ pPoint 24@ pTarget 23@ pOrigin 22@ bReturn 31@ // CWorld__ProcessLineOfSight
if
 13@ <> 0x0
then
 0A8C: write_memory 0xB7CD68 size 4 value 0x0 virtual_protect 0
end
if
 31@ <> 0
then
 if and
   17@ <> 0.0
   18@ <> 0.0
   19@ <> 0.0
 then
   050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 17@ 18@ 19@
   if
     12@ == 1
   then
     0A9F: 26@ = current_thread_pointer
     0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 27 store_to 30@
     0AA7: call_function 0x6E61B0 num_params 7 pop 7 pPoint 30@ fTargetZ 5@ fTargetY 4@ fTargetX 3@ fOriginZ 2@ fOriginY 1@ fOriginX 0@ bResult 31@ // CWorld__TestLineAgainstWater
     if
       31@ <> 0  
     then
       0087: 17@ = 27@
       0087: 18@ = 28@
       0087: 19@ = 29@
       050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 27@ 28@ 29@
     end
   end
   0AB2: ret 5 17@ 18@ 19@ 20@ 21@
 end
end
0AB2: ret 5 3@ 4@ 5@ 0.0 0x0

:getLocalVarOffset
if
 0@ <> 0
then
 1@ *= 0x4
 0A8E: 2@ = 0@ + 0xDC // mission flag
 if
   2@ == 1
 then
   1@ += 0xA48960 // mission locals
 else
   005A: 1@ += 0@
   1@ += 0x3C
 end
else
 1@ = 0
end
0AB2: ret 1 1@ 

 

 

 

BTW. you should give more power to the M4_shoot, up to 100

06BC: create_M4_shoot_from 4@ 5@ 6@ target 7@ 8@ 9@ energy 100

 

 

 

 

Edited by ZAZ
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.