CLEO HELP nearest players

davidel

Well-Known Member
Joined
Jan 17, 2020
Messages
93
Likes
2
Points
8
Location
Germania
5
#1
Code:
{$CLEO}

0000:


alloc [email protected] 200


REPEAT

WAIT 0

UNTIL 0AFA:



0B34: samp register_client_command "killc" to_label @cmd_mycmd



  [email protected] == TRUE

WHILE TRUE

WAIT 0

IF

056D: actor $PLAYER_ACTOR defined

0B61: samp is_local_player_spawned


CALL @GetClosestPed 0 [email protected]

IF 056D: actor [email protected] defined

THEN

wait 1000

say "/re"

END

END



:GetClosestPed

var

[email protected] : float

[email protected] : float

end

[email protected] = 10.0

[email protected] = -1


00A0: $PLAYER_ACTOR [email protected] [email protected] [email protected]


0A8D: [email protected] = read_memory 0xB74490 size 4 virtual_protect 0

000A: [email protected] += 0x4

0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0

for [email protected] = 0 to 35584 step 0x100

0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

000A: [email protected] += 0x1

if and

0029: [email protected] >= 0x00

001B: 0x80 > [email protected]

then

005A: [email protected] += [email protected]


if 003B: [email protected] == $PLAYER_ACTOR

then continue

end


00A0: [email protected] [email protected] [email protected] [email protected]

0509: [email protected] = distance_between_XY [email protected] [email protected] [email protected] [email protected]


if [email protected] < [email protected]

then

0087: [email protected] = [email protected]

0085: [email protected] = [email protected]

end

end

end


0AB2: ret 1 [email protected]


:cmd_mycmd

004E: end_thread

SAMP.CmdRet()
I have one problem with this. The problem is the cleo detect even the NPC as a player. Can someone please make this to detect only real players? please
 

kazkaS

Well-Known Member
Joined
Mar 30, 2018
Messages
165
Likes
18
Points
33
Location
Lithuania
#2
Code:
{$CLEO .cs}
0000: NOP
REPEAT
Wait 0
Until 0AFA: is_samp_structures_available

While True
Wait 0
if
056D: actor $PLAYER_ACTOR defined
then    
call @DISTANCE 1 distance_limit 6.0 _returnedActor [email protected]
if
056D: actor [email protected] defined
then
// do stuff
end
end
END

:DISTANCE
var
[email protected] : float
[email protected] : float
end
[email protected] = -1

00A0: $PLAYER_ACTOR [email protected] [email protected] [email protected]
0A8D: [email protected] = read_memory 0xB74490 size 4 virtual_protect 0
000A: [email protected] += 0x4
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
for [email protected] = 0 to 35584 step 0x100
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
000A: [email protected] += 0x1
if and
0029: [email protected] >= 0x00
001B: 0x80 > [email protected]
then
005A: [email protected] += [email protected]     
if 003B: [email protected] == $PLAYER_ACTOR
then continue
end     
00A0: [email protected] [email protected] [email protected] [email protected]
0509: [email protected] = distance_between_XY [email protected] [email protected] [email protected] [email protected]
if [email protected] < [email protected]
then
0087: [email protected] = [email protected]
0085: [email protected] = [email protected]
end
end
end
0AB2: ret 1 [email protected]
 

ajom

Well-Known Member
Joined
Apr 14, 2020
Messages
71
Likes
36
Points
18
Location
Pluto
#3
Code:
{$CLEO}

0000:


alloc [email protected] 200


REPEAT

WAIT 0

UNTIL 0AFA:



0B34: samp register_client_command "killc" to_label @cmd_mycmd



  [email protected] == TRUE

WHILE TRUE

WAIT 0

IF

056D: actor $PLAYER_ACTOR defined

0B61: samp is_local_player_spawned


CALL @GetClosestPed 0 [email protected]

IF 056D: actor [email protected] defined

THEN

wait 1000

say "/re"

END

END



:GetClosestPed

var

[email protected] : float

[email protected] : float

end

[email protected] = 10.0

[email protected] = -1


00A0: $PLAYER_ACTOR [email protected] [email protected] [email protected]


0A8D: [email protected] = read_memory 0xB74490 size 4 virtual_protect 0

000A: [email protected] += 0x4

0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0

for [email protected] = 0 to 35584 step 0x100

0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0

000A: [email protected] += 0x1

if and

0029: [email protected] >= 0x00

001B: 0x80 > [email protected]

then

005A: [email protected] += [email protected]


if 003B: [email protected] == $PLAYER_ACTOR

then continue

end


00A0: [email protected] [email protected] [email protected] [email protected]

0509: [email protected] = distance_between_XY [email protected] [email protected] [email protected] [email protected]


if [email protected] < [email protected]

then

0087: [email protected] = [email protected]

0085: [email protected] = [email protected]

end

end

end


0AB2: ret 1 [email protected]


:cmd_mycmd

004E: end_thread

SAMP.CmdRet()
I have one problem with this. The problem is the cleo detect even the NPC as a player. Can someone please make this to detect only real players? please
I assume you have SAMPFUNCS, You can detect NPC and reject it on the ped search by adding this "conditional opcode" on your script:
Code:
0B64: samp is_player [email protected] npc
8B64: not samp is_player [email protected] npc
 

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,143
Likes
385
Points
113
Location
Lithuania
Website
ugbase.eu
20
#4
hmmmmmm
PHP:
{$CLEO .cs}

0000: NOP

repeat
wait 0
until 0AFA: 

while true
wait 0
    if
    056D: actor $PLAYER_ACTOR defined
    then    
        0AB1: @DISTANCE 1 distance_limit 6.0 _returnedActor [email protected]
        if and
        056D: actor [email protected] defined
        8B64: samp not_player [email protected] npc
        then
            // do stuff
        end
    end
end

:DISTANCE
var
[email protected] : float
[email protected] : float
end
[email protected] = -1

00A0: $PLAYER_ACTOR [email protected] [email protected] [email protected]
0A8D: [email protected] = read_memory 0xB74490 size 4 virtual_protect 0
000A: [email protected] += 0x4
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
for [email protected] = 0 to 35584 step 0x100
    0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
    000A: [email protected] += 0x1
    if and
    0029: [email protected] >= 0x00
    001B: 0x80 > [email protected]
    then
        005A: [email protected] += [email protected]     
        if 003B: [email protected] == $PLAYER_ACTOR
        then continue
        end     
        00A0: [email protected] [email protected] [email protected] [email protected]
        0509: [email protected] = distance_between_XY [email protected] [email protected] [email protected] [email protected]
        if [email protected] < [email protected]
        then
            0087: [email protected] = [email protected]
            0085: [email protected] = [email protected]
        end
    end
end
0AB2: ret 1 [email protected]
 
Top