[Question]First player name letter.
#1

Hey, i want to know how i can to get the first letter/character of player name, for example the player name is: Sean_Banks, and i want to get his first letter S, and his first letter in his last name.
for Exmaple: Sean_Banks = SB, how did i do it and get the letters? i want it for vehicle plate system..
Reply
#2

i think it will be hard but you can use variables to detect it and make it
Reply
#3

pawn Код:
stock retFirstLeters(name[MAX_PLAYER_NAME])
{
    new
        strpos = strfind(name, "_", true),
        string[4];
   
    format(string, sizeof(string), "%c%c", name[0], name[strpos+1]);
    return string;
}
example
pawn Код:
printf("%s",retFirstLeters("Sean_Banks"));
prints out
Quote:

SB

The name HAS to be in roleplay format for it to work though.
Reply
#4

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
pawn Код:
stock retFirstLeters(name[MAX_PLAYER_NAME])
{
    new
        strpos = strfind(name, "_", true),
        string[4];
   
    format(string, sizeof(string), "%c%c", name[0], name[strpos+1]);
    return string;
}
example
pawn Код:
printf("%s",retFirstLeters("Sean_Banks"));
prints out
The name HAS to be in roleplay format for it to work though.
I'll test it now, thank you very much!

EDIT: its work only for Sean Banks name, i want it for every player for Exmaple my name is not Joey Taylor its tell its my name is JT, and Sean Banks SB, and for every player like his name.
Reply
#5

use the code

pawn Код:
retFirstLetters(playername[]);
You just copy the code that's why it doesn't work in other names.
Reply
#6

Thank you all, its works great!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)