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;
}