Clean Players Names
#1

Does any1 have a function that Clean a players name of _ Like GetPlayerName then Like set the "_" to ""
Reply
#2

pawn Код:
stock GetPlayerNameEx(playerid)
{
  new string[24];
  GetPlayerName(playerid,string,24);
  new str[24];
  strmid(str,string,0,strlen(string),24);
  for(new i = 0; i < MAX_PLAYER_NAME; i++)
  {
    if (str[i] == '_') str[i] = ' ';
  }
  return str;
}
Reply
#3

Quote:

stock GetPlayerNameEx(playerid)
{
new string[24];
GetPlayerName(playerid,string,24);
new str[24];
strmid(str,string,0,strlen(string),24);
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if (str[i] == '_') str[i] = ' ';
}
return str;
}

Wouldnt work. That would change LOL_HAI to LOL HAI. He needs it to change to LOLHAI from what his first post said.
Reply
#4

Use strdel.
pawn Код:
stock GetPlayerNameEx(playerid)
{
  new n[MAX_PLAYER_NAME];
  GetPlayerName(playerid,n,MAX_PLAYER_NAME);
  for(new i=0;i<strlen(n);i++)
    if(n[i]=='_')
      n[i]=' ';
  return n;
}
My GetPlayerNameEx function. I think using strmid is useless in the other posted codes.


Quote:
Originally Posted by XCultz
Quote:
Originally Posted by $ЂЯĢ
pawn Код:
stock GetPlayerNameEx(playerid)
{
  new string[24];
  GetPlayerName(playerid,string,24);
  new str[24];
  strmid(str,string,0,strlen(string),24);
  for(new i = 0; i < MAX_PLAYER_NAME; i++)
  {
    if (str[i] == '_') str[i] = ' ';
  }
  return str;
}
lol nice?
Why are you spamming?
Reply
#5

pawn Код:
stock GetPlayerNameEx(playerid)
{
  new string[24];
  GetPlayerName(playerid,string,24);
  new str[24];
  strmid(str,string,0,strlen(string),24);
  for(new i = 0; i < MAX_PLAYER_NAME; i++)
  {
    if (str == '_') strdel ( str , i , i );
  }
  return str;
}
Ive never used strdel. Would it be used something like this?
Reply
#6

Wiki.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)