CLEO Help draw a line in players aiming direction

CLEO related
Status
Not open for further replies.

downloadstuff

Active member
Joined
Apr 4, 2015
Messages
82
Reaction score
0
Alright so i want to draw a line from all the actors streamed aiming direction

i know its possible and someone from the cheating server (idk if it was opcode or an impersonator) told me the steps i would need:

1-get the camera pos
2-get the target pos
3-increase the target pos distance by 100
4-and draw a line


for step one i'd use this:
Code:
0BBE: samp store_player 0@ aim_data 1@
0AC8: 1@ = 31
0C0C: 2@ = struct 1@ offset 13 size 4
0C0C: 3@ = struct 1@ offset 17 size 4
0C0C: 4@ = struct 1@ offset 21 size 4
0AC9: 1@

//2@ 3@ 4@ = cam pos


for step 2 and 3:
(obviously i need to make a for cycle to check all the streamed people etc... )
Code:
04C4: store_coords_to 6@ 7@ 8@ from_actor @9 with_offset 0.0 100.0 0.0
//9@ is the target actor


and for step 4:
Code:
 0B68: render draw_line_point1 2@ 3@ point2 7@ 8@ width 1 color 4@

please experts... help me :) i was unable to do what i want.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
hi, at 3rd point you could use something like https://ugbase.eu/snippets/get3dxyzinfrontof/
Also if you're going to use 0BBE: samp store_player 0@ aim_data 1@ then i'm afraid that you'll have to deal with conversion of the angles which is actually the biggest issue here I think. The snippet above takes 2 axis degrees, the stucture you're going to use is giving you 3 axis radians or some other shits (i'm not sure what exactly, I remember that i used to play with aim data and it returned values ranging from -0.20 to 0.20 or 0.19? idk). Btw there's no need to get camera position, just the desired player.

I never used 0B68 but if it takes screen coordinates then you should do something like:
-loop the snippet above while checking for obstacles and increasing the distance to know where actually is the aiming target
-get desired players' hand position
-convert 3d coordinates (target pos, hand pos) into 2d screen coords https://ugbase.eu/snippets/convert-3d-position-to-2d-screencords/
 

downloadstuff

Active member
Joined
Apr 4, 2015
Messages
82
Reaction score
0
monday link said:
hi, at 3rd point you could use something like https://ugbase.eu/snippets/get3dxyzinfrontof/
Also if you're going to use 0BBE: samp store_player 0@ aim_data 1@ then i'm afraid that you'll have to deal with conversion of the angles which is actually the biggest issue here I think. The snippet above takes 2 axis degrees, the stucture you're going to use is giving you 3 axis radians or some other shits (i'm not sure what exactly, I remember that i used to play with aim data and it returned values ranging from -0.20 to 0.20 or 0.19? idk). Btw there's no need to get camera position, just the desired player.

I never used 0B68 but if it takes screen coordinates then you should do something like:
-loop the snippet above while checking for obstacles and increasing the distance to know where actually is the aiming target
-get desired players' hand position
-convert 3d coordinates (target pos, hand pos) into 2d screen coords https://ugbase.eu/snippets/convert-3d-position-to-2d-screencords/

eehm seems more complicated then i thought

would i be able to use this function instead ?

https://ugbase.eu/snippets/get-aiming-position/


then instead of using the player actor , using the actual actor?

and then instead of the explosions like in the video, i'd draw a line from the actor to his aiming position?


if you could help me i'd appreciate. it seems much more complicated then i expected :c :sadpepe:
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
that snippet is using some internal gta function and I doubt that there's also other functions to check other players
 

downloadstuff

Active member
Joined
Apr 4, 2015
Messages
82
Reaction score
0
monday link said:
that snippet is using some internal gta function and I doubt that there's also other functions to check other players

ill try to use this one instead and adapt it to the target actors
https://ugbase.eu/snippets/create_cords_around_player_in_looking_direction-w-offset/


edit: im failing to edit it properly trying to replace the player actor by the actor with ID x for testing purposes but its not working.
 

downloadstuff

Active member
Joined
Apr 4, 2015
Messages
82
Reaction score
0
monday link said:
it's based on camera position, no use of it for other players

i will make use of it. There is a hack i only want to trigger when i detect someone is aiming on a position near mine. and the lines are just there to allow me to predict when the hack is going to be triggered... the reason behind doesnt really matter.

If you could help me drawing a line in the camera position of an actor i'd appreciate :\
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
I made a mod like that some months ago.. and i have to say: it sucks.
If you want to check if another player is aiming at you:
Get Angle of Target Player
Get Angle between you and Target player
TargetPlayerAngle -= AngleBetweenYouandPlayer
if or
TargetPlayerAngle > 30.0
TargetPlayerAngle < 30.0
then
player is looking in your direction
end
 

downloadstuff

Active member
Joined
Apr 4, 2015
Messages
82
Reaction score
0
Opcode.eXe link said:
I made a mod like that some months ago.. and i have to say: it sucks.
If you want to check if another player is aiming at you:
Get Angle of Target Player
Get Angle between you and Target player
TargetPlayerAngle -= AngleBetweenYouandPlayer
if or
TargetPlayerAngle > 30.0
TargetPlayerAngle < 30.0
then
player is looking in your direction
end

how would i get the angle of his camera position to make this comparison? Im not really into maths but i understand your point, and it doesnt need to be accurate but thats exactly what i want.

if distances are bigger i could just decrease the angle range on bigger distances.. but accuracy doesnt really matter. If you could help me to make this code i'd appreciate a lot <3
 
Status
Not open for further replies.
Top