SaveAccount is blanking player files.
#1

This function is blanking player files.

pawn Код:
function SaveAccount(playerid)
{
    if(fexist(Path(playerid)))
    {
        new Float:hp;
        GetPlayerHealth(playerid, hp);
        new INI:file = INI_Open(Path(playerid));
        INI_SetTag(file,"data");
        INI_WriteInt(file,"Admin",PlayerInfo[playerid][Admin]);
        INI_WriteInt(file,"Donator",PlayerInfo[playerid][Donator]);
        INI_WriteInt(file,"DonatorExpireD",PlayerInfo[playerid][DonatorExpireD]);
        INI_WriteInt(file,"DonatorExpireM",PlayerInfo[playerid][DonatorExpireM]);
        INI_WriteInt(file,"DonatorExpireH",PlayerInfo[playerid][DonatorExpireH]);
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
        INI_WriteInt(file,"BankAccount",PlayerInfo[playerid][BankAccount]);
        INI_WriteInt(file,"Level",GetPlayerScore(playerid));
        INI_WriteInt(file,"Kills",PlayerInfo[playerid][Kills]);
        INI_WriteInt(file,"Deaths",PlayerInfo[playerid][Deaths]);
        INI_WriteInt(file,"Registered",PlayerInfo[playerid][Registered]);
        INI_WriteInt(file,"MaskOwned",PlayerInfo[playerid][MaskOwned]);
        INI_WriteInt(file,"Jailed",PlayerInfo[playerid][Jailed]);
        INI_WriteInt(file,"JailedTime",PlayerInfo[playerid][JailedTime]);
        INI_WriteInt(file,"Faction",PlayerInfo[playerid][Faction]);
        INI_WriteInt(file,"FactionRank",PlayerInfo[playerid][FactionRank]);
        INI_WriteInt(file,"BanAppealMod",PlayerInfo[playerid][BanAppealMod]);
        INI_WriteInt(file,"FactionMod",PlayerInfo[playerid][FactionMod]);
        INI_WriteInt(file,"DonationMod",PlayerInfo[playerid][DonationMod]);
        INI_WriteFloat(file,"Health",hp);
        INI_WriteFloat(file,"Armour",PlayerInfo[playerid][Armour]);
        INI_WriteInt(file,"Banned",PlayerInfo[playerid][Banned]);
        INI_WriteInt(file,"Job",PlayerInfo[playerid][Job]);
        INI_WriteInt(file,"JobRank",PlayerInfo[playerid][JobRank]);
        INI_WriteInt(file,"Gun01",PlayerInfo[playerid][Gun01]);
        INI_WriteInt(file,"Gun02",PlayerInfo[playerid][Gun02]);
        INI_WriteInt(file,"Gun03",PlayerInfo[playerid][Gun03]);
        INI_WriteInt(file,"Gun04",PlayerInfo[playerid][Gun04]);
        INI_WriteInt(file,"Gun05",PlayerInfo[playerid][Gun05]);
        INI_WriteInt(file,"Gun06",PlayerInfo[playerid][Gun06]);
        INI_WriteInt(file,"Gun07",PlayerInfo[playerid][Gun07]);
        INI_WriteInt(file,"Gun08",PlayerInfo[playerid][Gun08]);
        INI_WriteInt(file,"Gun09",PlayerInfo[playerid][Gun09]);
        INI_WriteInt(file,"Gun09",PlayerInfo[playerid][Gun10]);
        INI_WriteInt(file,"Gun11",PlayerInfo[playerid][Gun11]);
        INI_WriteInt(file,"Ammo01",PlayerInfo[playerid][Ammo01]);
        INI_WriteInt(file,"Ammo02",PlayerInfo[playerid][Ammo02]);
        INI_WriteInt(file,"Ammo03",PlayerInfo[playerid][Ammo03]);
        INI_WriteInt(file,"Ammo04",PlayerInfo[playerid][Ammo04]);
        INI_WriteInt(file,"Ammo05",PlayerInfo[playerid][Ammo05]);
        INI_WriteInt(file,"Ammo06",PlayerInfo[playerid][Ammo06]);
        INI_WriteInt(file,"Ammo07",PlayerInfo[playerid][Ammo07]);
        INI_WriteInt(file,"Ammo08",PlayerInfo[playerid][Ammo08]);
        INI_WriteInt(file,"Ammo09",PlayerInfo[playerid][Ammo09]);
        INI_WriteInt(file,"Ammo09",PlayerInfo[playerid][Ammo10]);
        INI_WriteInt(file,"Ammo11",PlayerInfo[playerid][Ammo11]);
        INI_WriteInt(file,"Phone",PlayerInfo[playerid][Phone]);
        INI_WriteInt(file,"PhoneNumber",PlayerInfo[playerid][PhoneNumber]);
        INI_WriteInt(file,"Strikes",PlayerInfo[playerid][Strikes]);
        INI_Close(file);
        return 1;
    }
    return 1;
}
Reply
#2

