08.02.2011, 21:04
(
Последний раз редактировалось 77ther; 13.02.2011 в 00:45.
)
As subject says... I would like to replace "_" with " " in chat lines, any help?
new name[24];
GetPlayerName(playerid,name,24);
name[strfind(name,"_")] = ' ';
Use the strfind function on the name of the person, for example:
pawn Код:
This is only an example, you likely need to adapt it for your script. |
My suggestion is to put it under OnPlayerConnect,right after you check for RP name
Why there? 1.You will use it just once and no need to edit anything 2.It will save/read player file with " " (space) |
new namestring = strfind(plname, "_", true);
It accualy doesn't work..
EDIT: I found this, maybe I have to do something with it? Код:
new namestring = strfind(plname, "_", true); |
stock
Name( playerid )
{
new
ply_name [ 24 ]
;
GetPlayerName ( playerid , ply_name , sizeof ( ply_name ) ) ;
if ( playerid != 0xFFFF ) {
if ( strfind ( ply_name , "_" , true ) != -1 ) {
name [ strfind ( ply_name , "_" ) ] = ' ';
return ply_name;
}
}
return -1;
}
stock GPN(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;
}