07.01.2018, 12:27
I have a command that is used to set a players name based on YINI saving system :-
It works fine at first, i have tested relogging with it multiple times but when i turn off the server and then re start it, it shows a wrong password error according to my registration and login system. I would love any kind of help i can get about how it should be fixed.
PHP код:
CMD:setname (playerid, params[])
{
new id, name[25],str[120];
if(PInfo[playerid][Admin] < 7) return SendClientMessage(playerid, RED,"[ERROR]: {FFFFFF}You do not have the privilleges to perform this command.");
if(sscanf(params, "us[25]", id, name)) return SendClientMessage(playerid, TOMATO, "[USAGE]: {FFFFFF}/setname [playerid/PartOfName] [name]");
if(strlen(name) < 3)return SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}The length of the name shouldn't be lower than 3!");
if(strlen(name) > MAX_PLAYER_NAME)return SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}The length of name exceeds the limit!");
new file[64];
format(file, sizeof(file), "/Users/%s.ini", name);
if (fexist(file)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}That name is already registered in the database!");
fremove(UserPath(id));
SetPlayerName(id,name);
SaveStats(id);
return 1;
}