02.03.2013, 17:05
(
Последний раз редактировалось Kevin FOx; 03.03.2013 в 11:41.
)
Hello...
I've in this code, something wierd, When i /setname anyone, it deletes the original file and creates new one.. i need help on adding the old '[pNPassword] from the old file to the new one!
I've in this code, something wierd, When i /setname anyone, it deletes the original file and creates new one.. i need help on adding the old '[pNPassword] from the old file to the new one!
pawn Код:
CMD:setname(playerid, params[])
{
new playerb ,string[128], string2[128], password[256], file[64], idx, idx2, idx3, idx4, text[MAX_PLAYER_NAME];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 4 && !Approve[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(Approve[playerid]) Approve[playerid] = 0;
if(sscanf(params, "us[24]", playerb, text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setname [playerid] [name]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
// Start of detecting space in name
new end, temp[32], temp2[32];
end = strfind(text, " ",true);
if(end != -1)
{
strmid(temp, text, 0, end);
format(temp, sizeof(temp), "%s_", temp);
strdel(text, 0, end);
strmid(temp2, text, 1, strlen(text));
format(text, 24, "");
strcat(text, temp, sizeof(temp));
strcat(text, temp2, sizeof(temp2));
}
// End of detecting space in name
format(string, sizeof(string), "AdmCmd: %s has changed %s's name to %s.", RPN(playerid), RPN(playerb), text);
format(string2, sizeof(string2), " Administrator %s has changed your name to {FF6347}%s{FFFFFF}, /changepass to avoid pass bug.", RPN(playerid), text);
format(file, sizeof(file), "users/%s.ini", text);
if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Name already in use.");
idx = PlayerInfo[playerb][pBiz];
idx2 = PlayerInfo[playerb][pHouse];
idx3 = PlayerInfo[playerb][pVBiz];
idx4 = PlayerInfo[playerb][pVHouse];
idx5 = PlayerInfo[playerb][pGarage];
idx5 = PlayerInfo[playerb][pVGarage];
format(file, sizeof(file), "users/%s.ini", RPNU(playerb));
//format(password, sizeof(password), "%s", dini_Get(file, "NPassword"));
dini_Remove(file);
SetPlayerName(playerb, text);
PlayerInfo[playerb][pBiz] = idx;
format(file, sizeof(file), "users/%s.ini", RPNU(playerb));
//format(password, sizeof(password), "%s", dini_Get(file, "NPassword"));
// dini_Set(file, "NPassword", dini_Get(file, "NPassword"));
dini_Create(file);
SaveChar(playerb);
SendAdminMessage(COLOR_DARKRED, 1, string);
SendClientMessage(playerb, COLOR_WHITE, string2);
if(idx)
{
format(BizInfo[idx][bOwner], 32, "%s", text);
format(string, sizeof(string), "Business of %s\nBusiness type: %s\n%s", BizInfo[idx][bOwner], RBT(idx), RBS(idx));
UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
}
if(idx2)
{
idx = idx2;
format(HouseInfo[idx][hOwner], 32, "%s", text);
format(string, sizeof(string), "House of %s\nHouse Type: %s\nStatus: %s", HouseInfo[idx][hOwner], HT(idx), RHS(idx));
UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
}
if(idx3)
{
idx = idx3;
format(BizInfo[idx][bOwner], 32, "%s", text);
format(string, sizeof(string), "Business of %s\nBusiness type: %s\n%s", BizInfo[idx][bOwner], RBT(idx), RBS(idx));
UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
}
if(idx4)
{
idx = idx4;
format(HouseInfo[idx][hOwner], 32, "%s", text);
format(string, sizeof(string), "House of %s\nHouse Type: %s\nStatus: %s", HouseInfo[idx][hOwner], HT(idx), RHS(idx));
UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
}
if(idx5)
{
idx = idx5;
format(GarageInfo[idx][gOwner], 32, "%s", text);
format(string, sizeof(string), "Garage of %s\nGarage Size: %s\n%s", GarageInfo[idx][gOwner], GT(idx), GTT(idx));
UpdateDynamic3DTextLabelText(GarageInfo[idx][gText], COLOR_WHITE, string);
}
if(idx6)
{
idx = idx6;
format(GarageInfo[idx][gOwner], 32, "%s", text);
format(string, sizeof(string), "Garage of %s\nGarage Size: %s\n%s", GarageInfo[idx][gOwner], GT(idx), GTT(idx));
UpdateDynamic3DTextLabelText(GarageInfo[idx][gText], COLOR_WHITE, string);
}
return 1;
}