11.11.2013, 15:28
Problem is that /changename replace old account name.ini with new one newname.ini but when you login you need to register,house-biz-cars are fine but "New" replaced account is same inside level,house,car everything even password is same inside of renamed account but when i login it ask me to register and when i register it replaces whole name.ini file with complete fresh one...
pawn Code:
if (strcmp(cmd, "/changename", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(CanChangeName[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, " [ERP-Info] - For security reasons, you need to authorize the name change first! (/account)");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changename [NewName]");
return 1;
}
if(PlayerInfo[playerid][pShiftName] == 0 && GetPlayerMoney(playerid) < 20000) return SendClientMessage(playerid, COLOR_GREY, " [ERP-Info] - You do not have enough money! [20,000$]");
if(ChangedName[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, " [ERP-Info] - You have Changed Your name, Now Relog if you want to change it again");
if(!IsPlayerInRangeOfPoint(playerid, 3, 1407.2980,-1912.8668,1227.8960) && PlayerInfo[playerid][pShiftName] == 0) return SendClientMessage(playerid, COLOR_GREY, "[ERP-Info] - You are not at the City Hall Desk, or you have a Free Changename!");
format(string, sizeof(string), "LARP/Users/%s.ini", tmp);
if(!fexist(string))
{
PlayerInfo[playerid][pChanged] = 1;
OnPlayerUpdateEx(playerid);
SetPlayerName(playerid, tmp);
PlayerInfo[playerid][pChanged] = 0;
format(string, sizeof(string)," [ERP-Info] - Your have successfuly changed your name to %s", tmp);
SendClientMessage(playerid, COLOR_SEA, string);
new housekey = PlayerInfo[playerid][pPhousekey];
new bizzkey = PlayerInfo[playerid][pPbiskey];
new carkey1 = PlayerInfo[playerid][pPcarkey];
new carkey2 = PlayerInfo[playerid][pPcarkey2];
new carkey3 = PlayerInfo[playerid][pPcarkey3];
if(PlayerInfo[playerid][pShiftName] == 0)
{
SafeGivePlayerMoney(playerid, -20000);
}
format(string, sizeof(string),"%s",tmp);
if(PlayerInfo[playerid][pPhousekey] != 9999)
{
strmid(HouseInfo[housekey][hOwner],string,0,strlen(string),255);
OnPropUpdate(1,housekey);
OnPropTextdrawUpdate(1, housekey);
SendClientMessage(playerid, TEAM_GROVE_COLOR," [Changename Info] - House ownership changed successfuly!");
}
if(PlayerInfo[playerid][pPbiskey] != 9999)
{
strmid(BizzInfo[bizzkey][bOwner],string,0,strlen(string),255);
OnPropUpdate(2,bizzkey);
OnPropTextdrawUpdate(2, bizzkey);
SendClientMessage(playerid, TEAM_GROVE_COLOR," [Changename Info] - Business ownership changed successfuly!");
}
if(PlayerInfo[playerid][pPcarkey] != 9999)
{
strmid(CarInfo[carkey1][cOwner],string,0,strlen(string),255);
OnPropUpdate(4,carkey1);
SendClientMessage(playerid, TEAM_GROVE_COLOR," [Changename Info] - First Vehicle ownership changed successfuly!");
}
if(PlayerInfo[playerid][pPcarkey2] != 9999)
{
strmid(CarInfo[carkey2][cOwner],string,0,strlen(string),255);
OnPropUpdate(4,carkey2);
OnPropTextdrawUpdate(1, housekey);
SendClientMessage(playerid, TEAM_GROVE_COLOR," [Changename Info] - Second Vehicle ownership changed successfuly!");
}
if(PlayerInfo[playerid][pPcarkey3] != 9999)
{
strmid(CarInfo[carkey3][cOwner],string,0,strlen(string),255);
OnPropUpdate(4,carkey3);
OnPropTextdrawUpdate(1, housekey);
SendClientMessage(playerid, TEAM_GROVE_COLOR," [Changename Info] - Third Vehicle ownership changed successfuly!");
}
format(string, sizeof(string), "LARP/Users/%s.ini", sendername);
fremove(string);
OnPlayerUpdateEx(playerid);
SendClientMessage(playerid, COLOR_RED," [Changename Info] - Dont forget your name, relog and rename it in SAMP name box");
ChangedName[playerid] = 1;
if(PlayerInfo[playerid][pShiftName] == 1) { PlayerInfo[playerid][pShiftName] = 0; SendClientMessage(playerid, COLOR_GREY, " [Changename Info] - You used your Shiftname Rights!"); }
}
else return SendClientMessage(playerid, COLOR_GREY," That name is taken already!");
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has changed his name to %s",d,m,y,h,mi,s,sendername,tmp);
ABroadCast(COLOR_LIGHTRED, string, 5);
AdminLog(string);
LoginLog(string);
}
return 1;
}