CLEO Help ID of the player by the name taken

CLEO related
Status
Not open for further replies.

Child_

Active member
Joined
May 9, 2015
Messages
115
Reaction score
0
Hey, So can we some how replace the players name with his ID when we take his exact name in the chat.

I mean like for example there's a player named 'kay'

I don't know his ID, so if I type kay or /kay in the chat, instead of his name his ID is sent to the chat.
I need the code cause I need to edit a cleo with it
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
There are some ways;

1. Setup hooks for chat/commands RPCs, use stristr/strcmp in a loop for all the online players, send chat message and return false.

2. Register a simple command like /. and use it like /. <name>, use stristr/strcmp in a loop for all the online players, send chat message.
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
Code:
:bleah
0B35: 0@ //command string
FOR 1@ = 999 DOWNTO 0          
    IF 0B23: 1@ //is player with id 1@ connected
    THEN    
        0B36: 2@ = 1@ // get player 1@ name
        IF 0C21: str1 0@ str2 2@  //compare strings
        THEN 0AF9: "%d" 1@ //say id in chat
            BREAK
        END
    END
END
0B43:

Should work, i think.
 

Juanbustillos

Active member
Joined
Mar 29, 2014
Messages
29
Reaction score
4
Location
Ecuador
Try this:


Code:
{$CLEO}
0000:

repeat
    wait 40
until SAMP.Available()

0B34: "find" @find_name

WHILE TRUE
WAIT 0
END

:find_name
0B35: get_params_to 0@
IF 0AD4: 0@ = scan 0@ format "%s" 1@v
THEN
    0B35: get_params_to 0@
    1@ = 0
    chatmsg "" -1
    FOR 2@ = 0 TO 999
        IF 0B23: is_connected 2@
        THEN
            0B36: samp 3@ = get_player_nickname 2@
            IF 0C29: 5@ = in_string 3@ find 0@ //Ignore capital letters
            THEN
            chatmsg "-> %s [ID: %d]" -1 3@ 2@ //printing
            1@++
            END
        END
    END
    chatmsg "-> Total coincidences: %d" -1 1@ //Summary
    chatmsg "" -1
ELSE chatmsg "Usage: /find [PartName]"
END
cmdret
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
VictorieG link said:
I wont to script too but i dont know how to start can someone give me an advise?

We have a tutorials sections, https://ugbase.eu/tutorials/ there are some helpful topics there.
Alternatively, check gtaforums/sannybuilder forums.
 

VictorieG

Active member
Joined
Mar 30, 2015
Messages
28
Reaction score
0
springfield link said:
We have a tutorials sections, https://ugbase.eu/tutorials/ there are some helpful topics there.
Alternatively, check gtaforums/sannybuilder forums.

Thank you lad  :forever_opcode_alone:
 
Status
Not open for further replies.
Top