Paycheck help(Net Pay)
#1

Hello Guys, i hope that you can help me out doing this, i am about to add "Net Pay" to the paycheck(the amount that will be added after tax is paid) the code looks like this.

Thank you

pawn Код:
stock PayDay(playerid)
{
    new string[256];
    new interest;
    new rent = 0;
    new oldbalance = PlayerInfo[playerid][pAccount];
    if(PlayerInfo[playerid][pPayDay] >= 5)
    {
        Tax += TaxValue;
        PlayerInfo[playerid][pAccount] -= TaxValue;
        new checks = PlayerInfo[playerid][pPayCheck];
        new ebill = (PlayerInfo[playerid][pAccount]/9000)*(PlayerInfo[playerid][pLevel]);
        PlayerInfo[playerid][pAccount] += checks;
        if(PlayerInfo[playerid][pAccount] > 0)
        {
            PlayerInfo[playerid][pAccount] -= ebill;
        }
        else
        {
            ebill = 0;
        }
        if(PlayerInfo[playerid][pDonateRank] > 0)
        {
            new bonus = PlayerInfo[playerid][pPayCheck] / 10;
            checks += bonus;
        }
        interest = 0;
        PlayerInfo[playerid][pExp]++;
        PlayerInfo[playerid][pAccount] += interest;
        SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|");
        format(string, sizeof(string), "  Paycheck: "COL_GREEN"$%d", checks);
        SendClientMessage(playerid, COLOR_GRAD1, string);
        format(string, sizeof(string), "  Income Tax: {FF6347}-$%d", TaxValue);
        SendClientMessage(playerid, COLOR_GRAD1, string);
        if(PlayerInfo[playerid][pHousekey] != 255)
        {
            format(string, sizeof(string), "Electricity Bill: -$%d | Rent: -$%d", ebill,rent);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
            else if(PlayerInfo[playerid][pHousekey] == 255 || PlayerInfo[playerid][pPbiskey] == 255)
        {
            format(string, sizeof(string), "Rent: "COL_GREEN"-$%d", rent);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }

        new storagefee;
        for(new i = 1;i < PlayerInfo[playerid][pGunLockerPerk] + 1;i++)
        {
            if(pLockerType[playerid][i])
            {
                storagefee += 399 + random(201);
            }
        }
        if(storagefee)
        {
            format(string, sizeof(string),"  Storage Fee: {FF6347}-$%d",storagefee);
            SendClientMessage(playerid,COLOR_GRAD1,string);
            PlayerInfo[playerid][pAccount] -= storagefee;
        }
        if (PlayerInfo[playerid][pHitmanTax])
        {
            format(string, sizeof(string), "  Hitman Tax: {FF6347}-$%d",PlayerInfo[playerid][pHitmanTax]);
            SendClientMessage(playerid, COLOR_GRAD5, string);
            PlayerInfo[playerid][pAccount] -= PlayerInfo[playerid][pHitmanTax];
            PlayerInfo[playerid][pHitmanTax] = 0;
        }
        if (PlayerInfo[playerid][pSock] >= 1)
        {
            format(string, sizeof(string), "  Poopsock Tax: {FF6347}-$%d",PlayerInfo[playerid][pSock]);
            SendClientMessage(playerid, COLOR_GRAD5, string);
            PlayerInfo[playerid][pAccount] -= PlayerInfo[playerid][pSock];
        }
        SendClientMessage(playerid, COLOR_GRAD4, "|--------------------------------------|");
        format(string, sizeof(string), "  Old Balance: "COL_GREEN"$%d", oldbalance);
        SendClientMessage(playerid, COLOR_GRAD5, string);
        format(string, sizeof(string), "  Net Pay: "COL_GREEN"$%d", checks);
        SendClientMessage(playerid, COLOR_GRAD5, string);
        format(string, sizeof(string), "  New Balance: "COL_GREEN"$%d", PlayerInfo[playerid][pAccount]);
        SendClientMessage(playerid, COLOR_GRAD5, string);
        format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck");
        GameTextForPlayer(playerid, string, 5000, 1);
        PlayerInfo[playerid][pPayDay] = 0;
        PlayerInfo[playerid][pPayCheck] = 0;
        PlayerInfo[playerid][pConnectTime] += 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "* You haven't played long enough to obtain a PayDay.");
    }

    CheckReady[playerid] = 0;
    return 1;
}
Reply
#2

You haven't said what the issue is ...
So posting code won't do much
Reply
#3

It says 'Net Pay', and 'Paycheck' is the same
Reply
#4

Can anyone help me please?
Reply
#5

In terms of just showing text that doesn't mean you created a new variable, you are using same variable you're using for paychecks, of course it's going to show same value as paycheck!.

What you need to do is: create a variable, make the math appropriate for your net-pay and replace the 'checks' variable in the string.


- my suggestion is to re-write the paycheck system once again to shape it how you really want (what about starting a new gamemode?) good luck, mate.

I hope I helped any feedback is appreciated!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)