Coding

 Reply to this postStart new topic

Is the Player Aiming at a Ped?

chamber
post Jan 30 2013, 09:13 PM
Post #1


The New Guy!

Posts: 2
Joined: 29-January 13



Is there a better way to check if the player is aiming at a ped (and if so, get their handle) than just looping

02DD: 88@ = get_random_ped_in_zone
if
0457: player $PLAYER_CHAR aiming_at_actor

until it gets a hit?
Go to the top of the page
 
+Quote Post
badboy
post Jan 30 2013, 09:52 PM
Post #2


Trained Member

Posts: 76
From: Nederland, NL
Joined: 1-May 12



There's probably some address that stores that info, which someone else knows. But in the mean time you could try to get the ped that damaged the player. Because peds tend to shoot the player when they're aiming at him.
CODE
0A8E: 0@ = 0xB6F5F0 + 0x764


EDIT: misunderstood the question

This post has been edited by badboy: Jan 31 2013, 04:11 PM
Go to the top of the page
 
+Quote Post
Deji
post Jan 30 2013, 10:41 PM
Post #3


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



QUOTE (chamber @ Jan 30 2013, 09:13 PM) *
Is there a better way to check if the player is aiming at a ped (and if so, get their handle) than just looping

02DD: 88@ = get_random_ped_in_zone
if
0457: player $PLAYER_CHAR aiming_at_actor

until it gets a hit?


IF
    0457:   player $PLAYER_CHAR aiming_at_actor
THEN
    // CPlayerPed.pTargetChar
    0@ += 0x79C

    // Get CPed*
    0A8D: read_memory 0@ size 4 vp 0 store_to 0@

    // call the method CPool<CPed>::HandleOf()
    0AA8: call_method_return {CPed} 0x4442D0 struct {CPool<CPed>} 0xB74490 num_params 1 pop 0 params 0@ store_to 0@
END


--------------------
Go to the top of the page
 
+Quote Post
LINK/2012
post Jan 31 2013, 12:09 AM
Post #4


I will kill you

Posts: 126
Joined: 13-May 11



What's the point to use [0AA8: CPool<CPed>::HandleOf] there? why not 0AEA?
Go to the top of the page
 
+Quote Post
Deji
post Jan 31 2013, 12:40 AM
Post #5


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Well, what's the point of not using 0AD2? I assumed chamber wanted a solution independant of CLEO 4.


--------------------
Go to the top of the page
 
+Quote Post
LINK/2012
post Jan 31 2013, 12:51 AM
Post #6


I will kill you

Posts: 126
Joined: 13-May 11



Hm well, thought 0AEA was a CLEO2 opcode because the contrary opcode is
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: