Sniper Rifle - get aim point - Noob's code?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{$CLEO}
0662: "by legend2360"
0662: "BlastHack - cheating is art"
wait 0
while not SAMP.Available()
wait 400
end
alloc 8@ 44
while true
wait 0
if and
02D8: actor $PLAYER_ACTOR current_weapon == 34
00E1: player 0 pressed_key 6
then
while true
wait 0
if and
02D8: actor $PLAYER_ACTOR current_weapon == 34
00E1: player 0 pressed_key 6
jf break
0B60: convert_game_screen_coords 320.0 224.0 to_window_screen_coords 0@ 1@
0B8F: convert_screen_coords 0@ 1@ depth 700.0 to_world_3d 2@ 3@ 4@
Actor.StorePos($PLAYER_ACTOR, 5@, 6@, 7@)
if call @ProcessLineOfSight 15 vecStart 5@ 6@ 7@ vecEnd 2@ 3@ 4@ colPoint 8@ check building 0 vehicles 0 peds 1 objects 0 dummies 0 through_stuff 0 ignore_object 0 shoot_throught 0 retr target_entity 9@
then
0C0E: 2@ = array 8@ element 0
0C0E: 3@ = array 8@ element 1
0C0E: 4@ = array 8@ element 2
// FOR ALL PEDS
0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0
000A: 29@ += 0x4
0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
for 30@ = 0 to 35584 step 0x100
0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
000A: 29@ += 0x1
if and
0029: 31@ >= 0x00
001B: 0x80 > 31@
then
005A: 31@ += 30@
if and
056D: actor 31@ defined
803C: $PLAYER_ACTOR <> 31@
00FE: actor 31@ sphere 1 in_sphere 2@ 3@ 4@ radius 2.0 2.0 2.0
then
if 10@ = SAMP.GetSAMPPlayerIDByActorHandle(31@)
then
10@ = SAMP.GetPlayerNickname(10@)
chat "%s" -1 10@
break
end
end
end
end
// FOR ALL PEDS END
end
end
end
if key 123
then
print "~R~RELOAD" 1500
run "test_camera(sniper_rifle).cs"
ect
end
end
:ProcessLineOfSight
// 0@, 1@, 2@ - vecStart; 3@, 4@, 5@ - vecEnd; 6@ - collision point;
// check: 7@ - buildings; 8@ - vehicles; 9@ - peds; 10@ - objects; 11@ - dummies;
// 12@ - see through stuff; 13@ - ignore some objects for cam; 14@ - shoot through stuff;
// return value - target entity.
// example:
//
15@ = 0
0AC7: 16@ = var 15@ offset
0AA7: call_function 0x56BA00 num_params 12 pop 12 params 14@ 13@ 12@ 11@ 10@ 9@ 8@ 7@ 16@ 6@ 3@v 0@v RESULT 17@
if and
17@ <> 0
15@ <> 0
then 0485: return_true
else 059A: return_false
end
ret 1 15@