SA-MP Forums Archive
SetPlayerName - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetPlayerName (/showthread.php?tid=461727)



SetPlayerName - Don_Cage - 03.09.2013

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.


Re: SetPlayerName - Pottus - 03.09.2013

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.


Re : SetPlayerName - Matnix - 03.09.2013

If you still don't save it..


Re: SetPlayerName - Don_Cage - 03.09.2013

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


Re: SetPlayerName - Pottus - 03.09.2013

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.


Re: SetPlayerName - Don_Cage - 03.09.2013

Thank you for the help. +rep