CLEO Help auto hello %s

CLEO related
Status
Not open for further replies.

pai1ne13

Active member
Joined
Jan 2, 2019
Messages
59
Reaction score
4
hello, i have a problem.This mode need to say auto "hello X" when "X" joined on the server .but don t work.How can i fix it
Code:
{$CLEO .cs}
0000:

REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

WHILE TRUE
WAIT 0
if
0B61:  samp is_local_player_spawned
then
0AC8: 0@ = allocate_memory_size 260
0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
0B36: samp 6@ = get_player_nickname 7@

if
0C29: $not_use = stristr string1 0@ string2 "%s joined" 6@

THEN
0af9: "hello %s"
wait 1000

END
end
end
 

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
Uh...theres a lot wrong with this code.. ill tell u the steps, u make them
1. Allocate memory
2. Get chat string, you only need text so for the other ones put the value as 0
3. Use 0ad4 (i think) to scan for the name, if the condition is met then go to step 4
4. You already have the player nickname, so just do 'say "%s"'.
5. Free memory

(!) PAY ATTENTION (!)
- use 0ad4 (the opcode should be something like scan_string)
- get chat string, you only need the index (99) and the text (0@), for the rest of the parameters u can put 0 if you are not using them
- no need for 0b36, you are getting name from the string so you obviously already have the nickname
- after you say 'say "hello %s"' make sure you have the variable that contains the nickname too!!!! 'say "hello %s" 6@'
- MAKE SURE YOU USE 'free' TO FREE THE MEMORY!! If you use 'chatmsg' to output the nickname, make sure you use -1 as colour else you risk your game to crash.

There are a dozen of threads on this idea, and not only getting the name from a string. Check everything again and search for other examples how anyone else used certain functions. I hope this was helpful, i dont know what other details to give you.
 

pai1ne13

Active member
Joined
Jan 2, 2019
Messages
59
Reaction score
4
i got that but he say "hello" to player with id 0
Code:
{$CLEO .cs}
0000:

REPEAT
   WAIT 0
UNTIL 0AFA:
 
 31@ = true
WHILE TRUE
WAIT 0
 if 31@ == true
 then
if
0B61:  samp is_local_player_spawned
 
then
0AC8: 0@ = allocate_memory_size 260
0B36: samp 6@ = get_player_nickname 7@
0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
if
0AD4: 4@ = scan_string 0@ format "[JOIN] %s has"
THEN
say "hello %s" 6@
wait 1000


END
end
end
end
0AC9: free_allocated_memory 0@
 

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
{$CLEO .cs}
0000:

REPEAT
WAIT 0
UNTIL 0AFA:

31@ = true

WHILE TRUE
WAIT 0
if 31@ == true
then
if
0B61: samp is_local_player_spawned

then
0AC8: 0@ = allocate_memory_size 260
0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
if
0AD4: 4@ = scan_string 0@ format "[JOIN] %s has" 6@
THEN
say "hello %s" 6@
wait 1000

0AC9: free_allocated_memory 0@

END
End
end
end
 

pai1ne13

Active member
Joined
Jan 2, 2019
Messages
59
Reaction score
4
{$CLEO .cs}
0000:

REPEAT
WAIT 0
UNTIL 0AFA:

31@ = true

WHILE TRUE
WAIT 0
if 31@ == true
then
if
0B61: samp is_local_player_spawned

then
0AC8: 0@ = allocate_memory_size 260
0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
if
0AD4: 4@ = scan_string 0@ format "[JOIN] %s has" 6@
THEN
say "hello %s" 6@
wait 1000

0AC9: free_allocated_memory 0@

END
End
end
end
don't say the name of who joined, just "`"
 
Status
Not open for further replies.
Top