03.02.2017, 16:19
Hey, I'm pretty new on scripting and I've some questions about a recent command I've made with yini.
I've tried to make a /changename cmd but I can't get rid of the old files of the player and the public message to all doesn't shows the "old name" like (" has changed his name to "new name"!).
If some experienced guy can help me I will be thankful with a rep!
Regards, rakinz.
I've tried to make a /changename cmd but I can't get rid of the old files of the player and the public message to all doesn't shows the "old name" like (" has changed his name to "new name"!).
Код:
CMD:changename(playerid,params[]) { new oldname[128], newname[128], string[90]; if(sscanf(params,"s[128]", newname)) return SendClientMessage(playerid,COLOR_LIGHTBLUE, "Usage: /Changename [new name]"); new filestring[128]; new filestring2[128]; format(filestring2, sizeof(filestring2), "/Users/%s.ini", oldname); format(filestring, sizeof(filestring), "/Users/%s.ini", newname); if(fexist(filestring)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: The new name you've chosen is already taken"); format(string, sizeof(string), "%s has changed his name to %s!" ,oldname, newname); SetPlayerName(playerid, newname); SendClientMessageToAll(COLOR_WHITE, string); frename(filestring2, filestring); new INI:File = INI_Open(filestring); INI_SetTag(File, "data"); new str[50]; format(str, sizeof str, "/Users/%s.ini", oldname); INI_RemoveEntry(File,str); INI_Close(File); return 1; }
Regards, rakinz.