SA-MP Forums Archive
Replacing д with ae - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Replacing д with ae (/showthread.php?tid=123433)



Replacing д with ae - Doktor - 25.01.2010

Hi, i would like to replace some characters. I know you could use strfind to search for single characters and then replace them. In my example i would like to replace a single character with 2 characters (д with ae, ц with oe ...).
Could someone tell me how to do it?


Re: Replacing д with ae - tyler12 - 22.12.2011

Код:
public OnPlayerText(playerid,text[])
{
  new string[45];  

  if(strcmp(text,"//input from player",true)==0)
  {
    SendPlayerMessageToAll(playerid,"//output from player");
    return 0;
  }
  return 1;
}
remove the //


Re: Replacing д with ae - Mauzen - 22.12.2011

Thats how id do it without testing or deeper thinking

pawn Код:
new pos = strfind(string, "д", false, 0);
while (pos > -1) {
    string[pos] = 'a';
    strins(string, "e", pos+1);
    pos = strfind(string, "д", false, pos-1);
}
Maybe pos+1 in strins needs to be just pos, the rest should work