what do u meant blanking ?
Reply
#3

can you post where the function is being called?
Reply
#4

Make sure all the variables are set when you try to save them.
Reply
#5

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
what do u meant blanking ?
The everything on the file gets deleted except the actual file.

Quote:
Originally Posted by arbit
Посмотреть сообщение
can you post where the function is being called?
OnPlayerDisconnect();

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Make sure all the variables are set when you try to save them.
That wont do anything.
Reply
#6

Quote:
Originally Posted by seanny
Посмотреть сообщение
That wont do anything.
Assigning the variables before using them won't do anything? Do you have any clue what you're talking about?
Reply
#7

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Assigning the variables before using them won't do anything? Do you have any clue what you're talking about?
Yes I do.

I tried it, same result.
Reply
#8

Quote:
Originally Posted by seanny
Посмотреть сообщение
OnPlayerDisconnect();
The code lad the code!
Reply
#9

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new string[128];
    if(reason == 0)
    {
        format(string, sizeof(string), "[System Information] %s has disconnected. Reason: Time out.", GetName(playerid));
        ProxDetector(20.0, playerid, string,LIGHTRED,LIGHTRED,LIGHTRED,LIGHTRED,LIGHTRED);
        if(Detained[playerid] == 1)
        {
            SetPlayerInterior(playerid, 1);
            PlayerInfo[playerid][Jailed] = 3;//Admin jail
            PlayerInfo[playerid][JailedTime] = 3600;//Lets jail them for one hour
        }
    }
    else if(reason == 1)
    {
        format(string, sizeof(string), "[System Information] %s has disconnected. Reason: Leaving.", GetName(playerid));
        ProxDetector(20.0, playerid, string,LIGHTRED,LIGHTRED,LIGHTRED,LIGHTRED,LIGHTRED);
        if(Detained[playerid] == 1)
        {
            SetPlayerInterior(playerid, 1);
            PlayerInfo[playerid][Jailed] = 3;//Admin jail
            PlayerInfo[playerid][JailedTime] = 3600;//Lets jail them for one hour
        }
    }
    else if(reason == 2)
    {
        format(string, sizeof(string), "[System Information] %s has disconnected. Reason: Kicked or Banned.", GetName(playerid));
        ProxDetector(20.0, playerid, string,LIGHTRED,LIGHTRED,LIGHTRED,LIGHTRED,LIGHTRED);
    }
    /*new x = 0;
    while(x != MAX_PLAYERS)
    {
        if(IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING && SpectatedID[x] == playerid)
        {
            SetPlayerHealth(x, PlayerInfo[x][Health]);
            SetPlayerArmour(x, PlayerInfo[x][Armour]);
            SetPlayerPos(playerid, 1642.39, -2238.10, 13.47);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            SendClientMessage(x, WHITE, "You're no longer spectating.");
            TogglePlayerSpectating(x, 0);
        }
        x++;
    }*/

    Delete3DTextLabel(DutyLabel[playerid]);
    StreamingObjects[playerid] = 0;
    AntiSpam[playerid] = 0;
    Logged[playerid] = 0;
    TextDrawHideForPlayer(playerid, Clock);
    SaveAccount(playerid);
    return 1;
}
Reply
#10

OK. you connect, register, disconnect, file's empty correct? start by debugging your mode.

@****** - is y_debug specifically for YSI only (designed to be an integral part)? or can we use it in our modes as well?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)