How to replace characters in a string automatically?
#1

I would like to create a new advertisement system for my server, writing the ads in a game text for everybody. It wouldn't be too hard, but there are many accentuated letters in my language, and if a player makes an ad with these letters, they doesn't appear correctly. I found a solution, if I want the game text to appear correctly, I have to replace the accentuated letters with symbols. It is easy, if I write the script, but when a player makes an ad, he/she writes the normal letters into the chatbox. So, are there any ways to replace the accentuated letters with their symbols automatically? Any help is welcome.
Reply
#2

pawn Код:
public OnPlayerText(playerid, text)
{
  if (writting ad text)
  {
    new idx = 0;
    while(text[idx] != '\0')
    {
      switch(text[idx])
      {
        case '@': text[idx] = 'a';
        case 'Ђ': text[idx] = 'e';
      }
      idx++;
    }
  }
}
Something like that ?
Reply
#3

Use strdel + strins.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)