CLEO Help vest cleo

CLEO related
Status
Not open for further replies.

darknessmustopia

New member
Joined
May 14, 2020
Messages
3
Reaction score
0
Location
Argentina
Hello guys, i have this cleo and i would like to know if it can be edited to vest a certain group of people with the same name so instead of getting every nearby id i want this to only get the id's of the guys with the same name

Code:
{$CLEO}
0000: NOP

:Start
wait 100
SAMP.Available
else_jump @Start
0AF8: samp add_message_to_chat "{FFFFFF}Guardnear  -  {0085ff}[Credit: Robinson]"

:getini
0AF0: 10@ = get_int_from_ini_file "cleo\Robinson's Bindings.ini" section "GUARD" key "Key1"
0AF0: 11@ = get_int_from_ini_file "cleo\Robinson's Bindings.ini" section "GUARD" key "Key2"

:MAIN
wait 0
if and 
0AB0:  key_pressed 10@
0AB0:  key_pressed 11@
jf @MAIN
if
0AB1: call @get_id_nearest_player 0 retr_to fdist 0@ sid 1@
jf @MAIN
0AF9: "/guard %d 200" 1@
wait 1000
jump @MAIN

:get_id_nearest_player
// FOR ALL PEDS
3@ = 100.0 // Max. distance
4@ = 0xFFFFFF // Nearest player handle / id

0A8D: 0@ = read_memory 0xB74490 size 4 virtual_protect 0
0@ += 4
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
for 1@ = 0 to 35584 step 0x100
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    0@++
    if and
        2@ >= 0x00
        2@ < 0x80
    then
        005A: 2@ += 1@
        if or
            003C: $PLAYER_ACTOR == 2@ // LOCAL_PLAYER == REMOTE_PLAYER
            856D: NOT actor 2@ defined // REMOTE PLAYER IS NOT DEFINED
        then continue
        end
    
        0AB1: call @distanceBetweenActor 1 remote_player_handle 2@ retr_dist_to 5@
        if 0025: 3@ > 5@ // Max. dist > cur.
        then
            0087: 3@ = 5@ // Max. dist = cur.
            0085: 4@ = 2@ // Save remote player handle
        end
    end
end

if 4@ = SAMP.GetSAMPPlayerIDByActorHandle(4@)
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: ret 2 3@ 4@

:distanceBetweenActor
Actor.StorePos(0@, 1@, 2@, 3@)
Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
050A: 7@ = distance_between_XYZ 4@ 5@ 6@ and_XYZ 1@ 2@ 3@
0AB2: ret 1 7@
 

ItsRobinson

Active member
Joined
Nov 16, 2017
Messages
105
Reaction score
20
Hey it's me :D I really need to rewrite this CLEO :oops:

Try this, not tested :rolleyes:

PHP:
{$CLEO}
0000: NOP

:Start
wait 100
SAMP.Available
else_jump @Start
0AF8: samp add_message_to_chat "{FFFFFF}Guardnear  -  {0085ff}[Credit: Robinson]"

:getini
0AF0: 10@ = get_int_from_ini_file "cleo\Robinson's Bindings.ini" section "GUARD" key "Key1"
0AF0: 11@ = get_int_from_ini_file "cleo\Robinson's Bindings.ini" section "GUARD" key "Key2"

:MAIN
wait 0
if and 
0AB0:  key_pressed 10@
0AB0:  key_pressed 11@
jf @MAIN
if
0AB1: call @get_id_nearest_player 0 retr_to fdist 0@ sid 1@
jf @MAIN
alloc 2@ 25
0B36: samp 2@ = get_player_nickname 1@
if
    0C29: $NOT_USED = stristr string1 2@ string2 "_Robinson"
jf @MAIN    
0AF9: "/guard %d 200" 1@
wait 1000
jump @MAIN

:get_id_nearest_player
// FOR ALL PEDS
3@ = 100.0 // Max. distance
4@ = 0xFFFFFF // Nearest player handle / id

