Property Taxes
#1

Hi guys, I'm sorry but I'm newbie and just learned how to code.

My question is,

How can I create a tax system for every property he owns?

For example
Default tax for biz is $1000
Every pay time he must pay $1k to government

and if he owns 2 biz, then he must pay $2k and so on.
Reply
#2

Make a global timer (or player timer that starts when the player connects/logs in) that goes off every hour or whatever interval you want it to go off at and place something like this in the code:

pawn Код:
forward PaycheckTimerFunction();
public PaycheckTimerFunction()
{
    for(new i=0, j=GetPlayerPoolSize(); i<=j; i++) //player loop if you go the global timer route, which this function is
    {
        if(IsPlayerConnected(i)) //is the playerid connected?
        {
            if(statement checks) //this is where you check if the player has a business
            {
                new total = GetTotalPlayerBusinessCount(i); //GetTotalPlayerBusinessCount would be where you calculate how many businesses the player owns
                new tax = total*1000; //total tax amount to be taken away
                GivePlayerMoney(i,-tax); //removes the necessary amount of money
            }
        }
    }
}
Reply
#3

There's more to this than the above simple 'throw out an answer' scenario.


There'd be an idea that even though the player is offline, the business can still be operating, so it wouldn't as much be based on the player pool, it would be more on a business loop, taking from their till and paying the bank.

You could use the above throw-out (Even though I wouldn't trust the formula at all), and modify it to handle the businesses as the loop, and make the businesses payout in that time, to the bank.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)