Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] [HELP] GetplayerName Initial Firstname then full Lastname.

 
  • 0 Vote(s) - 0 Average
Pawn [HELP] GetplayerName Initial Firstname then full Lastname.
TheAnimalKa
Offline

Burgershot Member
Posts: 6
Threads: 2
Joined: Apr 2021
Reputation: 0
Location: USA
#1
2021-04-21, 10:42 AM
Hello. Can somebody help me regarding getplayername that will only get the first initial of the firstname of the player then the full lastname. Example:

Full Name: Hello_Help

print >> H. Help.
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#2
2021-04-21, 04:09 PM (This post was last modified: 2021-04-21, 04:23 PM by Radical.)
Code:
new name[MAX_PLAYER_NAME], first_name[12], last_name[12];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
first_name[0] = name[0];
for(new i; i < strlen(name); i++) {
    if (name[i] == '_') {
        strcat(last_name, name[i+1]);
        strdel(first_name, 1, i-1);
        break;
    }
}
printf("Print >> %s. %s.", first_name, last_name);
[Image: Screenshot-66.png]
TheAnimalKa
Offline

Burgershot Member
Posts: 6
Threads: 2
Joined: Apr 2021
Reputation: 0
Location: USA
#3
2021-04-21, 05:13 PM
(2021-04-21, 04:09 PM)Radical Wrote:
Code:
new name[MAX_PLAYER_NAME], first_name[12], last_name[12];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
first_name[0] = name[0];
for(new i; i < strlen(name); i++) {
if (name[i] == '_') {
strcat(last_name, name[i+1]);
strdel(first_name, 1, i-1);
break;
}
}
printf("Print >> %s. %s.", first_name, last_name);
[Image: Screenshot-66.png]

Thanks, I solved it either way this is how I did it.

new
playersName[MAX_PLAYER_NAME]
;

GetPlayerName(playerid, playersName, sizeof(playersName));

format(playersName, sizeof(playersName), "%c. %s", playersName[0], playersName[strfind(playersName, "_") + 1]);
format(shitshit[playerid], 128, "%s", playersName);
Behemoth
Offline

Burgershot Member
Posts: 25
Threads: 4
Joined: Jan 2021
Reputation: 1
Location: Northern Ireland, UK
#4
2021-04-21, 10:24 PM
(2021-04-21, 05:13 PM)TheAnimalKa Wrote:
(2021-04-21, 04:09 PM)Radical Wrote:
Code:
new name[MAX_PLAYER_NAME], first_name[12], last_name[12];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
first_name[0] = name[0];
for(new i; i < strlen(name); i++) {
if (name[i] == '_') {
strcat(last_name, name[i+1]);
strdel(first_name, 1, i-1);
break;
}
}
printf("Print >> %s. %s.", first_name, last_name);
[Image: Screenshot-66.png]

Thanks, I solved it either way this is how I did it.

new
playersName[MAX_PLAYER_NAME]
;

GetPlayerName(playerid, playersName, sizeof(playersName));

format(playersName, sizeof(playersName), "%c. %s", playersName[0], playersName[strfind(playersName, "_") + 1]);
format(shitshit[playerid], 128, "%s", playersName);

bro wtf is shitshit lmao
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode