26.07.2010, 21:44
Is there any custom possibility to allow spaces between the username ?
You can detect certain symbols in a player's name and replace then with a space on login.
Like, say a person has a name in the format firstname_lastname: you can make a script that detects the "_" and replaces it with a " ". The same can be said if a person has a "." in their name or something. |
public OnPlayerConnect(playerid)
{
if(strfind(PlayerName(playerid),"_")!=-1) AddSpace(playerid);
}
/*stock*/ AddSpace(playerid)
{
new that[25];
if(strfind(PlayerName(playerid),"_")!=-1)
{
strpack(that,PlayerName(playerid));//to make things simpler
new number=strfind(that,"_");//to make things simpler(again)
strdel(that,number,number+1);
strins(that," ",number);//<------------
SetPlayerName(playerid,that);
}
return 1;
}
stock AddSpace(playerid)//REMEMBER TO STOOCK THIS!
{
new that[25];
if(strfind(PlayerName(playerid),"_")!=-1)
{
strpack(that,PlayerName(playerid));//to make things simpler
new number=strfind(that,"_");//to make things simpler(again)
strdel(that,number,number+1);
strins(that," ",number);
}
return that;//AND ALSO REMEMBER TO RETURN 'that'!!!
}
public OnPlayerText(playerid, text[])
{
if(strfind(PlayerName(playerid),"_")!=-1)
{
new str;
format(str,sizeof(str),"%s: %s",AddSpace(playerid),text);//***
SendClientMessageToAll(whatever_color,str);
return 0;//RETURN 0!! so they don't see the original text
}
return 1;
}