CLEO Help Get Started in writing Cleo code

CLEO related
Status
Not open for further replies.

kraneq

Member
Joined
Jun 25, 2019
Messages
6
Reaction score
1
I watched some youtube videos, i learned about sanny buileder and etc.
Do we have a thread on how to start writing code for sa:mp.
I want as my first project to make a simple chat spammer because that way i learn loops and conditions and then maybe a command for like type /ok playerID and you say /ok 203 = Ok Mario[id: 203]. And stuff like that.
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
295
Reaction score
100
Location
UGBASE
C++:
0B34: samp register_client_command "ok" to_label @okdude // registers an SA:MP cmd (sampfuncs is required)

WHILE TRUE
WAIT 0
END

:okdude
IF
SAMP.IsCommandTyped(0@)
THEN
    IF
    0AD4: $NOT_USED = scan_string 0@ format "%d" 1@ // saves the integer / ID to 1@ after you typed as example "/ok ID"
    THEN
        0B36: samp 2@ = get_player_nickname 1@ // gets the playername via ID (1@) and saves it to 2@
        chatmsg "OK Mr. %s" 2@ // 2@ (Nickname) to %s (string). can do the same as %d with ID (1@)
    END
END
0B43:

Actually untested just wrote down real quick, but should work actually.
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
295
Reaction score
100
Location
UGBASE
And for your chat-spammer, you can just put the chatmsg in an formatted way into the WHILE TRUE (END) LOOP, then the message will keep being sent to the chat.
 
Status
Not open for further replies.
Top