24.06.2012, 19:20
Well, I ran into a huge problem. My stats won't save when player is disconnected. No changes take effect and what ever user accomplishes in-game, it's not saved. It saved on my Windows PC when I run it, but when I upload it on the server (Linux) it doesn't save. This is my code for saving stats:
And this is OnPlayerDisconnect callback
Please help me out, this is very important. I don't know what I am doing wrong :/
pawn Код:
public OnPlayerDataSave(playerid)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
if(GetPlayerCash(playerid) >= GetPlayerMoney(playerid))
{
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
}
else
{
new string[128];
format(string, sizeof(string), "[WARNING:] [%s (Leaving)] Money Out: $%d; Should Have (Server-Side): $%d.",GetPlayerNameEx(playerid),playerid,GetPlayerMoney(playerid),GetPlayerCash(playerid));
AdministratorMessage(COLOR_LIGHTRED, string,1);
HackLog(string);
}
if(CopOnDuty[playerid] == 0)
{
if(PlayerInfo[playerid][pRace] == 1)//Humans Saving Slots
{
for(new slot = 0; slot != 12; slot++)
{
new wep, ammo;
GetPlayerWeaponData(playerid, slot, wep, ammo);
if(wep != 0 && ammo != 0)
{
if(PlayerInfo[playerid][pGun1] == 0 && (slot == 0 || slot == 1)) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
else if(PlayerInfo[playerid][pGun2] == 0 && slot == 2) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
else if(PlayerInfo[playerid][pGun3] == 0 && (slot == 3 || slot == 4 || slot == 5 || slot == 6)) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
else if(PlayerInfo[playerid][pGun4] == 0 && (slot == 1 || slot == 4 || slot == 5 || slot == 6)) { PlayerInfo[playerid][pGun4] = wep; PlayerInfo[playerid][pAmmo4] = ammo; }
}
}
}
else//Vampires Saving Slots
{
for(new slot = 0; slot != 12; slot++)
{
new wep, ammo;
GetPlayerWeaponData(playerid, slot, wep, ammo);
if(wep != 0 && ammo != 0)
{
if(PlayerInfo[playerid][pGun1] == 0 && slot == 0) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
else if(PlayerInfo[playerid][pGun2] == 0 && slot == 1) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
else if(PlayerInfo[playerid][pGun3] == 0 && slot == 10) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
}
}
}
}
new string3[128];
format(string3, sizeof(string3), "Accounts/%s.ini", PlayerName(playerid));
new File: hFile = fopen(string3, io_write);
if (hFile)
{
new var[32];
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
format(var, 32, "GMLevel=%d\n",PlayerInfo[playerid][pGM]);fwrite(hFile, var);
format(var, 32, "DonateRank=%d\n",PlayerInfo[playerid][pDonateRank]);fwrite(hFile, var);
format(var, 32, "Registered=%d\n",PlayerInfo[playerid][pRegistered]);fwrite(hFile, var);
format(var, 32, "Sex=%d\n",PlayerInfo[playerid][pSex]);fwrite(hFile, var);
format(var, 32, "Race=%d\n",PlayerInfo[playerid][pRace]);fwrite(hFile, var);
format(var, 32, "Experience=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
format(var, 32, "Skin=%i\n",PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
format(var, 32, "PlayingHours=%d\n",PlayerInfo[playerid][pPlayingHours]);fwrite(hFile, var);
format(var, 32, "AllowedPayday=%d\n",PlayerInfo[playerid][pAllowedPayday]);fwrite(hFile, var);
format(var, 32, "Insurance=%d\n",PlayerInfo[playerid][pInsurance]);fwrite(hFile, var);
format(var, 32, "Faction=%d\n",PlayerInfo[playerid][pFaction]);fwrite(hFile, var);
format(var, 32, "Rank=%d\n",PlayerInfo[playerid][pRank]);fwrite(hFile, var);
format(var, 32, "HouseKey=%d\n",PlayerInfo[playerid][pHouseKey]);fwrite(hFile, var);
format(var, 32, "BizKey=%d\n",PlayerInfo[playerid][pBizKey]);fwrite(hFile, var);
format(var, 32, "SpawnPoint=%d\n",PlayerInfo[playerid][pSpawnPoint]);fwrite(hFile, var);
format(var, 32, "PhoneNumber=%d\n",PlayerInfo[playerid][pPhoneNumber]);fwrite(hFile, var);
format(var, 32, "PhoneC=%d\n",PlayerInfo[playerid][pPhoneC]);fwrite(hFile, var);
format(var, 32, "PhoneBook=%d\n",PlayerInfo[playerid][pPhoneBook]);fwrite(hFile, var);
format(var, 32, "ListNumber=%d\n",PlayerInfo[playerid][pListNumber]);fwrite(hFile, var);
format(var, 32, "Donator=%d\n",PlayerInfo[playerid][pDonator]);fwrite(hFile, var);
format(var, 32, "Job=%d\n",PlayerInfo[playerid][pJob]);fwrite(hFile, var);
format(var, 32, "Ajailed=%d\n",PlayerInfo[playerid][pAjailed]);fwrite(hFile, var);
format(var, 32, "JailTime=%d\n",PlayerInfo[playerid][pJailTime]);fwrite(hFile, var);
format(var, 32, "Jailed=%d\n",PlayerInfo[playerid][pJailed]);fwrite(hFile, var);
format(var, 32, "Wanted=%d\n",PlayerInfo[playerid][pWanted]);fwrite(hFile, var);
format(var, 32, "WantedFor=%s\n",PlayerInfo[playerid][pWantedFor]);fwrite(hFile, var);
format(var, 32, "DriverLicense=%d\n",PlayerInfo[playerid][pDriverLicense]);fwrite(hFile, var);
format(var, 32, "WeaponLicense=%d\n",PlayerInfo[playerid][pWeaponLicense]);fwrite(hFile, var);
format(var, 32, "CrashX=%.1f\n",PlayerInfo[playerid][pCrashX]);fwrite(hFile, var);
format(var, 32, "CrashY=%.1f\n",PlayerInfo[playerid][pCrashY]);fwrite(hFile, var);
format(var, 32, "CrashZ=%.1f\n",PlayerInfo[playerid][pCrashZ]);fwrite(hFile, var);
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
if(PlayerInfo[playerid][pHealth] > 100) PlayerInfo[playerid][pHealth] = oldhp[playerid];
format(var, 32, "Health=%f\n", PlayerInfo[playerid][pHealth]);fwrite(hFile, var);
GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
if(CopOnDuty[playerid] != 0) PlayerInfo[playerid][pArmour] = 0;
format(var, 32, "Armour=%f\n", PlayerInfo[playerid][pArmour]);fwrite(hFile, var);
format(var, 32, "Paycheck=%d\n",PlayerInfo[playerid][pPaycheck]);fwrite(hFile, var);
format(var, 32, "CrashInt=%d\n",PlayerInfo[playerid][pCrashInt]);fwrite(hFile, var);
format(var, 32, "CrashW=%d\n",PlayerInfo[playerid][pCrashW]);fwrite(hFile, var);
format(var, 32, "Crashed=%d\n",PlayerInfo[playerid][pCrashed]);fwrite(hFile, var);
format(var, 64, "Gun1=%d\n",PlayerInfo[playerid][pGun1]);fwrite(hFile, var);
format(var, 64, "Gun2=%d\n",PlayerInfo[playerid][pGun2]);fwrite(hFile, var);
format(var, 64, "Gun3=%d\n",PlayerInfo[playerid][pGun3]);fwrite(hFile, var);
format(var, 64, "Gun4=%d\n",PlayerInfo[playerid][pGun4]);fwrite(hFile, var);
format(var, 64, "Ammo1=%d\n",PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var);
format(var, 64, "Ammo2=%d\n",PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var);
format(var, 64, "Ammo3=%d\n",PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var);
format(var, 64, "Ammo4=%d\n",PlayerInfo[playerid][pAmmo4]);fwrite(hFile, var);
format(var, 32, "LearningPoints=%d\n",PlayerInfo[playerid][pLearn]);fwrite(hFile, var);
format(var, 32, "UniqueID=%d\n",PlayerInfo[playerid][pUniqueID]);fwrite(hFile, var);
format(var, 64, "Seeds=%d\n",PlayerInfo[playerid][pSeeds]);fwrite(hFile, var);
format(var, 64, "Weed=%d\n",PlayerInfo[playerid][pWeed]);fwrite(hFile, var);
format(var, 32, "WeedX=%f\n",PlayerInfo[playerid][pWeedX]);fwrite(hFile, var);
format(var, 32, "WeedY=%f\n",PlayerInfo[playerid][pWeedY]);fwrite(hFile, var);
format(var, 32, "WeedZ=%f\n",PlayerInfo[playerid][pWeedZ]);fwrite(hFile, var);
format(var, 32, "WeedR=%f\n",PlayerInfo[playerid][pWeedR]);fwrite(hFile, var);
format(var, 64, "WeedTimeLeft=%d\n",PlayerInfo[playerid][pWeedTimeLeft]);fwrite(hFile, var);
format(var, 32, "MaskID=%s\n",PlayerInfo[playerid][pMaskID]);fwrite(hFile, var);
format(var, 32, "Veh1_Model=%d\n", PlayerInfo[playerid][pVeh1Model]); fwrite(hFile, var);
format(var, 32, "Veh1_X=%f\n", PlayerInfo[playerid][pVeh1X]); fwrite(hFile, var);
format(var, 32, "Veh1_Y=%f\n", PlayerInfo[playerid][pVeh1Y]); fwrite(hFile, var);
format(var, 32, "Veh1_Z=%f\n", PlayerInfo[playerid][pVeh1Z]); fwrite(hFile, var);
format(var, 32, "Veh1_Rot=%f\n", PlayerInfo[playerid][pVeh1Rotation]); fwrite(hFile, var);
format(var, 32, "Veh1_Paintjob=%d\n", PlayerInfo[playerid][pVeh1PaintJob]); fwrite(hFile, var);
format(var, 32, "Veh1_Color1=%d\n", PlayerInfo[playerid][pVeh1Color1]); fwrite(hFile, var);
format(var, 32, "Veh1_Color2=%d\n", PlayerInfo[playerid][pVeh1Color2]); fwrite(hFile, var);
format(var, 32, "Veh1_Fuel=%d\n", PlayerInfo[playerid][pVeh1Fuel]); fwrite(hFile, var);
format(var, 32, "Veh1_Destroyed=%d\n", PlayerInfo[playerid][pVeh1Destroyed]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod1=%d\n", PlayerInfo[playerid][pVeh1Mod1]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod2=%d\n", PlayerInfo[playerid][pVeh1Mod2]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod3=%d\n", PlayerInfo[playerid][pVeh1Mod3]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod4=%d\n", PlayerInfo[playerid][pVeh1Mod4]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod5=%d\n", PlayerInfo[playerid][pVeh1Mod5]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod6=%d\n", PlayerInfo[playerid][pVeh1Mod6]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod7=%d\n", PlayerInfo[playerid][pVeh1Mod7]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod8=%d\n", PlayerInfo[playerid][pVeh1Mod8]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod9=%d\n", PlayerInfo[playerid][pVeh1Mod9]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod10=%d\n", PlayerInfo[playerid][pVeh1Mod10]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod11=%d\n", PlayerInfo[playerid][pVeh1Mod11]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod12=%d\n", PlayerInfo[playerid][pVeh1Mod12]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod13=%d\n", PlayerInfo[playerid][pVeh1Mod13]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod14=%d\n", PlayerInfo[playerid][pVeh1Mod14]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod15=%d\n", PlayerInfo[playerid][pVeh1Mod15]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod16=%d\n", PlayerInfo[playerid][pVeh1Mod16]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod17=%d\n", PlayerInfo[playerid][pVeh1Mod17]); fwrite(hFile, var);
format(var, 32, "Veh1_Mod18=%d\n", PlayerInfo[playerid][pVeh1Mod18]); fwrite(hFile, var);
format(var, 32, "Veh2_Model=%d\n", PlayerInfo[playerid][pVeh2Model]); fwrite(hFile, var);
format(var, 32, "Veh2_X=%f\n", PlayerInfo[playerid][pVeh2X]); fwrite(hFile, var);
format(var, 32, "Veh2_Y=%f\n", PlayerInfo[playerid][pVeh2Y]); fwrite(hFile, var);
format(var, 32, "Veh2_Z=%f\n", PlayerInfo[playerid][pVeh2Z]); fwrite(hFile, var);
format(var, 32, "Veh2_Rot=%d\n", PlayerInfo[playerid][pVeh2Rotation]); fwrite(hFile, var);
format(var, 32, "Veh2_Paintjob=%d\n", PlayerInfo[playerid][pVeh2PaintJob]); fwrite(hFile, var);
format(var, 32, "Veh2_Color1=%d\n", PlayerInfo[playerid][pVeh2Color1]); fwrite(hFile, var);
format(var, 32, "Veh2_Color2=%d\n", PlayerInfo[playerid][pVeh2Color2]); fwrite(hFile, var);
format(var, 32, "Veh2_Fuel=%d\n", PlayerInfo[playerid][pVeh2Fuel]); fwrite(hFile, var);
format(var, 32, "Veh2_Destroyed=%d\n", PlayerInfo[playerid][pVeh2Destroyed]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod1=%d\n", PlayerInfo[playerid][pVeh2Mod1]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod2=%d\n", PlayerInfo[playerid][pVeh2Mod2]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod3=%d\n", PlayerInfo[playerid][pVeh2Mod3]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod4=%d\n", PlayerInfo[playerid][pVeh2Mod4]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod5=%d\n", PlayerInfo[playerid][pVeh2Mod5]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod6=%d\n", PlayerInfo[playerid][pVeh2Mod6]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod7=%d\n", PlayerInfo[playerid][pVeh2Mod7]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod8=%d\n", PlayerInfo[playerid][pVeh2Mod8]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod9=%d\n", PlayerInfo[playerid][pVeh2Mod9]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod10=%d\n", PlayerInfo[playerid][pVeh2Mod10]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod11=%d\n", PlayerInfo[playerid][pVeh2Mod11]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod12=%d\n", PlayerInfo[playerid][pVeh2Mod12]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod13=%d\n", PlayerInfo[playerid][pVeh2Mod13]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod14=%d\n", PlayerInfo[playerid][pVeh2Mod14]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod15=%d\n", PlayerInfo[playerid][pVeh2Mod15]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod16=%d\n", PlayerInfo[playerid][pVeh2Mod16]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod17=%d\n", PlayerInfo[playerid][pVeh2Mod17]); fwrite(hFile, var);
format(var, 32, "Veh2_Mod18=%d\n", PlayerInfo[playerid][pVeh2Mod18]); fwrite(hFile, var);
format(var, 32, "Veh3_Model=%d\n", PlayerInfo[playerid][pVeh3Model]); fwrite(hFile, var);
format(var, 32, "Veh3_X=%f\n", PlayerInfo[playerid][pVeh3X]); fwrite(hFile, var);
format(var, 32, "Veh3_Y=%f\n", PlayerInfo[playerid][pVeh3Y]); fwrite(hFile, var);
format(var, 32, "Veh3_Z=%f\n", PlayerInfo[playerid][pVeh3Z]); fwrite(hFile, var);
format(var, 32, "Veh3_Rot=%f\n", PlayerInfo[playerid][pVeh3Rotation]); fwrite(hFile, var);
format(var, 32, "Veh3_Paintjob=%d\n", PlayerInfo[playerid][pVeh3PaintJob]); fwrite(hFile, var);
format(var, 32, "Veh3_Color1=%d\n", PlayerInfo[playerid][pVeh3Color1]); fwrite(hFile, var);
format(var, 32, "Veh3_Color2=%d\n", PlayerInfo[playerid][pVeh3Color2]); fwrite(hFile, var);
format(var, 32, "Veh3_Fuel=%d\n", PlayerInfo[playerid][pVeh3Fuel]); fwrite(hFile, var);
format(var, 32, "Veh3_Destroyed=%d\n", PlayerInfo[playerid][pVeh3Destroyed]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod1=%d\n", PlayerInfo[playerid][pVeh3Mod1]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod2=%d\n", PlayerInfo[playerid][pVeh3Mod2]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod3=%d\n", PlayerInfo[playerid][pVeh3Mod3]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod4=%d\n", PlayerInfo[playerid][pVeh3Mod4]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod5=%d\n", PlayerInfo[playerid][pVeh3Mod5]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod6=%d\n", PlayerInfo[playerid][pVeh3Mod6]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod7=%d\n", PlayerInfo[playerid][pVeh3Mod7]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod8=%d\n", PlayerInfo[playerid][pVeh3Mod8]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod9=%d\n", PlayerInfo[playerid][pVeh3Mod9]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod10=%d\n", PlayerInfo[playerid][pVeh3Mod10]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod11=%d\n", PlayerInfo[playerid][pVeh3Mod11]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod12=%d\n", PlayerInfo[playerid][pVeh3Mod12]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod13=%d\n", PlayerInfo[playerid][pVeh3Mod13]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod14=%d\n", PlayerInfo[playerid][pVeh3Mod14]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod15=%d\n", PlayerInfo[playerid][pVeh3Mod15]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod16=%d\n", PlayerInfo[playerid][pVeh3Mod16]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod17=%d\n", PlayerInfo[playerid][pVeh3Mod17]); fwrite(hFile, var);
format(var, 32, "Veh3_Mod18=%d\n", PlayerInfo[playerid][pVeh3Mod18]); fwrite(hFile, var);
format(var, 32, "Veh1License=%s\n",PlayerInfo[playerid][pVeh1License]);fwrite(hFile, var);
format(var, 32, "Veh2License=%s\n",PlayerInfo[playerid][pVeh2License]);fwrite(hFile, var);
format(var, 32, "Veh3License=%s\n",PlayerInfo[playerid][pVeh3License]);fwrite(hFile, var);
format(var, 32, "Veh1Slot1=%d\n", PlayerInfo[playerid][pVeh1Slot1]); fwrite(hFile, var);
format(var, 32, "Veh1Slot1a=%d\n", PlayerInfo[playerid][pVeh1Slot1a]); fwrite(hFile, var);
format(var, 32, "Veh1Slot2=%f\n", PlayerInfo[playerid][pVeh1Slot2]); fwrite(hFile, var);
format(var, 32, "Veh1Slot3=%d\n", PlayerInfo[playerid][pVeh1Slot3]); fwrite(hFile, var);
format(var, 32, "Veh2Slot1=%d\n", PlayerInfo[playerid][pVeh2Slot1]); fwrite(hFile, var);
format(var, 32, "Veh2Slot1a=%d\n", PlayerInfo[playerid][pVeh2Slot1a]); fwrite(hFile, var);
format(var, 32, "Veh2Slot2=%f\n", PlayerInfo[playerid][pVeh2Slot2]); fwrite(hFile, var);
format(var, 32, "Veh2Slot3=%d\n", PlayerInfo[playerid][pVeh2Slot3]); fwrite(hFile, var);
format(var, 32, "Veh3Slot1=%d\n", PlayerInfo[playerid][pVeh3Slot1]); fwrite(hFile, var);
format(var, 32, "Veh3Slot1a=%d\n", PlayerInfo[playerid][pVeh3Slot1a]); fwrite(hFile, var);
format(var, 32, "Veh3Slot2=%f\n", PlayerInfo[playerid][pVeh3Slot2]); fwrite(hFile, var);
format(var, 32, "Veh3Slot3=%d\n", PlayerInfo[playerid][pVeh3Slot3]); fwrite(hFile, var);
format(var, 32, "Object1=%d\n", PlayerInfo[playerid][pObject1]); fwrite(hFile, var);
format(var, 32, "Object2=%d\n", PlayerInfo[playerid][pObject2]); fwrite(hFile, var);
format(var, 32, "Object3=%d\n", PlayerInfo[playerid][pObject3]); fwrite(hFile, var);
format(var, 32, "Object4=%d\n", PlayerInfo[playerid][pObject4]); fwrite(hFile, var);
format(var, 32, "Object5=%d\n", PlayerInfo[playerid][pObject5]); fwrite(hFile, var);
if(PlayerInfo[playerid][pDonator] > 1)
{
format(var, 32, "Mask=%d\n", PlayerInfo[playerid][pMask]); fwrite(hFile, var);
}
if(PlayerInfo[playerid][pDonator] < 1)
{
format(var, 32, "Mask=%d\n", 0); fwrite(hFile, var);
}
if(PlayerInfo[playerid][pRace] == 1)
{
format(var, 32, "hColt45=%d\n",HumanSkill[playerid][hColt45]);fwrite(hFile, var);
format(var, 32, "hDesertEagle=%d\n",HumanSkill[playerid][hDesertEagle]);fwrite(hFile, var);
format(var, 32, "hSilencedPistol=%d\n",HumanSkill[playerid][hSilencedPistol]);fwrite(hFile, var);
format(var, 32, "hMicroUzi=%d\n",HumanSkill[playerid][hMicroUzi]);fwrite(hFile, var);
format(var, 32, "hMP5=%d\n",HumanSkill[playerid][hMP5]);fwrite(hFile, var);
format(var, 32, "hAK47=%d\n",HumanSkill[playerid][hAK47]);fwrite(hFile, var);
format(var, 32, "hM4=%d\n",HumanSkill[playerid][hM4]);fwrite(hFile, var);
format(var, 32, "hShotgun=%d\n",HumanSkill[playerid][hShotgun]);fwrite(hFile, var);
format(var, 32, "hSPAS12=%d\n",HumanSkill[playerid][hSPAS12]);fwrite(hFile, var);
format(var, 32, "hSniperRifle=%d\n",HumanSkill[playerid][hSniperRifle]);fwrite(hFile, var);
}
if(PlayerInfo[playerid][pRace] == 2)
{
format(var, 32, "vJump=%d\n",VampireAbility[playerid][vJump]);fwrite(hFile, var);
format(var, 32, "vSpeed=%d\n",VampireAbility[playerid][vSpeed]);fwrite(hFile, var);
format(var, 32, "vSniff=%d\n",VampireAbility[playerid][vSniff]);fwrite(hFile, var);
format(var, 32, "vComb=%d\n",VampireAbility[playerid][vComb]);fwrite(hFile, var);
format(var, 32, "vBite=%d\n",VampireAbility[playerid][vBite]);fwrite(hFile, var);
format(var, 32, "vBloodPoints=%d\n",VampireAbility[playerid][vBloodPoints]);fwrite(hFile, var);
format(var, 32, "vBPMax=%d\n",VampireAbility[playerid][vBPMax]);fwrite(hFile, var);
}
fclose(hFile);
}
PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
PlayerInfo[playerid][pGun3] = 0; PlayerInfo[playerid][pAmmo3] = 0;
PlayerInfo[playerid][pGun4] = 0; PlayerInfo[playerid][pAmmo4] = 0;
}
}
return 1;
}
And this is OnPlayerDisconnect callback
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
ResetStats(playerid);
ResetVampireAbilities(playerid);
ResetHumanSkills(playerid);
if(gPlayerLogged[playerid])
{
if(reason == 0)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][pCrashX] = x;
PlayerInfo[playerid][pCrashY] = y;
PlayerInfo[playerid][pCrashZ] = z;
PlayerInfo[playerid][pCrashInt] = GetPlayerInterior(playerid);
PlayerInfo[playerid][pCrashW] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][pCrashed] = 1;
PlayerLocalMessage(playerid,20.0,"left the server. (Timed out)");
for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
{
if(JoinStatus[i] == 0 && PlayerInfo[i][pAdmin] > 0)
{
new joinstring[128];
format(joinstring,sizeof joinstring,"*** %s left the server. (Timed out)",GetPlayerNameEx(playerid));
SendClientMessage(i,COLOR_GREY,joinstring);
}
}
}
else if(reason == 1)
{
PlayerLocalMessage(playerid,20.0,"left the server. (Leaving)");
for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
{
if(JoinStatus[i] == 0 && PlayerInfo[i][pAdmin] > 0)
{
new joinstring[128];
format(joinstring,sizeof joinstring,"*** %s left the server. (Leaving)",GetPlayerNameEx(playerid));
SendClientMessage(i,COLOR_GREY,joinstring);
}
}
}
else if(reason == 2)
{
PlayerLocalMessage(playerid,20.0,"left the server. (Kicked)");
for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
{
if(JoinStatus[i] == 0 && PlayerInfo[i][pAdmin] > 0)
{
new joinstring[128];
format(joinstring,sizeof joinstring,"*** %s left the server. (Kicked)",GetPlayerNameEx(playerid));
SendClientMessage(i,COLOR_GREY,joinstring);
}
}
}
if(PlayerInfo[playerid][pVeh1CarID]!=-1)
{
PlayerInfo[playerid][pVeh1Fuel] = Fuel[PlayerInfo[playerid][pVeh1CarID]];
DestroyVehicle(PlayerInfo[playerid][pVeh1CarID]);
}
else if(PlayerInfo[playerid][pVeh2CarID]!=-1)
{
PlayerInfo[playerid][pVeh2Fuel] = Fuel[PlayerInfo[playerid][pVeh2CarID]];
DestroyVehicle(PlayerInfo[playerid][pVeh2CarID]);
}
else if(PlayerInfo[playerid][pVeh3CarID]!=-1)
{
PlayerInfo[playerid][pVeh3Fuel] = Fuel[PlayerInfo[playerid][pVeh3CarID]];
DestroyVehicle(PlayerInfo[playerid][pVeh3CarID]);
}
if(CopOnDuty[playerid] == 1)
{
new string[MAX_PLAYER_NAME + 32];
format(string, sizeof(string), "[POLICE:] %s is no longer on duty.",GetPlayerNameEx(playerid));
SendFactionTypeMessage(1, COLOR_POLICE, string);
}
OnPlayerDataSave(playerid);
DestroyVehicle(DMVCar[playerid]);
DestroyObject(PlantID[playerid]);
KillTimer(WeedTimer[playerid]);
KillTimer(DeathTimer[playerid]);
}
return 1;
}
Please help me out, this is very important. I don't know what I am doing wrong :/