Help again
#1

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
Reply
#2

Post your "saving" system here
Reply
#3

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.
Reply
#4

I'm using enums
Reply
#5

my saving code
public OnGameModeExit()
{
foreach(Player, playerid)
{
if(AccountInfo[playerid][LoggedIn] == 2)
{
SavePlayerData(playerid);
SaveVehicle(playerid);
}
}
Reply
#6

It don't save because you save it when the server is shutting down... Put this on OnPlayerDisconnect(playerid):
PHP код:
OnPlayerDisconnect(playerid)
{
     if(
AccountInfo[playerid][LoggedIn] == 2)
     {
          
SavePlayerData(playerid);
          
SaveVehicle(playerid);
     }
     return 
1;

Also you should show us SavePlayerData and SaveVehicle functions
Reply
#7

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], iFloatP_HealthFloatP_ArmourFloatXFloatYFloatZWeapons[13][2];
    
GetPlayerPos   (playeridXYZ);
    
GetPlayerHealth(playeridP_Health);
    
GetPlayerArmour(playeridP_Armour);
    
mysql_format(DbHandle,Queryssizeof(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], XYZGetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), AccountInfo[playerid][Experience], AccountInfo[playerid][MoneyHave], AccountInfo[playerid][Gender], AccountInfo[playerid][Skin], AccountInfo[playerid][AutoLoginPlayer], P_HealthP_ArmourAccountInfo[playerid][VIPLevel], AccountInfo[playerid][VIPDaysLeft], AccountInfo[playerid][CitySelection], PlayerNameEx(playerid));
    
mysql_pquery(DbHandle,Querys,"","");
    
format(Querysizeof(Query), "UPDATE ServerPlayers SET ");
    for(
0MAX_INVENTORY_SLOTS++)
    {
        
format(Queryssizeof(Querys), "InventoryItemID_%d = %d,"iInventorySystem[playerid][i][ItemID]);
        
strcat(QueryQuerys);
        
format(Queryssizeof(Querys), "InventoryItemAmmount_%d = %d,"iInventorySystem[playerid][i][ItemAmmount]);
        
strcat(QueryQuerys);
    }
    for(
013++)
    {
        
GetPlayerWeaponData(playeridiWeapons[i][0], Weapons[i][1]);
        
format(Queryssizeof(Querys), "WeaponID_%d = %d,"iWeapons[i][0]);
        
strcat(QueryQuerys);
        
format(Queryssizeof(Querys), "WeaponAmmo_%d = %d,"iWeapons[i][1]);
        
strcat(QueryQuerys);
    }
    
Query[strlen(Query)-1] = ' ';
    
mysql_format(DbHandle,Queryssizeof(Querys), " WHERE User = '%e'"PlayerNameEx(playerid));
    
strcat(QueryQuerys);
    
mysql_pquery(DbHandle,Query,"","");
    
mysql_format(DbHandle,Queryssizeof(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,Queryssizeof(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,Queryssizeof(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,Queryssizeof(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,"",""); 
Reply
#8

my OnPlayerDisconnect() function
PHP код:
 public OnPlayerDisconnect(playeridreason)
{
    if(
AccountInfo[playerid][LoggedIn] == 2
    {
        if(
Cuffed[playerid] == 1)
        {
            
AccountInfo[playerid][JailSeconds] += 60 60
            
AccountInfo[playerid][Warns]        ++;         
            
            if(
AccountInfo[playerid][Warns] >= 10)
            {
                
BanPlayer(-1playerid"Reloging On Catch");
            }
        }
    
        
SavePlayerData(playerid); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)