06.07.2011, 12:59
(
Последний раз редактировалось Calgon; 06.07.2011 в 14:57.
)
I just made this function for you, though I haven't had a chance to properly test it.
This will only get the name before the first underscore.
Usage:
pawn Код:
stock getFirstName(szPlayerName[]) {
new
_tmpSzPlayerName[MAX_PLAYER_NAME],
iCh = strfind(szPlayerName, "_", true);
if(iCh != -1) {
strcat(_tmpSzPlayerName, szPlayerName, MAX_PLAYER_NAME);
strdel(_tmpSzPlayerName, iCh, strlen(szPlayerName));
} else {
format(_tmpSzPlayerName, sizeof(_tmpSzPlayerName), "Nameless");
}
return _tmpSzPlayerName;
}
Usage:
pawn Код:
new szName[MAX_PLAYER_NAME], szMessage[128];
GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
format(szMessage, sizeof(szMessage), "Hi, %s. How are you?", getFirstName(szName));