05.03.2014, 16:36
Hi. I'm a real newbie with loops. Can anyone help me? This whole function is spammed every hour.
pawn Код:
public Payday()
{
foreach (new i : Player)
{
new wstring[256];
new randcheck = 20 + random(300);
new interest = (PlayerInfo[i][pBankAccount]/1000)*(intrate);
new newbank = PlayerInfo[i][pBankAccount] + randcheck;
new randtax = 5 + random(20);
SCM(i, -1, "___________________[PAYDAY INFORMATION]___________________");
format(wstring, sizeof(wstring), "~w~PayDay ~n~~g~$%d", randcheck);
GameTextForPlayer(i, wstring, 3000, 1);
PlayerInfo[i][pBankAccount] += randcheck;
format(wstring, sizeof(wstring), "PayCheck: $%d", randcheck);
SendClientMessage(i,COLOR_WHITE, wstring);
format(wstring, sizeof(wstring), "Interest Gained: $%d, Interest Rate: 0.%d percent.", interest, intrate);
SendClientMessage(i,COLOR_WHITE, wstring);
format(wstring, sizeof(wstring), "Government Taxes: $-%d.", randtax);
SendClientMessage(i,COLOR_WHITE, wstring);
format(wstring,sizeof(wstring), "New bank balance: $%d", newbank);
SCM(i, COLOR_WHITE, wstring);
PlayerInfo[i][pBankAccount] += interest;
PlayerInfo[i][pBankAccount] -= randtax;
PlayerInfo[i][pPlayingHours] += 1;
break;
}
}