CLEO Help (SOLVED) I need detect if targeted_actor is a NPC - /close

CLEO related
Status
Not open for further replies.

TheDjCody

Active member
Joined
Sep 6, 2018
Messages
40
Reaction score
5
This is the code, but not work, not detect is targeted_actor is a NPC.

Code:
{$CLEO .cs}

0000: NOP
 
:APUNTARID
wait 200
if and                               
0AD2: 0@ = actor $PLAYER_CHAR targeted_ACTOR //IF and SET
0AB0: 78 //Key "B"
jf @APUNTARCMD
if 0104: actor $PLAYER_ACTOR near_actor 0@ radius  14.0  14.0  14.0 sphere  0
    then
        if 0B64:  samp is_player 0@ npc
            then
            0AF8: samp add_message_to_chat "{FF3300}It's a NPC." color 0xFFFFFF
            else
            0B2B: samp 1@ = get_player_id_by_CHAR_handle 0@
            0B36: samp 2@ = get_player_nickname 1@
            0AF9: samp say_msg "/id %d" 1@
    else
    jump @APUNTARID
    end
end
:APUNTARCMD
jump @APUNTARID

¿Solution?
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
Code:
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY



WHILE TRUE
    WAIT 0
    IF
    0AB0: KEY_PRESSED 78 // B
    THEN
        REPEAT
            WAIT 0
        UNTIL 8AB0: NOT_KEY_PRESSED 78 // ANTI_SPAM
        IF
        0AD2: 0@ = actor $PLAYER_CHAR targeted_ACTOR //IF and SET
        THEN
            IF
            0104: actor $PLAYER_ACTOR near_actor 0@ radius  14.0  14.0  14.0 sphere  0
            THEN
                0B2B: samp 1@ = get_player_id_by_CHAR_handle 0@
                IF
                8B64: is_NOT samp is_player 1@ npc
                THEN
                    0B36: samp 2@ = get_player_nickname 1@
                    0AF9: samp say_msg "/id %d" 1@
                    0AF8: samp add_message_to_chat "{FF3300}You aimed at %s(%d)" color 0xFFFFFF 2@ 1@             
                ELSE
                    0AF8: samp add_message_to_chat "{FF3300}It's a NPC." color 0xFFFFFF
                END
            END   
        END
    END
END
 

TheDjCody

Active member
Joined
Sep 6, 2018
Messages
40
Reaction score
5
Still don't work, see the attached files, some problem with insert images.
 

Attachments

  • screenshot_29-12-2018_21-52-55-736.png
    screenshot_29-12-2018_21-52-55-736.png
    814.1 KB · Views: 15
  • screenshot_29-12-2018_21-53-06-287.png
    screenshot_29-12-2018_21-53-06-287.png
    658.5 KB · Views: 15

TheDjCody

Active member
Joined
Sep 6, 2018
Messages
40
Reaction score
5
Hmmh....... then we need something to check if its a SAMP ACTOR.
0B25: samp 5@ = get_player_health 1@
if
5@ > 7
THEN

maybe that works? idk..

Don't work.

but it says that the id of the NPC is -1, so why not use it?

Code:
IF AND
8B64: is_NOT samp is_player 1@ npc
1@ > -1   // or something like: 1@ >= 0
THEN

Work, but when i target a NPC don't show "It's a NPC", this is not important, but i need this work for further cleo, sorry for the problems.

I tried everything but don't show "It's a NPC"...
 

TheDjCody

Active member
Joined
Sep 6, 2018
Messages
40
Reaction score
5
Code:
{$CLEO .cs}

0000: NOP

:APUNTARID
wait 150
if and                              
0AD2: 0@ = actor $PLAYER_CHAR targeted_ACTOR //IF and SET
0AB0: 66 //Key "B"
jf @APUNTARCMD
if 0104: actor $PLAYER_ACTOR near_actor 0@ radius  14.0  14.0  14.0 sphere  0
    then
        0B2B: samp 1@ = get_player_id_by_CHAR_handle 0@
        0B36: samp 2@ = get_player_nickname 1@ //don't have use for the moment
        if and
            8B64: is_NOT samp is_player 1@ npc
            1@ > -1
            then
                0AF9: samp say_msg "/id %d" 1@
            else
                0AF8: samp add_message_to_chat "{FF3300}Es un NPC." color 0xFFFFFF                
        else
    jump @APUNTARID
end
end
:APUNTARCMD
jump @APUNTARID
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
Code:
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY



WHILE TRUE
    WAIT 0
    IF
    0AB0: KEY_PRESSED 78 // B
    THEN
        REPEAT
            WAIT 0
        UNTIL 8AB0: NOT_KEY_PRESSED 78 // ANTI_SPAM
        IF
        0AD2: 0@ = actor $PLAYER_CHAR targeted_ACTOR //IF and SET
        THEN
            IF
            0104: actor $PLAYER_ACTOR near_actor 0@ radius  14.0  14.0  14.0 sphere  0
            THEN
                0B2B: samp 1@ = get_player_id_by_CHAR_handle 0@
                IF AND
                1@ > 0
                8B64: is_NOT samp is_player 1@ npc
                THEN
                    0B36: samp 2@ = get_player_nickname 1@
                    0AF9: samp say_msg "/id %d" 1@
                    0AF8: samp add_message_to_chat "{FF3300}You aimed at %s(%d)" color 0xFFFFFF 2@ 1@             
                ELSE
                    0AF8: samp add_message_to_chat "{FF3300}It's a NPC." color 0xFFFFFF
                END
            END   
        END
    END
END
 

TheDjCody

Active member
Joined
Sep 6, 2018
Messages
40
Reaction score
5
Code:
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY



WHILE TRUE
    WAIT 0
    IF
    0AB0: KEY_PRESSED 78 // B
    THEN
        REPEAT
            WAIT 0
        UNTIL 8AB0: NOT_KEY_PRESSED 78 // ANTI_SPAM
        IF
        0AD2: 0@ = actor $PLAYER_CHAR targeted_ACTOR //IF and SET
        THEN
            IF
            0104: actor $PLAYER_ACTOR near_actor 0@ radius  14.0  14.0  14.0 sphere  0
            THEN
                0B2B: samp 1@ = get_player_id_by_CHAR_handle 0@
                IF AND
                1@ > 0
                8B64: is_NOT samp is_player 1@ npc
                THEN
                    0B36: samp 2@ = get_player_nickname 1@
                    0AF9: samp say_msg "/id %d" 1@
                    0AF8: samp add_message_to_chat "{FF3300}You aimed at %s(%d)" color 0xFFFFFF 2@ 1@           
                ELSE
                    0AF8: samp add_message_to_chat "{FF3300}It's a NPC." color 0xFFFFFF
                END
            END 
        END
    END
END

Work, thanks you both @Opcode.eXe and @monday.

PD: ¿How i can close a thread?
 
Status
Not open for further replies.
Top