SA-MP Forums

Go Back   SA-MP Forums > SA-MP Server > Server Support

Reply
 
Thread Tools Display Modes
Old 12/08/2017, 08:05 PM   #1
isorinis
Little Clucker
 
Join Date: Jun 2017
Posts: 7
Reputation: 0
Default Help again

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
isorinis is offline   Reply With Quote
Old 12/08/2017, 08:08 PM   #2
StefaNO [ITA]
Little Clucker
 
Join Date: Apr 2009
Posts: 13
Reputation: 1
Default Re: Help again

Post your "saving" system here
StefaNO [ITA] is online now   Reply With Quote
Old 12/08/2017, 08:16 PM   #3
H4RR1s
Big Clucker
 
H4RR1s's Avatar
 
Join Date: Jul 2017
Location: Los Santos, The Federal Bureau of Investigation HQ
Posts: 91
Reputation: 41
Default Re: Help again

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.
__________________
Code:
public OnPlayerConnect(playerid)
{
          Sendclientmessage(Playerid, -1, "TREPASSER ALERT, YOU WILL BE TERMINATED");
           Ban(Playerid);
           Return 1;
}

Always +Rep'ing back who ever +Reps me
H4RR1s is online now   Reply With Quote
Old 13/08/2017, 02:41 PM   #4
isorinis
Little Clucker
 
Join Date: Jun 2017
Posts: 7
Reputation: 0
Default Re: Help again

I'm using enums
isorinis is offline   Reply With Quote
Old 14/08/2017, 11:50 AM   #5
isorinis
Little Clucker
 
Join Date: Jun 2017
Posts: 7
Reputation: 0
Default Re: Help again

my saving code
public OnGameModeExit()
{
foreach(Player, playerid)
{
if(AccountInfo[playerid][LoggedIn] == 2)
{
SavePlayerData(playerid);
SaveVehicle(playerid);
}
}
isorinis is offline   Reply With Quote
Old 14/08/2017, 02:17 PM   #6
10MIN
Little Clucker
 
10MIN's Avatar
 
Join Date: Jun 2017
Location: GetPlayerPos( GetIDFromName("10MIN") ,x,y,z);
Posts: 49
Reputation: 3
Default Re: Help again

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

Also you should show us SavePlayerData and SaveVehicle functions
__________________

10MIN is offline   Reply With Quote
Old 14/08/2017, 03:39 PM   #7
isorinis
Little Clucker
 
Join Date: Jun 2017
Posts: 7
Reputation: 0
Default Re: Help again

I have playerdisconnect() function it saves almost everything fine after logout but not money skin id my saveplayerdata() function
PHP Code:
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,"",""); 
isorinis is offline   Reply With Quote
Old 14/08/2017, 03:50 PM   #8
isorinis
Little Clucker
 
Join Date: Jun 2017
Posts: 7
Reputation: 0
Default Re: Help again

my OnPlayerDisconnect() function
PHP Code:
 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); 
isorinis is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 11:50 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.