Hi all i need help again. Problem with saving after player logout he lost some data from database after registration he gets 100k money when he back after logout he lost his 100k and he have 0 money i think its something wrong with saving but i dont know where the problem is
Do you have any emuns in your script or w/e is your saving system.
If you dont know what are we talking about them close your server or hire a scripter.
It don't save because you save it when the server is shutting down... Put this on OnPlayerDisconnect(playerid):
I have playerdisconnect() function it saves almost everything fine after logout but not money skin id my saveplayerdata() function
PHP код:
stock SavePlayerData(playerid)
{
new Query[2500], Querys[700], i, Float: P_Health, Float: P_Armour, Float: X, Float: Y, Float: Z, Weapons[13][2];
GetPlayerPos (playerid, X, Y, Z);
GetPlayerHealth(playerid, P_Health);
GetPlayerArmour(playerid, P_Armour);
mysql_format(DbHandle,Querys, sizeof(Querys), "UPDATE ServerPlayers SET AdminLevel = %d, AdminDaysLeft = %d, Pos_X = %f, Pos_Y = %f,\
Pos_Z = %f, Interior = %d, VirtualWorld = %d, Experience = %d, Money = %f, Gender = %d, Skin = %d, \
AutoLoginPlayer = %d, Online = 0, Health = %f, Armour = %f, VIPLevel = %d, VIPDaysLeft = %d, CitySelection = %i WHERE User = '%e'",
AccountInfo[playerid][AdminLevel], AccountInfo[playerid][AdminDaysLeft], X, Y, Z, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), AccountInfo[playerid][Experience], AccountInfo[playerid][MoneyHave], AccountInfo[playerid][Gender], AccountInfo[playerid][Skin], AccountInfo[playerid][AutoLoginPlayer], P_Health, P_Armour, AccountInfo[playerid][VIPLevel], AccountInfo[playerid][VIPDaysLeft], AccountInfo[playerid][CitySelection], PlayerNameEx(playerid));
mysql_pquery(DbHandle,Querys,"","");
format(Query, sizeof(Query), "UPDATE ServerPlayers SET ");
for(i = 0; i < MAX_INVENTORY_SLOTS; i ++)
{
format(Querys, sizeof(Querys), "InventoryItemID_%d = %d,", i, InventorySystem[playerid][i][ItemID]);
strcat(Query, Querys);
format(Querys, sizeof(Querys), "InventoryItemAmmount_%d = %d,", i, InventorySystem[playerid][i][ItemAmmount]);
strcat(Query, Querys);
}
for(i = 0; i < 13; i ++)
{
GetPlayerWeaponData(playerid, i, Weapons[i][0], Weapons[i][1]);
format(Querys, sizeof(Querys), "WeaponID_%d = %d,", i, Weapons[i][0]);
strcat(Query, Querys);
format(Querys, sizeof(Querys), "WeaponAmmo_%d = %d,", i, Weapons[i][1]);
strcat(Query, Querys);
}
Query[strlen(Query)-1] = ' ';
mysql_format(DbHandle,Querys, sizeof(Querys), " WHERE User = '%e'", PlayerNameEx(playerid));
strcat(Query, Querys);
mysql_pquery(DbHandle,Query,"","");
mysql_format(DbHandle,Querys, sizeof(Querys), "UPDATE ServerPlayers SET TelphoneOn = %d, TelphoneBill = %f, TelphoneNumber = %d, TrationChannel = %d, MoneyInBank = %f, HaveBankAccount = %d, EnteredHouseID = %d, TelphoneContract = %d, TelphoneType = %d, MoneyInTelphone = %f, FuelInFuelTank = %f, FuelTypeInTank = %d WHERE User = '%e'",
AccountInfo[playerid][TelphoneOn], AccountInfo[playerid][TelphoneBill], AccountInfo[playerid][TelphoneNumber], AccountInfo[playerid][TrationChannel], AccountInfo[playerid][MoneyInBank], AccountInfo[playerid][HaveBankAccount], AccountInfo[playerid][EnteredHouseID], AccountInfo[playerid][TelphoneContract],
AccountInfo[playerid][TelphoneType], AccountInfo[playerid][MoneyInTelphone], AccountInfo[playerid][FuelInFuelTank], AccountInfo[playerid][FuelTypeInTank], PlayerNameEx(playerid));
mysql_pquery(DbHandle,Querys,"","");
mysql_format(DbHandle,Querys, sizeof(Querys), "UPDATE ServerPlayers SET Job = %d, JobPayBonus = %f, JobMinimalPay = %f, MustJobContract = %d, WorkTimeInJob = %d, JobRank = %d, JobWarns = %d, JobLeadID = %d, JobLeadAsistant = %d, JobSkin = %d, WearJobSkin = %d, JailedSeconds = %d, Warns = %d, HaveCategorysLicense = %d, HaveWeaponLicense = %d, HaveBCategoryLicense = %d WHERE User = '%e'",
AccountInfo[playerid][Job], AccountInfo[playerid][JobPayBonus], AccountInfo[playerid][JobMinimalPay], AccountInfo[playerid][MustJobContract], AccountInfo[playerid][WorkTimeInJob], AccountInfo[playerid][JobRank], AccountInfo[playerid][JobWarns], AccountInfo[playerid][JobLeadID], AccountInfo[playerid][JobLeadAsistant], AccountInfo[playerid][JobSkin], AccountInfo[playerid][WearJobSkin], AccountInfo[playerid][JailSeconds], AccountInfo[playerid][Warns],
AccountInfo[playerid][HaveCategorysLicense], AccountInfo[playerid][HaveWeaponLicense], AccountInfo[playerid][HaveBCategoryLicense], PlayerNameEx(playerid));
mysql_pquery(DbHandle,Querys,"","");
mysql_format(DbHandle,Querys, sizeof(Querys), "UPDATE ServerPlayers SET HaveCigarettes = %d, LeftGas = %d, CheatWarns = %d, HaveACategoryLicense = %d, HaveGlassesOn = %d, CrimeLevel = %d, HaveCredits = %d, Cuffed = %d, gMember = %d, PlayerEmail = '%e', AdminWarns = %d, MutedMinutes = %d, WeaponsSkillProc = %d, TimeWorkingInJob = %d, JobLastLoginDay = %d WHERE User = '%e'",
AccountInfo[playerid][HaveCigarettes], AccountInfo[playerid][LeftGas], AccountInfo[playerid][CheatWarns], AccountInfo[playerid][HaveACategoryLicense], AccountInfo[playerid][HaveGlassesOn], GetPlayerTWanted(playerid), AccountInfo[playerid][HaveCredits],
Cuffed[playerid], AccountInfo[playerid][gMember], AccountInfo[playerid][PlayerEmail], AccountInfo[playerid][AdminWarns], AntiCheatSystem[playerid][MutedMinutes], AccountInfo[playerid][WeaponsSkillProc], AccountInfo[playerid][TimeWorkingInJob], AccountInfo[playerid][JobLastLoginDay], PlayerNameEx(playerid));
mysql_pquery(DbHandle,Querys,"","");
mysql_format(DbHandle,Querys, sizeof(Querys), "UPDATE ServerPlayers SET AlreadyPicketPay = %d, HaveSpecialJobAbility = %d, LoginWithOneIP = %d, HaveTaxiLicense = %d WHERE User = '%e'", AccountInfo[playerid][AlreadyPicketPay], AccountInfo[playerid][HaveSpecialJobAbility], AccountInfo[playerid][LoginWithOneIP], AccountInfo[playerid][HaveTaxiLicense], PlayerNameEx(playerid));
mysql_pquery(DbHandle,Querys,"","");