first letters of name
#1

Hello, I want to ask how to get the first letters of Firstname and Surname?
Reply
#2

Use this:
Код:
stock GetPlayerFirstName(playerid)
{
	new namestring[2][MAX_PLAYER_NAME];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,MAX_PLAYER_NAME);
	split(name, namestring, '_');
	return namestring[0];
}
stock GetPlayerLastName(playerid)
{
	new namestring[2][MAX_PLAYER_NAME];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,MAX_PLAYER_NAME);
	split(name, namestring, '_');
	return namestring[1];
}
Rep+?
Reply
#3

Quote:
Originally Posted by alanhutch
Посмотреть сообщение
Use this:
Код:
stock GetPlayerFirstName(playerid)
{
	new namestring[2][MAX_PLAYER_NAME];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,MAX_PLAYER_NAME);
	split(name, namestring, '_');
	return namestring[0];
}
stock GetPlayerLastName(playerid)
{
	new namestring[2][MAX_PLAYER_NAME];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,MAX_PLAYER_NAME);
	split(name, namestring, '_');
	return namestring[1];
}
Rep+?
Split is not native function.



PHP код:
stock GetPlayerSurName(pid){
    static
        
Name[24],
        
Position
    
;
    
    
GetPlayerName(pidName24);
    
Position strfind(Name"_"true);
    
    
strdel(Name0Position+1);
    return 
Name;
}
stock GetPlayerFirstName(pid){
    static
        
Name[24],
        
Position
    
;
    
GetPlayerName(pidName24);
    
Position strfind(Name"_"true);
    
strdel(NamePositionstrlen(Name));
    return 
Name;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)