08.06.2016, 21:06
So i made this /rename command. It works good but i have one problem. It changes player's name and put it in file where other users are. Problem is it won't delete old account. How can i fix this??
This is my stock frename
I don't see problem here, or it is maybe somewhere else\
EDIT: This is stock fcopy
This is my stock frename
PHP код:
stock frename(oldname[], newname[])
{
if(!fexist(oldname)) return false;
fremove(newname);
if(!fcopy(oldname, newname)) return false;
fremove(oldname);
return 1;
}
EDIT: This is stock fcopy
PHP код:
stock fcopy(oldname[], newname[])
{
new File:ohnd, File:nhnd;
if (!fexist(oldname)) return false;
ohnd=fopen(oldname,io_read);
nhnd=fopen(newname,io_write);
new buf2[1];
new i;
for (i=flength(ohnd);i>0;i--)
{
fputchar(nhnd, fgetchar(ohnd, buf2[0],false),false);
}
fclose(ohnd);
fclose(nhnd);
return true;
}