@@ -59,7 +59,7 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
59
59
// Formatlanacak metini al
60
60
std::string metin = getString (amx, params[text_index]);
61
61
62
- // Argüman sayýsý 1 deðilse formatlama aþamasýna geç
62
+ // Argüman sayýsý offset sayýsýna ulaþýyor ve geçiyorsa formatlama aþamasýna geç
63
63
if (max_args >= args_offset)
64
64
{
65
65
// Metini tarayacak index deðerimiz
@@ -93,6 +93,8 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
93
93
amx_GetAddr (amx, params[args_count++], °er);
94
94
95
95
metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <int >(*deger)));
96
+
97
+ continue ;
96
98
}
97
99
98
100
// Float
@@ -104,36 +106,50 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
104
106
amx_GetAddr (amx, params[args_count++], °er);
105
107
106
108
metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <float >(amx_ctof (*deger))));
109
+
110
+ continue ;
107
111
}
108
112
109
113
// String
110
114
else if (metin[index ] == ' s' )
111
115
{
112
116
int yuzde = index - 1 ;
113
117
metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), getString (amx, params[args_count++])));
118
+ continue ;
114
119
}
115
120
116
121
// Char
117
122
else if (metin[index ] == ' c' )
118
123
{
124
+ bool degistir = false ;
125
+
119
126
int yuzde = index - 1 ;
120
127
121
128
cell* deger = nullptr ;
122
129
amx_GetAddr (amx, params[args_count++], °er);
123
130
124
131
if (*deger == 0x25 )
125
132
{
133
+ degistir = true ;
126
134
metin.replace (yuzde, index - yuzde + 1 , " %%" );
127
135
}
128
136
else
129
137
{
138
+ degistir = true ;
130
139
metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <char >(*deger)));
131
140
}
141
+
142
+ if (degistir)
143
+ {
144
+ continue ;
145
+ }
132
146
}
133
147
134
148
// %02d, %02f vs..
135
149
else if (metin[index ] >= ' 0' && metin[index ] <= ' 9' )
136
150
{
151
+ bool degistir = false ;
152
+
137
153
int yuzde = index - 1 ;
138
154
139
155
while (!isalpha (metin[index ]))
@@ -147,19 +163,30 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
147
163
amx_GetAddr (amx, params[args_count++], °er);
148
164
149
165
metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <int >(*deger)));
166
+
167
+ degistir = true ;
150
168
}
151
169
else if (metin[index ] == ' f' || metin[index ] == ' F' || metin[index ] == ' a' || metin[index ] == ' A' || metin[index ] == ' g' || metin[index ] == ' G' )
152
170
{
153
171
cell* deger = nullptr ;
154
172
amx_GetAddr (amx, params[args_count++], °er);
155
173
156
174
metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <float >(amx_ctof (*deger))));
175
+
176
+ degistir = true ;
177
+ }
178
+
179
+ if (degistir)
180
+ {
181
+ continue ;
157
182
}
158
183
}
159
184
160
185
// %.*s, %.*f
161
186
else if (metin[index ] == ' .' && metin[index + 1 ] == ' *' )
162
187
{
188
+ bool degistir = false ;
189
+
163
190
int yuzde = index - 1 ;
164
191
165
192
while (!isalpha (metin[index ]))
@@ -169,6 +196,8 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
169
196
170
197
if (metin[index ] == ' s' )
171
198
{
199
+ degistir = true ;
200
+
172
201
cell* deger = nullptr ;
173
202
amx_GetAddr (amx, params[args_count++], °er);
174
203
@@ -177,6 +206,8 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
177
206
178
207
else if (metin[index ] == ' f' || metin[index ] == ' F' || metin[index ] == ' a' || metin[index ] == ' A' || metin[index ] == ' g' || metin[index ] == ' G' )
179
208
{
209
+ degistir = true ;
210
+
180
211
cell* deger = nullptr ;
181
212
amx_GetAddr (amx, params[args_count++], °er);
182
213
@@ -185,11 +216,18 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
185
216
186
217
metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <int >(*deger), static_cast <float >(amx_ctof (*deger2))));
187
218
}
219
+
220
+ if (degistir)
221
+ {
222
+ continue ;
223
+ }
188
224
}
189
225
190
226
// %.1s, %.1f
191
227
else if (metin[index ] == ' .' && metin[index + 1 ] != ' *' )
192
228
{
229
+ bool degistir = false ;
230
+
193
231
int yuzde = index - 1 ;
194
232
195
233
while (!isalpha (metin[index ]))
@@ -199,16 +237,24 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
199
237
200
238
if (metin[index ] == ' s' )
201
239
{
240
+ degistir = true ;
202
241
metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), getString (amx, params[args_count++])));
203
242
}
204
243
205
244
else if (metin[index ] == ' f' || metin[index ] == ' F' || metin[index ] == ' a' || metin[index ] == ' A' || metin[index ] == ' g' || metin[index ] == ' G' )
206
245
{
246
+ degistir = true ;
247
+
207
248
cell* deger = nullptr ;
208
249
amx_GetAddr (amx, params[args_count++], °er);
209
250
210
251
metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <float >(amx_ctof (*deger))));
211
252
}
253
+
254
+ if (degistir)
255
+ {
256
+ continue ;
257
+ }
212
258
}
213
259
}
214
260
index ++;
0 commit comments