Old account dont gets deleted
#1

Why the old account dont gets deleted if i change someones name ?

Quote:

if(strcmp(cmd, "/changename", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new tmpp[256];
tmpp = strtok(cmdtext, idx);
if(!strlen(tmpp))
{
SendClientMessage(playerid, COLOR_DBLUE, "Correct SYNTAX: /changename [playerid] [new nick]");
return 1;
}
giveplayerid = strval(tmpp);
tmp = strtok(cmdtext, idx);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(giveplayerid))
{
SetPlayerName(giveplayerid, tmp);
if(fexist(tmpp))
format(tmpp,64,"%s.ini",giveplayer);
fremove(tmpp);
format(string, sizeof(string), "AdmCMD: %s(%i) has changed Your name to %s", sendername, playerid, tmp);
SendClientMessage(giveplayerid, COLOR_DBLUE, string);
format(string, sizeof(string), "AdmCMD: You have changed ID %i's name to %s", giveplayerid, tmp);
SendClientMessage(playerid, COLOR_DBLUE, string);
format(string, 256, "AdmWarning: %s has changed %s's his name to %s.", sendername,giveplayer, tmp);
ABroadCast(COLOR_YELLOW,string,1);
}
else
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_RED, string);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You do not have permission to use that command!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");
}
return 1;
}

Reply
#2

Because you change the name of "giveplayer" before you remove It.
Reply
#3

Quote:
Originally Posted by mavtias
Because you change the name of "giveplayer" before you remove It.
if(fexist(tmpp))
fremove(tmpp);
format(tmpp,64,"%s.ini",giveplayer);

it must so then or ?
Reply
#4

Quote:
Originally Posted by ArTisT
Quote:
Originally Posted by mavtias
Because you change the name of "giveplayer" before you remove It.
if(fexist(tmpp))
fremove(tmpp);
format(tmpp,64,"%s.ini",giveplayer);

it must so then or ?
fremove(tmpp); BEFORE you CHANGE their name.


pawn Код:
if(fexist(tmpp))
        format(tmpp,64,"%s.ini",giveplayer);
        fremove(tmpp); // Remove their userfile before changing their name.
        SetPlayerName(giveplayerid, tmp); // Change the name After you removed their userfile. Since you change It a millisecond after the file Is removed It wont hurt nobody.
And just a tip, you forgot to create a file for their new name.
And I haven't looked up If you can rename a file, I think there's a include for that somewhere. That'd be better and easier.
Reply
#5

Код:
SetPlayerName(giveplayerid, tmp);
format(tmpp,64,"%s.ini",giveplayer);
if(fexist(tmpp))
	fremove(tmpp);
Reply
#6

Tried its still doubeling the account and dont removing old one..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)