Replacing Characters
#1

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?
Reply
#2

Yes, look around. There is a search bar.
Reply
#3

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

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

and that gos in on playerconnectyes?
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)