Str_Replace - CLEO

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const
str = 0@
buf = 1@
orig = "@d"
rep = "511"
p = 2@
end
alloc str 128
alloc buf 256
format str = "Player ID = @d wowka"
if 0C29: p = stristr string1 str string2 orig
then
0A8F: 3@ = p - str
0C24: strncpy destination buf source str size 3@
0C0D: struct buf offset 3@ size 1 = 0x0
0A8E: 4@ = buf + 3@
strlen 3@ orig
005a: p += 3@
format 4@ = "%s%s" rep p
chat "%s" -1 buf
end
free str
free buf
0a93: ect
/*
char *str_replace(char *orig, char *rep, char *str)
{
static char buffer[4096];
char *p;
if(! (p = strstr(str, orig)))
return str;
strncpy(buffer, str, p - str);
buffer[p - str] = '\0';
sprintf(buffer + (p - str), "%s%s", rep, p + strlen(orig));
return buffer;
}
*/