Дабл идиотизм в клео / Str Replace

 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{$CLEO}
0000:
0662: "by legend2360"
0662: "BlastHack - cheating is art"
while not SAMP.Available()
wait 400
end
alloc 0@ 128
format 0@ = "Player ID = %cd wowka" 0x25
lo 1@ @1
lo 2@ @2
if call @str_replace 3 str 0@ replace 1@ on 2@ result_to 3@
then
chat "%s" -1 3@
free 3@
end
free 0@
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;
}
*/
:str_replace
var
0@ : int
1@ : int
2@ : int
end
// call @str_replace 3 str 0@ replace 1@ on 2@ result_to 3@
0C29: 4@ = stristr string1 0@ string2 1@
if 4@ == 0
then
ret_false
ret 1 0@
end
strlen 5@ 0@
strlen 6@ 1@
if 001d: 6@ > 5@
then
ret_false
ret 1 0@
end
strlen 7@ 2@
0A8F: 8@ = 6@ - 7@
if 8@ < 0
then
8@ *= -1
005a: 5@ += 8@
end
5@++ // safe
alloc 3@ 5@
0A8F: 9@ = 4@ - 0@ // p - str
0C24: strncpy destination 3@ source 0@ size 9@
0C1E: array 3@ element 9@ el_size 1 = 0x0
0A8E: 10@ = 3@ + 9@ // buffer + (p - str)
0A8E: 11@ = 4@ + 6@ // p + strlen(orig)
format 10@ = "%s%s" 2@ 11@
ret_true
ret 1 3@
:1
hex
25 "d" 00
end
:2
hex
"511" 00
end