SA-MP Forums Archive
Without money/rp/hours played. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Without money/rp/hours played. (/showthread.php?tid=592013)



[++REP] Without money/rp/hours played. - norton2 - 19.10.2015

Sometimes players do not have Money/Respect Points/Hours played on the server. For whatever this is happening. R39-2 use MySQL.

So far the players have told me that is the problem after taking payday.
Код HTML:
forward PayDay();
public PayDay()
{
    new string[128], rent = 0;
    foreach (new i : Player)
    {
        if(IsPlayerConnected(i))
        {
            new checks = RandomEx(900, 1201), ebill = 100 + random(99);
            new TaxValue = 1;
            SendClientMessage(i, COLOR_WHITE, "|___ BANK STATMENT ___|");
            format(string, sizeof(string), "{5F5F5F}Paycheck: {FFFFFF}%s | {5F5F5F}Tax Money: {FFFFFF}-%s", FormatNumber(checks), FormatNumber(TaxValue));
            SendClientMessage(i, -1, string);
            if(pInfo[i][pHouse] != 355 || pInfo[i][pBusiness] != 355)
            {
                format(string, sizeof(string), "{5F5F5F}Electricity Bill: {FFFFFF}-%s", FormatNumber(ebill));
                SendClientMessage(i, -1, string);
            }
            format(string, sizeof(string), "{5F5F5F}Rent: {FFFFFF}-%s", FormatNumber(rent));
            SendClientMessage(i, -1, string);
            format(string, sizeof(string), "{5F5F5F}Balance: {FFFFFF}%s", FormatNumber(pInfo[i][pBankMoney]));
            SendClientMessage(i, -1, string);
            SendClientMessage(i, -1, "|--------------------------------------|");
            format(string, sizeof(string), "{5F5F5F}New Balance: {FFFFFF}%s", FormatNumber(pInfo[i][pBankMoney]+=5)); VPUpdate(i, pBankMoneyu);
            SendClientMessage(i, -1, string);
            GameTextForPlayer(i, "~g~~h~PayDay", 5000, 1); GiveMoney(i, checks-1);

            pInfo[i][pHoursPlayed] += 1; VPUpdate(i, pHoursPlayedu);
            pInfo[i][pRPoints] += 1; VPUpdate(i, pRPointsu);
            if(pInfo[i][pRob] < 10 && pInfo[i][pPremium] == 0) { pInfo[i][pRob] += 1; VPUpdate(i, pRobu); }
            if(pInfo[i][pRob] < 20 && pInfo[i][pPremium] == 1) { pInfo[i][pRob] += 1; VPUpdate(i, pRobu); }
            if(pInfo[i][pFPunish] > 0) { pInfo[i][pFPunish] -= 1; VPUpdate(i, pFPunishu); }
            if(pInfo[i][pCarLic] > 0)
            {
                pInfo[i][pCarLicTime] -= 1; VPUpdate(i, pCarLicTimeu);
                if(pInfo[i][pCarLicTime] == 0) { pInfo[i][pCarLic] = 0; VPUpdate(i, pCarLicu); SendClientMessage(i, COLOR_RED, "* Permisul de conducere ti-a expirat!"); }
            }
            if(pInfo[i][pFlyLic] > 0)
            {
                pInfo[i][pFlyLicTime] -= 1; VPUpdate(i, pFlyLicTimeu);
                if(pInfo[i][pFlyLicTime] == 0) { pInfo[i][pFlyLic] = 0; VPUpdate(i, pFlyLicu); SendClientMessage(i, COLOR_RED, "* Licenta de zbor ti-a expirat!"); }
            }
            if(pInfo[i][pBoatLic] > 0)
            {
                pInfo[i][pBoatLicTime] -= 1; VPUpdate(i, pBoatLicTimeu);
                if(pInfo[i][pBoatLicTime] == 0) { pInfo[i][pBoatLic] = 0; VPUpdate(i, pBoatLicu); SendClientMessage(i, COLOR_RED, "* Licenta de navigat ti-a expirat!"); }
            }
            if(pInfo[i][pGunLic] > 0)
            {
                pInfo[i][pGunLicTime] -= 1; VPUpdate(i, pGunLicTimeu);
                if(pInfo[i][pGunLicTime] == 0) { pInfo[i][pGunLic] = 0; VPUpdate(i, pGunLicu); SendClientMessage(i, COLOR_RED, "* Licenta de port-arma ti-a expirat!"); }
            }
        }
    }
    return 1;
}



Re: Without money/rp/hours played. - norton2 - 19.10.2015

Anyone?


Re : Without money/rp/hours played. - StreetRP - 19.10.2015

Stats disappears after the payday ? Or at the connection


Re: Without money/rp/hours played. - norton2 - 19.10.2015

After payday.
Not always, there are times when nothing disappears.


Re: Without money/rp/hours played. - norton2 - 19.10.2015

Bump.


Re: Without money/rp/hours played. - norton2 - 19.10.2015

Help...


Re: Without money/rp/hours played. - norton2 - 20.10.2015

Bump


Re: Without money/rp/hours played. - SecretBoss - 20.10.2015

Nothing is wrong in the code, payday as I can see just removes the hours from licenses and give the interests there is no reason to reset player stats, check the rest of your code


Re: Without money/rp/hours played. - norton2 - 20.10.2015

The problem to be caused by VPUpdate?
Код HTML:
forward VPUpdate(id, update);
public VPUpdate(id, update)
{
    new query[254];
    if(IsPlayerConnected(id))
    {
        switch(update)
        {
            case pAdminu: { mysql_format(MySQLCon, query, sizeof(query), "UPDATE players SET Admin='%d' WHERE user='%s'", pInfo[id][pAdmin], GetName(id)); }
            case pHelperu: { mysql_format(MySQLCon, query, sizeof(query), "UPDATE players SET Helper='%d' WHERE user='%s'", pInfo[id][pHelper], GetName(id)); }
            case pMoneyu: { mysql_format(MySQLCon, query, sizeof(query), "UPDATE players SET Money='%d' WHERE user='%s'", pInfo[id][pMoney], GetName(id)); }
            case pScoreu: { mysql_format(MySQLCon, query, sizeof(query), "UPDATE players SET Score='%d' WHERE user='%s'", pInfo[id][pScore], GetName(id)); }
            // ..................... etc
        }
        mysql_pquery(MySQLCon, query);
    }
    return 1;
}



Re: Without money/rp/hours played. - SecretBoss - 20.10.2015

Where exactly you use this function?