#1

How can i change a player's name without him/her losing his/her current data/stats?
e.g
/ask Can u change my name to Pig99?
*[Question]Horse99:Can u change my name to Pig99?(my /ask command shows the question to the online admins)

So /changename [playerid] [New Name]
Reply
#2

You have to change the name in your database / user storage too.
Reply
#3

I want to change his name via a command without him/her loosing their status/data.
+Without clicking his .ini
Reply
#4

I'm busy IRL < Take these basically all you need


Код:
new string[128], giveplayerid;
new playername[MAX_PLAYER_NAME];				
SetPlayerName(giveplayerid, newname);
OnPlayerStatsUpdate(giveplayerid);

				format(newname, sizeof(newname), "users/%s.ini", playername);
				fremove(newname);

				if(doesAccountExist(playername))  // If it doesn't get removed, blank the file with write io and check its length when a player attempts to authenticate (it'll be 0)
				{
					new File: BlankTheFile = fopen(newname, io_write);
					SendClientMessageEx(playerid, COLOR_GRAD2, "The old account couldn't be removed completely (it's been blanked for future use).");
					fclose(BlankTheFile);
Reply
#5

Change the filename of the .ini within your script.
Since frename doesnt exist, use both fwrite and fread.
fread the old user file and fwrite the new user file. Afterwards delete the old one.

See the wiki for reference about fread and fwrite
Reply
#6

----------------------
Reply
#7

Thank you all .
Akira <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)