Payday spam.
#1

Each payday(roleplay server), it spams this message :
'You haven't played long enough to obtain a payday'
The message should happen
pawn Код:
if(PlayerInfo[playerid][pPayDay] >= 1)
But I get my paycheck, and it spams that message.
If you want the whole code of the paycheck, I'll PM it to you.
Reply
#2

Post the whole payday code. Noone can help without that.

This forum requires that you wait 120 seconds between posts. Please try again in 6 seconds. D:
Reply
#3

pawn Код:
public PayDay(playerid)
{
    new string[128];
    new account,interest;

    new rent = 0;

    foreach(Player, i) {
        if(PlayerInfo[i][pJailTime] == 0) {

            if(PlayerInfo[i][pLevel] > 0) {

                account = PlayerInfo[i][pAccount];

//new key = PlayerInfo[i][pHousekey];
//HouseInfo[key][hTakings] = HouseInfo[key][hTakings]+rent;
                new tmpintrate;
                switch(PlayerInfo[i][pDonateRank]) {
                    case 0:
                    {
                        tmpintrate = 1;

                    }
                    case 1:
                    {
                        tmpintrate = 1;

                    }
                    case 2:
                    {
                        tmpintrate = 2;

                    }
                    case 3:
                    {
                        tmpintrate = 3;

                    }
                }
                if(PlayerInfo[i][pPayDay] >= 1) {

                    Tax += TaxValue;

                    PlayerInfo[i][pAccount] -= TaxValue;

                    new checks = PlayerInfo[i][pPayCheck] / 8;

                    if(checks > 300) {
                        checks = 250;
                    }
                    if(PlayerInfo[i][pDonateRank] > 0) {
                        new bonus = PlayerInfo[i][pPayCheck] / 10;
                        checks += bonus;
                    }
                    new ebill = (PlayerInfo[i][pAccount]/10000)*(PlayerInfo[i][pLevel]);

                    account += checks;

                    if(PlayerInfo[i][pAccount] > 0) {
                        PlayerInfo[i][pAccount] -= ebill;
                        SBizzInfo[4][sbTill] += ebill;
                    }
                    else {
                        ebill = 0;
                    }
                    interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate);

                    PlayerInfo[i][pExp]++;
                    PlayerInfo[i][pAccount] = account+interest;
                    SendClientMessage(i,COLOR_GREEN,"|____ BANK STATMENT ____|");
                    format(string, sizeof(string), "Tax Money: -$%d", TaxValue);
                    SendClientMessage(i, COLOR_WHITE, string);
                    format(string, sizeof(string), "Int Rate: 0.%d percent | Int Gained $%d",tmpintrate,interest);
                    SendClientMessage(i, COLOR_WHITE, string);
                    if(PlayerInfo[i][pHousekey] != 255 || PlayerInfo[i][pPbiskey] != 255) {
                        format(string, sizeof(string), "Electricity Bill: -$%d | Rent: -$%d", ebill,rent);
                        SendClientMessage(i, COLOR_WHITE, string);
                    }
                    else if(PlayerInfo[i][pHousekey] == 255 || PlayerInfo[i][pPbiskey] == 255) {
                        format(string, sizeof(string), "Rent: -$%d", rent);
                        SendClientMessage(i, COLOR_WHITE, string);
                    }
                    if(PlayerInfo[i][pMember] == 4||PlayerInfo[i][pMember] == 2||PlayerInfo[i][pMember] == 14) {
                        if(PlayerInfo[i][pRank] >= 0 && PlayerInfo[i][pRank] <= 3) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $300");
                            PlayerInfo[i][pAccount] += 300;
                        }
                        else if(PlayerInfo[i][pRank] == 4) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $400");
                            PlayerInfo[i][pAccount] += 400;
                        }
                        else if(PlayerInfo[i][pRank] >= 5 && PlayerInfo[i][pRank] <= 6) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $500");
                            PlayerInfo[i][pAccount] += 500;
                        }
                    }
                    else if(PlayerInfo[i][pMember] == 1) {
                        if(PlayerInfo[i][pRank] >= 0 && PlayerInfo[i][pRank] <= 2) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $200");
                            PlayerInfo[i][pAccount] += 200;
                        }
                        else if(PlayerInfo[i][pRank] == 3) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $350");
                            PlayerInfo[i][pAccount] += 350;
                        }
                        else if(PlayerInfo[i][pRank] == 4) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $375");
                            PlayerInfo[i][pAccount] += 375;
                        }
                        else if(PlayerInfo[i][pRank] == 5) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $400");
                            PlayerInfo[i][pAccount] += 400;
                        }
                        else if(PlayerInfo[i][pRank] == 6) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $425");
                            PlayerInfo[i][pAccount] += 425;
                        }
                        else if(PlayerInfo[i][pRank] == 7) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $450");
                            PlayerInfo[i][pAccount] += 450;
                        }
                        else if(PlayerInfo[i][pRank] == 8) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $475");
                            PlayerInfo[i][pAccount] += 475;
                        }
                        else if(PlayerInfo[i][pRank] >= 9 && PlayerInfo[i][pRank] <= 16) {
                            SendClientMessage(i, COLOR_WHITE, "Bonus Check: $500");
                            PlayerInfo[i][pAccount] += 500;
                        }
                    }
                    format(string, sizeof(string),"Paycheck : $%d",checks);
                    SendClientMessage(i, COLOR_WHITE,string);
                    format(string, sizeof(string), "Old Balance: $%d | New Balance: $%d", account - checks, PlayerInfo[i][pAccount]);
                    SendClientMessage(i, COLOR_WHITE, string);
                    SendClientMessage(i,COLOR_GREEN,"|--------------------------------------|");
                    format(string, sizeof(string),"~y~Paycheck~n~~g~$%d",checks);
                    GameTextForPlayer(i, string, 5000, 1);
                    rent = 0;
                    PlayerInfo[i][pPayDay] = 0;
                    PlayerInfo[i][pPayCheck] = 0;
                    PlayerInfo[i][pConnectTime] += 1;
                    new nxtlevel = PlayerInfo[i][pLevel]+1;
                    new expamount = nxtlevel*3;
                    if(PlayerInfo[i][pExp] == expamount) {
                        format(string, sizeof(string), "Level up! - New Level: %d", nxtlevel);
                        SendClientMessage(i,COLOR_WHITE, string);
                        PlayerInfo[i][pLevel]++;
                        PlayerInfo[i][pExp] = 0;
                    }
                    if(PlayerInfo[i][pExp] >= expamount) {
                        format(string, sizeof(string), "Level up! - New Level: %d", nxtlevel);
                        SendClientMessage(i,COLOR_WHITE, string);
                        PlayerInfo[i][pLevel]++;
                        PlayerInfo[i][pExp] = 0;
                    }
                }
                else {
                    SendClientMessage(i, COLOR_LIGHTRED, "{FFFFFF}* You haven't played long enough to obtain a {FFFFFF}payday.");
                }
            }
        }
        OnPlayerDataSave(i);
    }
    return 1;
}
Reply
#4

Bump.
Reply
#5

When is pPayDay meant to increase?
Reply
#6

That's the problem, I'm not finding any code with pPayDay, I think this might be the one.
pawn Код:
forward Production();
public Production()
{
    new string[128];
    foreach (Player, i) {
        if(PlayerInfo[i][pPayDay] < 6) {
            PlayerInfo[i][pPayDay] += 1;
            SendDebugMessage("Production, [pPayday]");
        }
        if(WantedLevel[i] > 0 && !PlayerInfo[i][pWarrant]) {
            WantedLevel[i] --;
            format(string, sizeof(string), "Current Wanted Level: %d", WantedLevel[i]);
            SendClientMessage(i,COLOR_YELLOW,string);
            SendDebugMessage("Production, Wanted Level");
        }
    }
    return 1;
}
Reply
#7

How often is the Production timer set for?
Reply
#8

I'm pretty sure I know what you're doing wrong here. You're calling PayDay(playerid) for a single player, although you seem to loop through all of the players anyway. If this is the case, take out the foreach loop and change PayDay(playerid) to PayDay(i) and it should work after that.
Reply
#9

I'll try what TheKiller said.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)