0A8D: 0@ = read_memory 0xB74490 size 4 virtual_protect 0
0@ += 4
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
for 1@ = 0 to 35584 step 0x100
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    0@++
    if and
        2@ >= 0x00
        2@ < 0x80
    then
        005A: 2@ += 1@
        if or
            003C: $PLAYER_ACTOR == 2@ // LOCAL_PLAYER == REMOTE_PLAYER
            856D: NOT actor 2@ defined // REMOTE PLAYER IS NOT DEFINED
        then continue
        end
    
        0AB1: call @distanceBetweenActor 1 remote_player_handle 2@ retr_dist_to 5@
        if 0025: 3@ > 5@ // Max. dist > cur.
        then
            0087: 3@ = 5@ // Max. dist = cur.
            0085: 4@ = 2@ // Save remote player handle
        end
    end
end

if 4@ = SAMP.GetSAMPPlayerIDByActorHandle(4@)
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: ret 2 3@ 4@

:distanceBetweenActor
Actor.StorePos(0@, 1@, 2@, 3@)
Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
050A: 7@ = distance_between_XYZ 4@ 5@ 6@ and_XYZ 1@ 2@ 3@
0AB2: ret 1 7@
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,133
Solutions
5
Reaction score
885
Location
Lithuania
PHP:
{$CLEO}
0000: NOP

:Start
wait 100
SAMP.Available
else_jump @Start

if
8AAB:   not file_exists "cleo\guardnear-nisad.ini"
else_jump @getini
0AF1: write_int 18 to_ini_file "cleo\guardnear-nisad.ini" section "GUARD" key "Key1"
0AF1: write_int 90 to_ini_file "cleo\guardnear-nisad.ini" section "GUARD" key "Key2"
jump @getini

:getini
0AF0: 10@ = get_int_from_ini_file "cleo\guardnear-nisad.ini" section "GUARD" key "Key1"
0AF0: 11@ = get_int_from_ini_file "cleo\guardnear-nisad.ini" section "GUARD" key "Key2"

:MAIN
wait 0
if and 
key_down 10@
key_down 11@
jf @MAIN
if
0AB1: call @get_id_nearest_player 0 retr_to fdist 0@ sid 1@
jf @MAIN
0B36: samp 2@ = get_player_nickname 1@
0AD4: $NOT_USED = 2@ "%[^_]_%[^_]" 10@v 20@v  //10@v = first name, 20@v = last name
0AF9: "/guard %s 200" 20@v
wait 1000
jump @MAIN

:get_id_nearest_player
// FOR ALL PEDS
3@ = 100.0 // Max. distance
4@ = 0xFFFFFF // Nearest player handle / id

0A8D: 0@ = read_memory 0xB74490 size 4 virtual_protect 0
0@ += 4
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
for 1@ = 0 to 35584 step 0x100
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    0@++
    if and
        2@ >= 0x00
        2@ < 0x80
    then
        005A: 2@ += 1@
        if or
            003C: $PLAYER_ACTOR == 2@ // LOCAL_PLAYER == REMOTE_PLAYER
            856D: NOT actor 2@ defined // REMOTE PLAYER IS NOT DEFINED
        then continue
        end
    
        0AB1: call @distanceBetweenActor 1 remote_player_handle 2@ retr_dist_to 5@
        if 0025: 3@ > 5@ // Max. dist > cur.
        then
            0087: 3@ = 5@ // Max. dist = cur.
            0085: 4@ = 2@ // Save remote player handle
        end
    end
end

if 4@ = SAMP.GetSAMPPlayerIDByActorHandle(4@)
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: ret 2 3@ 4@

:distanceBetweenActor
Actor.StorePos(0@, 1@, 2@, 3@)
Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
050A: 7@ = distance_between_XYZ 4@ 5@ 6@ and_XYZ 1@ 2@ 3@
0AB2: ret 1 7@
 
Status
Not open for further replies.
Top