SA-MP Forums Archive
Public Payday - 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: Public Payday (/showthread.php?tid=477415)



Public Payday - ***Niko*** - 24.11.2013

Hi all, how can i make check on this payday now when i /settax players lose money every second third time and should be on every payday,whats wrong in code or how can i make check if money is taken or idk :

pawn Код:
public PayDay()
{
    new string[128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            if(PlayerInfo[i][pLevel] > 0)
            {
                new tax = (Tax / 2)*(PlayerInfo[i][pLevel]);
                if(PlayerInfo[i][pAccount] > PlayerInfo[i][pCash])
                {
                    PlayerInfo[i][pAccount] -= tax;
                    banksys[dCash] += tax;
                    SaveCityhallSystem()
                    format(string, sizeof(string), "  Government Tax: -$%d", tax);
                    SendClientMessage(i, COLOR_GREEN, string);
                }
                else
                {
                    PlayerInfo[i][pCash] -= tax;
                    banksys[dCash] += tax;
                    SaveCityhallSystem()
                    format(string, sizeof(string), "  Government Tax: -$%d", tax);
                    SendClientMessage(i, COLOR_GREEN, string);
                }
                if(PlayerInfo[i][pAddict] == 1)
                {
                    PlayerInfo[i][pExp]+= 4;
                }
                PlayerInfo[i][pExp]+= 2;
            }
        }
    }
    return 1;
}



Re: Public Payday - AiRaLoKa - 24.11.2013

try this,
Код:
public PayDay()
{
    new string[128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            if(PlayerInfo[i][pLevel] > 0)
            {
                new tax = (Tax / 2)*(PlayerInfo[i][pLevel]);
                if(PlayerInfo[i][pAccount] > PlayerInfo[i][pCash])
                {
                    PlayerInfo[i][pAccount] = PlayerInfo[i][pAccount]-tax;
                    banksys[dCash] = banksys[dCash]+tax;
                    SaveCityhallSystem()
                    format(string, sizeof(string), "  Government Tax: -$%d", tax);
                    SendClientMessage(i, COLOR_GREEN, string);
                }
                else
                {
                    PlayerInfo[i][pCash] = PlayerInfo[i][pCash]-tax;
                    banksys[dCash] = banksys[dCash]+tax;
                    SaveCityhallSystem()
                    format(string, sizeof(string), "  Government Tax: -$%d", tax);
                    SendClientMessage(i, COLOR_GREEN, string);
                }
                if(PlayerInfo[i][pAddict] == 1)
                {
                    PlayerInfo[i][pExp]+= 4;
                }
                PlayerInfo[i][pExp]+= 2;
            }
        }
    }
    return 1;
}