[SOLVED] Problem with /stats, Money donґt save.
#1

Hello again,

This will be a difficult problem. But I hope anyone of you can resolv it. The problem is short but big. I canґt save the money from stats. When I disconnect the money wonґt save and in game the money donґt increase when I earn some. I know wait it donґt save but I canґt fix it ;( I need urgently help!

pawn Код:
enum PlayerData
{
    Registered,
    LoggedIn,
    AdminLevel,
    Password,
    Kills,
    Deaths,
    Money,
    PlayerIP
pawn Код:
public OnPlayerConnect(playerid)
{
            if(playerIP[50] == playerIp[49])
            {
              SendClientMessage(playerid, COLOR_GREEN, "You have been automatically logged in! Welcome back to the server.");
              PlayerInfo[playerid][Registered] = 1;
            PlayerInfo[playerid][LoggedIn] = 1;
            PlayerInfo[playerid][AdminLevel] = dini_Int(PlayerFile, "AdminLevel");
                PlayerInfo[playerid][Kills] = dini_Int(PlayerFile, "Kills");
                PlayerInfo[playerid][Deaths] = dini_Int(PlayerFile, "Deaths");
                PlayerInfo[playerid][Money] = dini_Int(PlayerFile, "Money");
            }
            else
            {
              PlayerInfo[playerid][Registered] = 1;
            PlayerInfo[playerid][LoggedIn] = 0;
            SendClientMessage(playerid, COLOR_GREEN," Since you are registered, please use /login to login onto your account.");
            }
pawn Код:
dcmd_login(playerid, params[])
{
    new pName[24], PlayerFile[50], Pass[256], plrIP[50];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", pName);

    if(PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You are already logged in!");
    if(PlayerInfo[playerid][Registered] == 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You are not registered! Use /register to register.");
    if(sscanf(params, "s", Pass)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "Usage: /login [password]");

    Pass = dini_Get(PlayerFile, "Password");

    if(!strcmp(MD5_Hash(params), Pass, true))
    {
        GetPlayerIp(playerid, plrIP, sizeof(plrIP));
      dini_Set(PlayerFile, "PlayerIP", plrIP);
        SendClientMessage(playerid, COLOR_GREEN, "You have been succesfully logged in");
        PlayerInfo[playerid][LoggedIn] = 1;
        PlayerInfo[playerid][AdminLevel] = dini_Int(PlayerFile, "AdminLevel");
        PlayerInfo[playerid][Kills] = dini_Int(PlayerFile, "Kills");
        PlayerInfo[playerid][Deaths] = dini_Int(PlayerFile, "Deaths");
        PlayerInfo[playerid][Money] = dini_Int(PlayerFile, "Money");
    }
    else
    {
pawn Код:
dcmd_stats(playerid, params[])
{
    new pName[24], PlayerFile[50], str[128], pDeaths[50], pKills[50], pMoney[50],targetid;

    if(!strlen(params)) targetid = playerid;
    else targetid = strval(params);
    GetPlayerName(targetid, pName, sizeof(pName));
    format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", pName);

    if(!dini_Exists(PlayerFile)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "Usage: /stats [ID].");

    if(dini_Exists(PlayerFile))
    {
        pDeaths[24] = dini_Int(PlayerFile, "Deaths");
        pKills[24] = dini_Int(PlayerFile, "Kills");
        pMoney[24] = dini_Int(PlayerFile, "Money");
        new Float:Ratio=floatdiv(pKills[24], pDeaths[24]);
        format(str, sizeof(str), "               ||%sґs Statistics ||", pName);
        SendClientMessage(playerid, COLOR_GREEN, str);
        format(str, sizeof(str), "(Money): Money: %d", pMoney[24]);
        SendClientMessage(playerid, COLOR_YELLOW, str);
        format(str, sizeof(str), "(Stats): Kills: %d || Deaths: %d || Ratio: %.2f || Money: %d", pKills[24], pDeaths[24], Ratio, pMoney[24]);
        SendClientMessage(playerid, COLOR_YELLOW, str);
I know I must put something between OnPlayerDisconnect but I donґt know what and I donґt know really how to save money ;/

I would be grateful if someone help me ;(
Reply


Messages In This Thread
[SOLVED] Problem with /stats, Money donґt save. - by Flashy - 01.06.2010, 20:09
Re: Problem with /stats, Money donґt save. - by Naxix - 01.06.2010, 20:14
Re: Problem with /stats, Money donґt save. - by Flashy - 01.06.2010, 20:21
Re: Problem with /stats, Money donґt save. - by Naxix - 01.06.2010, 20:21
Re: Problem with /stats, Money donґt save. - by Flashy - 01.06.2010, 20:45
Re: Problem with /stats, Money donґt save. - by aircombat - 01.06.2010, 20:56
Re: Problem with /stats, Money donґt save. - by Flashy - 02.06.2010, 07:18
Re: Problem with /stats, Money donґt save. - by DJDhan - 02.06.2010, 07:21
Re: Problem with /stats, Money donґt save. - by Flashy - 02.06.2010, 07:31
Re: Problem with /stats, Money donґt save. - by Flashy - 02.06.2010, 08:18

Forum Jump:


Users browsing this thread: 1 Guest(s)