Player Initials
#2

pawn Код:
stock GetName(playerid, bool:initialize = false);
{
    new szName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, szName, sizeof(szName));
    if(!initialize)
        return szName;
    else {
        format(szName, sizeof szName, "%c. %s", szName[0], szName[strfind(szName, "_") + 1]);
        return szName;
    }
}
To use the initialized name just use GetName like this: GetName(playerid, true);
To use the regular name, don't change anything, just use the function as normal: GetName(playerid);

Ex.
pawn Код:
new string[128];
//Will print: "C. Crayder says: text"
format(string,sizeof(string) ,"%s says: %s", GetName(playerid, true), text);
//Both will print: "Crayder Crayder says: text"
format(string,sizeof(string) ,"%s says: %s", GetName(playerid), text);
format(string,sizeof(string) ,"%s says: %s", GetName(playerid, false), text);
Note: This is untested by the way, but it should work...
Reply


Messages In This Thread
Player Initials - by Squirrel - 16.01.2016, 01:02
Re: Player Initials - by Crayder - 16.01.2016, 01:09
Re: Player Initials - by Squirrel - 16.01.2016, 01:26

Forum Jump:


Users browsing this thread: 1 Guest(s)