@@ -59,7 +59,7 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
5959 // Formatlanacak metini al
6060 std::string metin = getString (amx, params[text_index]);
6161
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ç
6363 if (max_args >= args_offset)
6464 {
6565 // Metini tarayacak index deðerimiz
@@ -93,6 +93,8 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
9393 amx_GetAddr (amx, params[args_count++], °er);
9494
9595 metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <int >(*deger)));
96+
97+ continue ;
9698 }
9799
98100 // Float
@@ -104,36 +106,50 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
104106 amx_GetAddr (amx, params[args_count++], °er);
105107
106108 metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <float >(amx_ctof (*deger))));
109+
110+ continue ;
107111 }
108112
109113 // String
110114 else if (metin[index] == ' s' )
111115 {
112116 int yuzde = index - 1 ;
113117 metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), getString (amx, params[args_count++])));
118+ continue ;
114119 }
115120
116121 // Char
117122 else if (metin[index] == ' c' )
118123 {
124+ bool degistir = false ;
125+
119126 int yuzde = index - 1 ;
120127
121128 cell* deger = nullptr ;
122129 amx_GetAddr (amx, params[args_count++], °er);
123130
124131 if (*deger == 0x25 )
125132 {
133+ degistir = true ;
126134 metin.replace (yuzde, index - yuzde + 1 , " %%" );
127135 }
128136 else
129137 {
138+ degistir = true ;
130139 metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <char >(*deger)));
131140 }
141+
142+ if (degistir)
143+ {
144+ continue ;
145+ }
132146 }
133147
134148 // %02d, %02f vs..
135149 else if (metin[index] >= ' 0' && metin[index] <= ' 9' )
136150 {
151+ bool degistir = false ;
152+
137153 int yuzde = index - 1 ;
138154
139155 while (!isalpha (metin[index]))
@@ -147,19 +163,30 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
147163 amx_GetAddr (amx, params[args_count++], °er);
148164
149165 metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <int >(*deger)));
166+
167+ degistir = true ;
150168 }
151169 else if (metin[index] == ' f' || metin[index] == ' F' || metin[index] == ' a' || metin[index] == ' A' || metin[index] == ' g' || metin[index] == ' G' )
152170 {
153171 cell* deger = nullptr ;
154172 amx_GetAddr (amx, params[args_count++], °er);
155173
156174 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 ;
157182 }
158183 }
159184
160185 // %.*s, %.*f
161186 else if (metin[index] == ' .' && metin[index + 1 ] == ' *' )
162187 {
188+ bool degistir = false ;
189+
163190 int yuzde = index - 1 ;
164191
165192 while (!isalpha (metin[index]))
@@ -169,6 +196,8 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
169196
170197 if (metin[index] == ' s' )
171198 {
199+ degistir = true ;
200+
172201 cell* deger = nullptr ;
173202 amx_GetAddr (amx, params[args_count++], °er);
174203
@@ -177,6 +206,8 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
177206
178207 else if (metin[index] == ' f' || metin[index] == ' F' || metin[index] == ' a' || metin[index] == ' A' || metin[index] == ' g' || metin[index] == ' G' )
179208 {
209+ degistir = true ;
210+
180211 cell* deger = nullptr ;
181212 amx_GetAddr (amx, params[args_count++], °er);
182213
@@ -185,11 +216,18 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
185216
186217 metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <int >(*deger), static_cast <float >(amx_ctof (*deger2))));
187218 }
219+
220+ if (degistir)
221+ {
222+ continue ;
223+ }
188224 }
189225
190226 // %.1s, %.1f
191227 else if (metin[index] == ' .' && metin[index + 1 ] != ' *' )
192228 {
229+ bool degistir = false ;
230+
193231 int yuzde = index - 1 ;
194232
195233 while (!isalpha (metin[index]))
@@ -199,16 +237,24 @@ std::string service::formattedString(AMX* amx, cell* params, cell text_index, in
199237
200238 if (metin[index] == ' s' )
201239 {
240+ degistir = true ;
202241 metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), getString (amx, params[args_count++])));
203242 }
204243
205244 else if (metin[index] == ' f' || metin[index] == ' F' || metin[index] == ' a' || metin[index] == ' A' || metin[index] == ' g' || metin[index] == ' G' )
206245 {
246+ degistir = true ;
247+
207248 cell* deger = nullptr ;
208249 amx_GetAddr (amx, params[args_count++], °er);
209250
210251 metin.replace (yuzde, index - yuzde + 1 , fmt::sprintf (metin.substr (yuzde, index - yuzde + 1 ), static_cast <float >(amx_ctof (*deger))));
211252 }
253+
254+ if (degistir)
255+ {
256+ continue ;
257+ }
212258 }
213259 }
214260 index++;
0 commit comments