PDA

View Full Version : [Question]First player name letter.


FuznesS
02/11/2012, 12:57 PM
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..

Nirzor
02/11/2012, 01:00 PM
i think it will be hard but you can use variables to detect it and make it :D

ReneG
02/11/2012, 01:10 PM
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
printf("%s",retFirstLeters("Sean_Banks"));
prints outSB
The name HAS to be in roleplay format for it to work though.

FuznesS
02/11/2012, 01:11 PM
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
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.

JaKe Elite
02/11/2012, 01:26 PM
use the code


retFirstLetters(playername[]);


You just copy the code that's why it doesn't work in other names.

FuznesS
02/11/2012, 01:35 PM
Thank you all, its works great!!