GetPlayerFirstName(playerid) -
iGetty - 25.03.2012
The title says it all.
How could I find a players first name on their name string?
Say I have:
Test_Name
How could I get it to just send on a text - Welcome back, Test.
Instead of Welcome back, Test_Name.
Thanks.
Re: GetPlayerFirstName(playerid) -
Babul - 25.03.2012
do it with sscanf2 ^^
parse FirstName, search for the '_', the second name is a {quiet} parameter, so aSecondName is not required:
pawn Code:
sscanf(PlayerName,"s[24]'_'{s[24]}",FirstName);
i <3 the '_' search function, maybe the p<_> delimeter could do that too..
Re: GetPlayerFirstName(playerid) -
iGetty - 25.03.2012
Mate, thanks for that.
BUT
It's confusing looking! -.- :')
Could you possibly explain it to me a little more? :3 like, maybe put it in a stock? D:
Thanks! <3
Re: GetPlayerFirstName(playerid) - rjjj - 25.03.2012
You can also use
strdel to delete part of the player's name

:
pawn Code:
stock GetPlayerFirstName(playerid)
{
new NickName[MAX_PLAYER_NAME];
GetPlayerName(playerid, NickName, MAX_PLAYER_NAME);
strdel(NickName, strfind(NickName, "_"), strlen(NickName));
return NickName;
}
I hope that i have helped

.
Re: GetPlayerFirstName(playerid) -
iGetty - 25.03.2012
That looks like it only deletes the '_' :O
Does it delete all after the _ and the _ too? :3
Re: GetPlayerFirstName(playerid) - rjjj - 25.03.2012
Quote:
Originally Posted by iGetty
Does it delete all after the _ and the _ too? :3
|
Yes, it does

.
I hope that i have helped

.
Re: GetPlayerFirstName(playerid) -
iGetty - 25.03.2012
You have helped LOADS!
Thanks and both have been repped!