help with taxes
#1

pawn Код:
for(new i = 0; i < GetMaxPlayers(); i++)
        {
            if(pInfo[i][Donator] != 1)
            {
                new randomplayers = random(online);
                if(pInfo[randomplayers][BankMoney] > 300000)
                {
                    new tax = pInfo[randomplayers][BankMoney]/100;
                    new Float:tax1 = tax*2.75;
                    pInfo[randomplayers][Money] -=tax1;
                    format(string,sizeof(string),"You have paid $%d in tax.",tax1);
                    SCM(randomplayers,COLOR_SKYBLUE,string);
                    format(string,sizeof(string),"%s (%d) has paid paid $%d in taxes.",pInfo[randomplayers][playername],randomplayers,tax1);
                    SCMA(COLOR_SKYBLUE,string);
                    pInfo[randomplayers][taxes_paid] += tax1;
                    AUTO_SAVE(randomplayers);
                }
            }
            if(pInfo[i][Donator] == 1)
            {
                new rand =random(3);
                switch(rand)
                {
                    case 0,1:
                    {
                        new randomplayers = random(online);
                        if(pInfo[randomplayers][BankMoney] > 300000)
                        {
                            new tax = pInfo[randomplayers][BankMoney]/100;
                            new Float:tax1 = tax*1.2;
                            pInfo[randomplayers][Money] -=tax1;
                            format(string,sizeof(string),"You have paid $%d in tax.",tax1);
                            SCM(randomplayers,COLOR_SKYBLUE,string);
                            format(string,sizeof(string),"%s (%d) has paid paid $%d in taxes.",pInfo[randomplayers][playername],randomplayers,tax1);
                            SCMA(COLOR_SKYBLUE,string);
                            pInfo[randomplayers][taxes_paid] += tax1;
                            AUTO_SAVE(randomplayers);
                        }
                    }
                    case 2:
                    {
                        new randomplayers = random(online);
                        SCM(randomplayers,COLOR_SKYBLUE,"Your Donator Status Save You From Taxes");
                    }
                }
            }
        }
perfect compiling
i want that the server should take the tax from random people and the random person should have at-lest 300000 in their bank then it should take the money from them thinking money will go in - becz taking form their hand i have that soultion just the problem its not working it took more cash than they even had in total (bank+hand) all the things occurred at the same time for all players
i mean that it showed the msg
Your Donator Status Save You From Taxes
and even took taxes first the non donator way then the donator way
Reply
#2

online == the number of players online and result if i try it


i had 10Million + in bank and 90Million+ in hand and this is what happened
Reply
#3

no help :/
Reply
#4

Could you explain what you are trying to do in better English?
Reply
#5

hahaha ok bro i want that if an player has 300k+ money in his bank account then there should be taxes from him
.. i want that to get all players having 300k + money in bank and are online and choose random players from the online players the tax for donating player should be less in chance i mean some time he skips it as i did it you can see in script and the tax for donator should be less too 1.2% from his total cash bank+in his hand and the cash should be taken from the players money in hand , if not donator the tax should be 2.75% and all other same
Reply
#6

so the donator will be get a little tax from normal player that have 300k or 300k money in bank ?

or

the donator just have to pay 1.2% to the tax
and
Normal player have to pay 2.75% to the tax
but if the normal player had > 300k in the bank or in hand the normal player will be pick randomly to pay the tax that give to donator player ?
Reply
#7

the problem is caused due to using a float varaibe for taking money and printing
use this --
pawn Код:
for(new i = 0; i < GetMaxPlayers(); i++)
        {
            if(pInfo[i][Donator] != 1)
            {
                new randomplayers = random(online);
                if(pInfo[randomplayers][BankMoney] > 300000)
                {
                    new tax = pInfo[randomplayers][BankMoney]/100;
                    new Float:ftax1 = tax*2.75;
                    new tax1=floatround(ftax1, floatround_round); //converting it to int type
                    pInfo[randomplayers][Money] -=tax1;
                    format(string,sizeof(string),"You have paid $%d in tax.",tax1);
                    SCM(randomplayers,COLOR_SKYBLUE,string);
                    format(string,sizeof(string),"%s (%d) has paid paid $%d in taxes.",pInfo[randomplayers][playername],randomplayers,tax1);
                    SCMA(COLOR_SKYBLUE,string);
                    pInfo[randomplayers][taxes_paid] += tax1;
                    AUTO_SAVE(randomplayers);
                }
            }
            if(pInfo[i][Donator] == 1)
            {
                new rand =random(3);
                switch(rand)
                {
                    case 0,1:
                    {
                        new randomplayers = random(online);
                        if(pInfo[randomplayers][BankMoney] > 300000)
                        {
                            new tax = pInfo[randomplayers][BankMoney]/100;
                            new Float:ftax1 = tax*1.2;
                            new tax1=floatround(ftax1, float_round);//similarly as above
                            pInfo[randomplayers][Money] -=tax1;
                            format(string,sizeof(string),"You have paid $%d in tax.",tax1);
                            SCM(randomplayers,COLOR_SKYBLUE,string);
                            format(string,sizeof(string),"%s (%d) has paid paid $%d in taxes.",pInfo[randomplayers][playername],randomplayers,tax1);
                            SCMA(COLOR_SKYBLUE,string);
                            pInfo[randomplayers][taxes_paid] += tax1;
                            AUTO_SAVE(randomplayers);
                        }
                    }
                    case 2:
                    {
                        new randomplayers = random(online);
                        SCM(randomplayers,COLOR_SKYBLUE,"Your Donator Status Save You From Taxes");
                    }
                }
            }
        }
this should work
Reply
#8

done but it send the msg too much time same error
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)