CLEO Help String Remove Varible

CLEO related
Status
Not open for further replies.

fahrein

Active member
Joined
Apr 18, 2014
Messages
101
Reaction score
0
0B36: samp 15@ = get_player_nickname 17@

This string varible "_" ı delete from string "_" replace " " how to this?

0B36: samp 15@ = get_player_nickname 17@
0C18: 3@ = strstr string1 15@ string2 "_"
0C24: strncpy destination 3@ source " " size 1

But "Name  " i want to "Name Surname"

Ä° dont want to "Name_Surname" i want to "Name Surname"
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Code:
0B36: samp 15@ = get_player_nickname 17@

0AC8: 5@ = 32 
0C13: strcpy destination 5@ source 17@ //copy name to another string, 0B36 returns a pointer.
IF 0C2B: 6@ = strpbrk string 5@ control "_" // find the first occurance of "_"
THEN 0A8C: writeMem 6@ sz 1 val 0x20 vp 0 //replace char with space
END

//5@ = "Name Surname"
//do whatever with the string
0AC9: 5@
 

fahrein

Active member
Joined
Apr 18, 2014
Messages
101
Reaction score
0
Crash me  :bawww: :bawww:
Code:
{$CLEO .cs}
thread 'Message'

:Load
wait 30
if
  SAMP.Available
else_jump @Load
0B34: samp register_client_command "fmsg" to_label @MSG

while true
wait 0
end

:MSG
0B35: samp 0@ = get_last_command_params
if
0AD4: 1@ = scan_string 0@ format "%d %d %s" 17@ 8@ 5@v
then
alloc 30@ 256
0B36: samp 15@ = get_player_nickname 17@

0AC8: 3@ = 32 
0C13: strcpy destination 3@ source 17@ //copy name to another string, 0B36 returns a pointer.
IF 0C2B: 6@ = strpbrk string 3@ control "_" // find the first occurance of "_"
THEN 0A8C: writeMem 6@ sz 1 val 0x20 vp 0 //replace char with space
END

//5@ = "Name Surname"
//do whatever with the string
0AC9: 3@
format 30@ "%s(%d): %s" 3@ 8@ 5@v
0AF8: samp add_message_to_chat 30@ color -1   
else
    0AF8: samp add_message_to_chat "/fmsg <name> <id> <message>" color -1
end
SAMP.CmdRet

Crash me?

bump [member=111]springfield[/member]
 

fahrein

Active member
Joined
Apr 18, 2014
Messages
101
Reaction score
0
springfield link said:
allocate memory for 30@
Also, if you use 5@v you can't use 6@ 7@ 8[member=34438].[/member] So change that.
I working cleo no crash. But i write /fmsg "  (71): ajkshdkjahdka" , Name is " "(All name " ", not Name Surname format) in other words.

Note: When I use 5@v  "Name_Surname" work old script, no crash. But "Name Surname" dont work :(

[member=111]springfield[/member]
 
Status
Not open for further replies.
Top