SA-MP Forums Archive
PaydayTime problems - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: PaydayTime problems (/showthread.php?tid=243101)



PaydayTime problems - Flyfishes - 21.03.2011

pawn Код:
public PayDayTime()
{
    if(serverstartedpday == 1)
    {
        serverstartedpday = 0;
        return 1;
    }
    new wstring[256];
    new govtax = dini_Int("savedfiles/Other/Extra.cfg", "GovernmentTax");
    for(new i = 0; i < MAX_PLAYERSEX; i++)
    {
        if(IsPlayerConnected(i) && AFKMode[i] == 0)
        {
            GameTextForPlayer(i, "~y~Payday!", 5000, 1);
            new randomcheck = 125 + random(100);
            new randomcheckii = 125 + random(100);
            new interest = (PlayerInfo[i][pBank]/1000)*(intrate);
            new bonus = PlayerInfo[i][pBonus];
            SendClientMessage(i,COLOR_WHITE,"|___ BANK STATEMENT ___|");
            format(wstring, sizeof(wstring), "Paycheck: $%d - Bonus: $%d", randcheck, bonus);
            SendClientMessage(i, COLOR_GREY, wstring);
            format(wstring, sizeof(wstring), "Balance: $%d - Interest Gained: $%d", PlayerInfo[i][pBank], interest);
            SendClientMessage(i, COLOR_GREY, wstring);
            format(wstring, sizeof(wstring), "Taxes: $%d", govtax);
            SendClientMessage(i, COLOR_GREY, wstring);
            if(PlayerInfo[i][pFaction] != 255 && Factions[PlayerInfo[i][pFaction]][fType] == 1 || PlayerInfo[i][pFaction] == 1 || PlayerInfo[i][pFaction] != 255 && Factions[PlayerInfo[i][pFaction]][fType] == 3)
            {
                format(wstring, sizeof(wstring), "Government paycheck: $%d", randcheckii);
                SendClientMessage(i, COLOR_GREY, wstring);
            }
            PlayerInfo[i][pBank] += interest;
            PlayerInfo[i][pBank] -= govtax;
            PlayerInfo[i][pBank] += randcheck + bonus;
            PlayerInfo[i][pBank] += randcheckii;
            Factions[1][fBank] += govtax;
            PlayerInfo[i][pPayCheck] = 0;
            PlayerInfo[i][pExp]++;
            PlayerInfo[i][pPlayingHours] += 1;
            if(PlayerInfo[i][pTickets] >= 1)
            {
                PlayerInfo[i][pBank] -= PlayerInfo[i][pTickets];
                Factions[0][fBank] += PlayerInfo[i][pTickets];
                format(wstring, sizeof(wstring), "Unpaid tickets were paid. Totally paid: $%d", PlayerInfo[i][pTickets]);
                SendClientMessage(i, COLOR_LOCALMSG, wstring);
                PlayerInfo[i][pTickets] = 0;
            }
            SendClientMessage(i,COLOR_WHITE,"_______________________");
            format(wstring, sizeof(wstring), "New balance: $%d", PlayerInfo[i][pBank]);
            SendClientMessage(i,COLOR_GREY, wstring);

            new nxtlevel = PlayerInfo[i][pLevel]+1;
            new expamount = nxtlevel*levelexp;
            if(PlayerInfo[i][pExp] < expamount)
            {
                format(wstring, sizeof(wstring), "%d/%d experience needed to level up, you currently have %d", expamount,expamount,PlayerInfo[i][pExp]);
                SendClientMessage(i,COLOR_GREY, wstring);
            }
            else
            {
                format(wstring, sizeof(wstring), "Level up! - New Level: %d", nxtlevel);
                SendClientMessage(i,COLOR_GREY, wstring);
                PlayerInfo[i][pLevel]++;
                PlayerInfo[i][pExp] = 0;
            }
        }
    }
    return 1;
}
When I put the function somewhere PaydayTime(); it fucks up the rest of the code after the PaydayTime();


AW: PaydayTime problems - Pablo Borsellino - 21.03.2011

return it false or dont return it.


Re: PaydayTime problems - Flyfishes - 21.03.2011

And what will happend then?


Re: PaydayTime problems - bkart - 21.03.2011

Making PayDay spam ?


AW: PaydayTime problems - Pablo Borsellino - 21.03.2011

Ahh, my answer was wrong here.

Debug your Code like

if bla..
print("1");
SetPlayer...
print("2");
...

And check how much Numbers get printed in your Console before the Server crash, then you know why the Server crash (Lines) and we can help you better