SetPlayerName
#1

Hi, I've read some on the wiki and I saw this. https://sampwiki.blast.hk/wiki/SetPlayerName
Please correct me if I'm wrong, but it's possible to set your name without any changes in your "saved name"
Example, if my name is test_tester I can change it to test_testing and when I relog my name will still be test_tester.
So my question is how I can "save" the name I'm using before I change in order to take that name back with just a simple command. So if I use maybe /undercover [new name] I want to be able to just use /offduty in order to get my normal name back. How would I do this?

And again.. I might be wrong about this all so please correct me if I am.
Reply
#2

Unless you explicitly rename the player in the player files it shouldn't matter but you'll have to watch how it saves as it might try and create a rouge user account you'll have keep their real name in a variable then reference that for your real player name.
Reply
#3

If you still don't save it..
Reply
#4

Well then I know it works but how do I get my saved name back without the need of relog?
Reply
#5

Very basic to start with use something like this then save the players realname when they log in

pawn Код:
new RealName[MAX_PLAYERS][MAX_PLAYER_NAME];

stock SetRealName(playerid)
{
    GetPlayerName(playerid, RealName[playerid], MAX_PLAYER_NAME);
    return 1;
}

CMD:restorename(playerid, arg[])
{
    SetPlayerName(playerid, RealName[playerid]);
    return 1;
}
You'll need to reference RealName[playerid] when generating an ini reference for example and anywhere else specific player names are used and you require the players real name.
Reply
#6

Thank you for the help. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)