Простого способа вроде нет, так проб:
Код
public OnPluginStart()
{
new String:text[] = "abcdefg";
PrintToServer(text);
ChangeCharByIndex(text, sizeof(text), 2, '\0');
PrintToServer(text);
text = "abcdefg";
ChangeCharByIndex(text, sizeof(text), 2, 'X');
PrintToServer(text);
}
stock ChangeCharByIndex(String:text[], text_size, index, new_char)
{
decl String:buffer[text_size]; buffer[0] = '\0';
for (new i = 0; i < index; i++)
{
if (buffer[0] == '\0') Format(buffer, text_size, "%c", text[i]);
else Format(buffer, text_size, "%s%c", buffer, text[i]);
}
if (new_char == '\0') Format(text, text_size, "%s%s", buffer, text[index+1]);
else Format(text, text_size, "%s%c%s", buffer, new_char, text[index+1]);
}
Результат:
Код
abcdefg
abdefg
abXdefg