09.06.2016, 05:01
You can do it easilier.
Let's take a example with explications.
Then do some verefications like
Remove the old file and attribute the new name.
Put new parameters like a new player who is regestering on your server.
Dont copy/paste this code. He comes from my gamemode (my /name commands) and may not work on yours because I didn't put the whole code.
Let's take a example with explications.
PHP код:
if(sscanf(params,"us[25]", target, nName)) return SendClientMessage(playerid, -1, "/name [id_joueur] [new_name]");
PHP код:
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, -1, "This player is not connected.");
format(PATHT, 50, "/Players/%s.ini", nName);
if(fexist(PATHT)) return SendClientMessage(playerid, -1, "Name already taken");
PHP код:
fremove(UserPath(target));
SetPlayerName(target, nName);
PHP код:
new INI:File = INI_Open(UserPath(target));
INI_WriteInt(File,"MDP", PlayerInfo[target][pMDP]);
INI_WriteInt(File,"Admin", PlayerInfo[target][pAdminlvl]);
INI_WriteInt(File,"Cash", PlayerInfo[target][pCash]);
INI_WriteInt(File,"Score", PlayerInfo[target][pScore]);
INI_Close(File);