24.02.2015, 12:14
Player file is not saving.. Giving empty ini file.
STOCK FUNCTION:
With best regards Scrillex.
pawn Код:
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Authenticate", "Please enter a password below in order to register.", "Register", "Quit");
new HashPass[129], sHolder[MAX_PLAYER_NAME];
WP_Hash(HashPass, sizeof(HashPass), inputtext);
PlayerInfo[playerid][pPass] = HashPass;
PlayerInfo[playerid][pHouseOwner] = 999;
PlayerInfo[playerid][pBussinesOwner] = 999;
PlayerInfo[playerid][pCarOwner] = 999;
PlayerInfo[playerid][pMaskNumber] = random(1000000 + 2500000);
PlayerInfo[playerid][pPhoneNumber] = random(1000000 + 2500000);
PlayerInfo[playerid][pBankCardNumber]= random(100000000 + 25000000);
PlayerInfo[playerid][pBankCardPin]= random(1000 + 2500);
PlayerInfo[playerid][pLevel] = 1;
format(sHolder, sizeof(sHolder), "None");
PlayerInfo[playerid][pFactionRank] = sHolder;
SavePlayer(playerid);
TogglePlayerSpectating(playerid, false);
SetSpawnInfo(playerid, 0, 299, 1740.6188, -1949.9669, 14.1172, 176.0951, 0, 0, 0, 0, 0, 0);
SetTimerEx("LevelTimer", 1800000, true, "i", playerid);
SpawnPlayer(playerid);
}
}
pawn Код:
stock SavePlayer(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
INI_WriteString(File, "Password", PlayerInfo[playerid][pPass]);
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
INI_WriteInt(File,"StreetRespect",PlayerInfo[playerid][pStreetRespect]);
INI_WriteInt(File,"PhoneNumber",PlayerInfo[playerid][pPhoneNumber]);
INI_WriteInt(File,"BankCard",PlayerInfo[playerid][pBankCard]);
INI_WriteInt(File,"BankCardNumber",PlayerInfo[playerid][pBankCardNumber]);
INI_WriteInt(File,"Mask",PlayerInfo[playerid][pMask]);
INI_WriteInt(File,"MaskNumber",PlayerInfo[playerid][pMaskNumber]);
INI_WriteInt(File,"House",PlayerInfo[playerid][pHouseOwner]);
INI_WriteInt(File,"Car",PlayerInfo[playerid][pCarOwner]);
INI_WriteInt(File,"BackPack",PlayerInfo[playerid][pBackPack]);
INI_WriteInt(File,"Bussines",PlayerInfo[playerid][pBussinesOwner]);
INI_WriteInt(File,"Weed",PlayerInfo[playerid][pWeed]);
INI_WriteInt(File,"Crack",PlayerInfo[playerid][pCrack]);
INI_WriteInt(File,"Cocain",PlayerInfo[playerid][pCocain]);
INI_WriteInt(File,"BankCardPin",PlayerInfo[playerid][pBankCardPin]);
INI_WriteInt(File,"Helper",PlayerInfo[playerid][pHelper]);
INI_WriteInt(File,"Tester",PlayerInfo[playerid][pTester]);
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File,"Exp",PlayerInfo[playerid][pExp]);
INI_WriteInt(File,"SkinID",GetPlayerSkin(playerid));
INI_WriteInt(File,"ExpLeft",PlayerInfo[playerid][pExpLeft]);
INI_WriteInt(File,"FactionID",PlayerInfo[playerid][pFactionID]);
INI_WriteInt(File,"FactionTier",PlayerInfo[playerid][pFactionTier]);
INI_WriteString(File, "FactionRank",PlayerInfo[playerid][pFactionRank]);
INI_WriteInt(File, "BankMoney",PlayerInfo[playerid][pBankMoney]);
INI_WriteInt(File, "pPhone",PlayerInfo[playerid][pPhone]);
INI_WriteInt(File, "HandMoney",PlayerInfo[playerid][pHandMoney]);
return true;
}