22.04.2015, 18:19
Hey, I have a little problem in Rename CMD , it changes name and all stats and everything but it create new account and move all stats to it like
OLDname: Test
NewName: Test123
Both of them are now on database, i want to rename Test to Test123 without creating New Account file
OLDname: Test
NewName: Test123
Both of them are now on database, i want to rename Test to Test123 without creating New Account file
Код:
CMD:setname(playerid, params[])
{
new string[128], tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setname [playerid] [new name]");
if (udb_Exists(tmp2)) return SendClientMessage(playerid,red,"This User Name Is Taken!");
new player1 = strval(tmp);
new OldName[24],str[128];
GetPlayerName(player1,OldName,sizeof(OldName));
format(str,sizeof(str),"admin/users/%s.sav",OldName);
udb_RenameUser(OldName,tmp2);
format(str,sizeof(str),"admin/users/%s.sav",params);
SetPlayerName(player1,tmp2);
format(string, sizeof(string),"Admin ''%s'' Has Changed Your Name To '%s'",PlayerName2(playerid), tmp2);
return SendClientMessage(player1,yellow,string);
}

