SA-MP Forums Archive
Replacing Characters - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Replacing Characters (/showthread.php?tid=77533)



Replacing Characters - mini-d - 12.05.2009

Ive edited YSF to allow spaces but im wandering if its possible to Check if a players name contains _ and change it to a space?


Re: Replacing Characters - [HiC]TheKiller - 12.05.2009

Yes, look around. There is a search bar.


Re: Replacing Characters - mini-d - 12.05.2009

I searched For Replacing Characters it came up with a registration script and this topic


Re: Replacing Characters - yom - 12.05.2009

pawn Код:
new i = -1; while (string[++i]) if (string[i] == '_') string[i]= ' ';



Re: Replacing Characters - mini-d - 12.05.2009

and that gos in on playerconnectyes?


Re: Replacing Characters - miokie - 13.05.2009

MenaceX^ Made this.

pawn Код:
stock PlayerName(playerid)
{
  new n[MAX_PLAYER_NAME];
  GetPlayerName(playerid,n,sizeof(n));
  for(new name=0;name<strlen(n);name++)
  if(n[name]=='_') n[name]=' ';
  return n;
}

To replace the _ In formats That uses getplayername Just put in PlayerName(playerid) instead.

Example:

Before:
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Hello %s", name);
SendClientMessageToAll(COLOR_YELLOW, string);
Will Show Hello Death_God

After
pawn Код:
format(string, sizeof(string), "Hello %s", PlayerName(playerid));
SendClientMessageToAll(COLOR_YELLOW, string);
Will Show Hello Death God