How to remove "_" from RP 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to remove "_" from RP Names (
/showthread.php?tid=269559)
How to remove "_" from RP Names -
Mr.Black - 16.07.2011
well... can anyone show / teach me how to remove the _ from ANY Name which enter the server.. i just want that if anyone enter the server with the _ it get removed , Ex : if he join with Tommy_White , if he make /ad...type anything it appear as Tommy White only , can anyone help ?
Re: How to remove "_" from RP Names -
OUL - 16.07.2011
Look at OnPlayerConnect callback i'm sure there is some name checker?
Re: How to remove "_" from RP Names -
SWEMike - 16.07.2011
pawn Код:
stock RemoveUnderScore(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;
}
Use that function instead of GetPlayerName where you don't want to have the '_', just watch out so you don't change the sections that need names to have underscores.
Re: How to remove "_" from RP Names -
Kush - 16.07.2011
You can create a simple stock function, here's an example:
pawn Код:
stock GetPlayerRPName( playerid, name[ ], len )
{
GetPlayerName( playerid, name, len );
for(new i = 0; i < len; i++ )
{
if ( name[ i ] == '_' )
name[ i ] = ' ';
}
}
Re: How to remove "_" from RP Names -
Mr.Black - 17.07.2011
Well... i a begginer scripter , so can you tell me where i add it ?
Re: How to remove "_" from RP Names -
Flyfishes - 17.07.2011
Add it in your bottom of your script. Then to use it do the following:
For example here:
pawn Код:
new string[128];
format(string, sizeof(string), "Hello, my name is %s", RemoveUnderScore(playerid));
SendClientMessageToAll(-1, string);