Removing "_" from player names - 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: Removing "_" from player names (
/showthread.php?tid=408401)
Removing "_" from player names -
Noles2197 - 18.01.2013
When I asked a friend of mine how to remove them, he gave me this, but it's still not working and instead of names appearing as "John Smith", they appear as "John_Smith"
pawn Код:
stock GetNameEx(playerid)
{
new Name[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid))
{
new i;
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
while ((i = strfind(Name, "_", false, i)) != -1)
Name[i] = ' ';
}
return Name;
}
Re: Removing "_" from player names -
Pooh7 - 18.01.2013
pawn Код:
stock no_underscore(playerid)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof playername);
for(new i = 0; i < strlen(playername); i++)
{
if(playername[i] == '_')
{
playername[i] = ' ';
break;
}
}
return playername;
}
Re: Removing "_" from player names -
SchurmanCQC - 18.01.2013
pawn Код:
stock GetNameEx(playerid) {
new Name[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid)) {
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
Name = str_replace("_", " ", Name);
} else return -1;
return Name;
}
See
this.
Re: Removing "_" from player names -
Glad2BeHere - 18.01.2013
pawn Код:
stock RPNAME(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}
Re: Removing "_" from player names -
ViruZz - 18.01.2013
Are you sure you're using the custom function when getting a player name or you're still using GetPlayerName?
Re: Removing "_" from player names -
Glad2BeHere - 18.01.2013
well here is the method i created first we get the palyer name, then we check each player name and foreach player name that has "_" it will be seend as " ".
for example
pawn Код:
new string[32];
format(string, sizeof(string), "%s", RPNAME(playerid));
SendClientMessage(playerid, -1, string);
//in a command via zcmd ...
CMD:namecheck(playerid, params[])
{
new string[32];
format(string, sizeof(string), "%s", RPNAME(playerid));
SendClientMessage(playerid, -1, string);
return 1;
}