02.01.2012, 12:23
look at the pic for see the problem after payday i have New Balance 2 that what i have before
payday code
payday code
pawn Код:
public PayDay()
{
new string[128];
new sendername[MAX_PLAYER_NAME];
new account;
new interest;
new rent = 0;
new playername2[MAX_PLAYER_NAME];
if(RobStatus[BankReload] == 1)
{
RobStatus[BankReload] = 0;
}
if(RobStatus[BankReload] == 2)
{
RobStatus[BankReload] = 1;
}
for(new i = 0; i<MAX_PLAYERS; i++)
{
new housekey = PlayerInfo[i][pPhousekey];
new bizkey = PlayerInfo[i][pPbiskey];
if(IsPlayerConnected(i))
{
if(UsingWeed[i] == 1)
{
SetPlayerWeather(i, -66);
SetPlayerTime(i, 12, 0);
}
if(UsingEcstasy[i] == 1)
{
SetPlayerWeather(i, -66);
SetPlayerTime(i, 23, 0);
}
if(UsingCrack[i] == 1)
{
SetPlayerWeather(i, 45);
SetPlayerTime(i, 12, 0);
}
if(MoneyMessage[i] == 1 && PlayerInfo[i][pJailed] == 0)
{
SendClientMessage(i, COLOR_LIGHTRED, "You failed to pay your debt, Jail time.");
SetPlayerInterior(i, 0);
SetPlayerPos(i, 264.6288, 77.5742, 1001.0391);
ResetPlayerWeapons(i);
ClearGuns(i);
TogglePlayerControllable(i, 1);
PlayerInfo[i][pWantedLevel] = 0;
PlayerInfo[i][pJailed] = 1;
PlayerInfo[i][pJailTime] = 240;
format(string, sizeof(string), "* You are jailed for %d seconds, Bail: Unavailable.", PlayerInfo[i][pJailTime]);
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
if(PlayerInfo[i][pLevel] > 0)
{
new tmpintrate;
if(PlayerInfo[i][pDonateRank] == 1)
{
PlayerInfo[i][pVIPTokens] += 2;
SendClientMessage(i, COLOR_YELLOW, "Great job, you have earned 2 VIP Tokens, you can now use them with /vip.");
tmpintrate = 1;
}
else if(PlayerInfo[i][pDonateRank] == 2)
{
PlayerInfo[i][pVIPTokens] += 3;
SendClientMessage(i, COLOR_YELLOW, "Great job, you have earned 3 VIP Tokens, you can now use them with /vip.");
tmpintrate = 9;
}
else if(PlayerInfo[i][pDonateRank] == 3)
{
PlayerInfo[i][pVIPTokens] += 4;
SendClientMessage(i, COLOR_YELLOW, "Great job, you have earned 4 VIP Tokens, you can now use them with /vip.");
tmpintrate = 15;
}
else if(PlayerInfo[i][pDonateRank] == 4)
{
PlayerInfo[i][pVIPTokens] += 5;
SendClientMessage(i, COLOR_YELLOW, "Great job, you have earned 5 VIP Tokens, you can now use them with /vip.");
tmpintrate = 25;
}
if(PlayerInfo[i][pPhousekey] == 1)
{
tmpintrate = 2;
}
if(PlayerInfo[i][pPbiskey] == 1)
{
tmpintrate = 2;
}
if(PlayerInfo[i][pPhousekey] >= 1 && PlayerInfo[i][pPbiskey] >= 1)
{
tmpintrate = 3;
}
if(PlayerInfo[i][pPhousekey] >= 1 && PlayerInfo[i][pPbiskey] >= 1 && PlayerInfo[i][pDonateRank] == 1)
{
tmpintrate = 8;
}
else if(PlayerInfo[i][pPhousekey] >= 1 && PlayerInfo[i][pPbiskey] >= 1 && PlayerInfo[i][pDonateRank] == 2)
{
tmpintrate = 12;
}
else if(PlayerInfo[i][pPhousekey] >= 1 && PlayerInfo[i][pPbiskey] >= 1 && PlayerInfo[i][pDonateRank] == 3)
{
tmpintrate = 20;
}
else if(PlayerInfo[i][pPhousekey] >= 1 && PlayerInfo[i][pPbiskey] >= 1 && PlayerInfo[i][pDonateRank] == 4)
{
tmpintrate = 30;
}
GetPlayerName(i, sendername, sizeof(sendername));
account = PlayerInfo[i][pAccount];
if(PlayerInfo[i][pPayDay] >= 5)
{
GetPlayerName(i, playername2, sizeof(playername2));
if(housekey != 0)
{
rent = HouseInfo[housekey][hRent];
if(strcmp(playername2, HouseInfo[housekey][hOwner], true) == 0)
{
rent = 0;
}
else if(rent > GetPlayerMoney(i))
{
PlayerInfo[i][pPhousekey] = 0;
SendClientMessage(i, COLOR_LIGHTRED, "You have been evicted from the House owner.");
rent = 0;
}
HouseInfo[housekey][hCash] = HouseInfo[housekey][hCash]+rent;
SaveHouse(housekey);
}
new checks = PlayerInfo[i][pPayCheck]; //paycheck amount
new incometax = PlayerInfo[i][pPayCheck] / 50 * Tax; //income tax amount
// House Electricity Bills
new randomv1 = random(1000);
new ebill1 = (randomv1*HouseInfo[housekey][hLevel])/2;
if(PlayerInfo[i][pPhousekey] >= 1)
{
PlayerInfo[i][pCash] = PlayerInfo[i][pCash]-ebill1;
GivePlayerMoney(i, -ebill1);
}
// Business Electricity Bills
new randomv2 = random(1000);
new ebill2 = (randomv2*BizzInfo[bizkey][bLevelNeeded])/2;
if(PlayerInfo[i][pPbiskey] >= 1)
{
PlayerInfo[i][pCash] = PlayerInfo[i][pCash]-ebill2;
GivePlayerMoney(i, -ebill2);
}
PlayerInfo[i][pCash] = PlayerInfo[i][pCash]+checks-incometax;
GivePlayerMoney(i, checks-incometax);
//TAX MONEY
TaxValue = TaxValue+incometax;
//INTEREST
interest = (PlayerInfo[i][pAccount]/1200)*(tmpintrate); //bank interest
PlayerInfo[i][pAccount] = account+interest; //add interest money to bank
//EXP
new Float:x, Float:y, Float:z,Float:distance = 3.0;
GetPlayerPos(i,x,y,z);
if(IsPlayerInRangeOfPoint(i,3.0,x,y,z))
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/ebpg8v1671/payday_song.mp3",x,y,z,distance,0);
PlayerInfo[i][pExp]++; //experience points
SendClientMessage(i, COLOR_WHITE, "|___ BANK STATEMENT ___|");
format(string, sizeof(string), " Paycheck: $%d | Tax Money: -$%d (%d percent)", checks, incometax, TaxValue);
SendClientMessage(i, COLOR_GRAD1, string);
if(PlayerInfo[i][pPhousekey] >= 1)
{
format(string, sizeof(string), " House Electricity Bill: -$%d", ebill1);
SendClientMessage(i, COLOR_GRAD1, string);
}
if(PlayerInfo[i][pPbiskey] >= 1)
{
format(string, sizeof(string), " Business Electricity Bill: -$%d", ebill2);
SendClientMessage(i, COLOR_GRAD1, string);
}
format(string, sizeof(string), " Rent: -$%d", rent);
SendClientMessage(i, COLOR_GRAD1, string);
format(string, sizeof(string), " Balance: $%d", account);
SendClientMessage(i, COLOR_GRAD1, string);
if(PlayerInfo[i][pDonateRank] == 0)
{
format(string, sizeof(string), " Interest rate: 0.%d percent",tmpintrate);
SendClientMessage(i, COLOR_GRAD2, string);
}
else if(PlayerInfo[i][pDonateRank] == 1)
{
format(string, sizeof(string), " Interest rate: 0.%d percent",tmpintrate);
SendClientMessage(i, COLOR_GRAD2, string);
}
else if(PlayerInfo[i][pDonateRank] == 2)
{
format(string, sizeof(string), " Interest rate: 0.%d percent",tmpintrate);
SendClientMessage(i, COLOR_GRAD2, string);
}
else if(PlayerInfo[i][pDonateRank] == 3)
{
tmpintrate = tmpintrate/10;
format(string, sizeof(string), " Interest rate: %d percent",tmpintrate);
SendClientMessage(i, COLOR_GRAD2, string);
}
else if(PlayerInfo[i][pDonateRank] == 4)
{
tmpintrate = tmpintrate/10;
format(string, sizeof(string), " Interest rate: %d percent",tmpintrate);
SendClientMessage(i, COLOR_GRAD2, string);
}
format(string, sizeof(string), " Interest gained $%d", interest);
SendClientMessage(i, COLOR_GRAD3, string);
SendClientMessage(i, COLOR_GRAD4, "|------------------------------------------|");
format(string, sizeof(string), " New Balance: $%d", PlayerInfo[i][pAccount]);
SendClientMessage(i, COLOR_GRAD5, string);
format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck");
GameTextForPlayer(i, string, 5000, 1);
PlayerInfo[i][pPayDay] = 0;
PlayerInfo[i][pPayCheck] = 0;
PlayerInfo[i][pConnectTime] += 1;
}
else
{
SendClientMessage(i, COLOR_LIGHTRED, "* You haven't played long enough to obtain a Paycheck.");
new Float:x, Float:y, Float:z,Float:distance = 3.0;
GetPlayerPos(i,x,y,z);
if(IsPlayerInRangeOfPoint(i,3.0,x,y,z))
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/ebpg8v1671/payday_song.mp3",x,y,z,distance,0);
}
}
}
}
return 1;
}