14.01.2010, 08:41
I have completed my payday system but unsure on why its not working correctly.
I've got:
then:
This is what happens when its time for payday:
GTA:SAMP
Open in fullscreen if you cannot read but it Gives $8 then $1 then $0 and repeats its self with $1's and $0's.
Why is this happening?
I've got:
Код:
new level = PlayerInfo[i][pLevel];
new leader = PlayerInfo[i][pLeader];
new member = PlayerInfo[i][pMember];
if(level >= 0 && level <= 2) { PlayerInfo[i][pPayCheck] += 1; }
else if(level >= 3 && level <= 4) { PlayerInfo[i][pPayCheck] += 2; }
else if(level >= 5 && level <= 6) { PlayerInfo[i][pPayCheck] += 3; }
else if(level >= 7 && level <= 8) { PlayerInfo[i][pPayCheck] += 4; }
else if(level >= 9 && level <= 10) { PlayerInfo[i][pPayCheck] += 5; }
else if(level >= 11 && level <= 12) { PlayerInfo[i][pPayCheck] += 6; }
else if(level >= 13 && level <= 14) { PlayerInfo[i][pPayCheck] += 7; }
else if(level >= 15 && level <= 16) { PlayerInfo[i][pPayCheck] += 8; }
else if(level >= 17 && level <= 18) { PlayerInfo[i][pPayCheck] += 9; }
else if(level >= 19 && level <= 20) { PlayerInfo[i][pPayCheck] += 10; }
else if(level >= 21) { PlayerInfo[i][pPayCheck] += 11; }
else if(leader == 2) { PlayerInfo[i][pPayCheck] += 5; }
else if(member == 2) { PlayerInfo[i][pPayCheck] += 3; }
else if(leader == 3) { PlayerInfo[i][pPayCheck] += 6; }
else if(member == 3) { PlayerInfo[i][pPayCheck] += 4; }
else if(leader == 4) { PlayerInfo[i][pPayCheck] += 6; }
else if(member == 4) { PlayerInfo[i][pPayCheck] += 4; }
else if(leader == 1) { PlayerInfo[i][pPayCheck] += 3; }
else if(member == 1) { PlayerInfo[i][pPayCheck] += 2; }
Код:
public PayDay()
{
for (new i=0; i<MAX_POINTS; i++)
{
Points[i][Announced] = 0;
if (Points[i][Vulnerable] > 0)
{
Points[i][Vulnerable]--;
UpdatePoints();
}
}
new string[128];
new account,interest;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pLevel] > 0)
{
if(MoneyMessage[i]==1)
{
SendClientMessage(i, COLOR_LIGHTRED, "You failed to pay your debt, Jail time.");
GameTextForPlayer(i, "~r~Busted!", 2000, 1);
SetPlayerInterior(i, 6);
PlayerInfo[i][pInt] = 6;
SetPlayerPos(i, 264.6288,77.5742,1001.0391);
PlayerInfo[i][pJailed] = 1;
SafeResetPlayerWeapons(i);
WantedPoints[i] = 0;
PlayerInfo[i][pJailTime] = 240;
format(string, sizeof(string), "You are jailed for %d seconds. Bail: Unable", PlayerInfo[i][pJailTime]);
SendClientMessage(i, COLOR_WHITE, string);
}
new playername2[MAX_PLAYER_NAME];
GetPlayerName(i, playername2, sizeof(playername2));
account = PlayerInfo[i][pBank];
new key = PlayerInfo[i][pHouseKey];
new tmpintrate;
if (key != 255 && strcmp(playername2, PlayerInfo[key][pOwnsHouse], true) == 0)
{
if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = intrate+4; }
else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel]
}
else
{
if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = 3; }
else { tmpintrate = 1; }
}
if(PlayerInfo[i][pPayDay] >= 0)
{
Tax += TaxValue;//Should work for every player online
PlayerInfo[i][pBank] -= TaxValue;
new checks = PlayerInfo[i][pPayCheck] / 5;
if(PlayerInfo[i][pDonateRank] > 0)
{
new bonus = PlayerInfo[i][pPayCheck] / 10;
checks += bonus;
}
new ebill = (PlayerInfo[i][pBank]/10000)*(PlayerInfo[i][pLevel]);
//ConsumingMoney[i] = 1;
//SafeGivePlayerMoney(i, checks);
account += checks;
if(PlayerInfo[i][pBank] > 0)
{
PlayerInfo[i][pBank] -= ebill;
}
else
{
ebill = 0;
}
interest = (PlayerInfo[i][pBank]/1000)*(tmpintrate);
PlayerInfo[i][pExp]++;
PlayerInfo[i][pBank] = account+interest;
SendClientMessage(i, COLOR_GREEN, "|___ BANK STATMENT ___|");
format(string, sizeof(string), " Paycheck: $%d Tax Money: -$%d", checks, TaxValue);
SendClientMessage(i, COLOR_WHITE, string);
if(PlayerInfo[i][pHouseKey] != 255)
{
format(string, sizeof(string), " Electricity Bill: -$%d", ebill);
SendClientMessage(i, COLOR_GRAD1, string);
}
format(string, sizeof(string), " Balance: $%d", account - checks);
SendClientMessage(i, COLOR_WHITE, string);
format(string, sizeof(string), " Interest Rate: 0.%d percent",tmpintrate);
SendClientMessage(i, COLOR_GRAD2, string);
format(string, sizeof(string), " Interest Gained $%d", interest);
SendClientMessage(i, COLOR_GRAD3, string);
SendClientMessage(i, COLOR_GREEN, "|--------------------------------------|");
format(string, sizeof(string), " New Balance: $%d", PlayerInfo[i][pBank]);
SendClientMessage(i, COLOR_GRAD5, string);
format(string, sizeof(string), "~y~PayDay~n~~w~Check paid into your account");
GameTextForPlayer(i, string, 5000, 1);
PlayerInfo[i][pPayDay] = 0;
PlayerInfo[i][pPayCheck] = 0;
PlayerInfo[i][pPlayingHours] += 1;
if(PlayerInfo[i][pDonateRank] > 0)
{
PlayerInfo[i][pPayDayHad] += 1;
if(PlayerInfo[i][pPayDayHad] >= 5)
{
PlayerInfo[i][pExp]++;
PlayerInfo[i][pPayDayHad] = 0;
}
}
}
else
{
SendClientMessage(i, COLOR_WHITE, "* You haven't played long enough to obtain a PayDay.");
}
}
}
}
SaveAccounts();
return 1;
}
GTA:SAMP
Open in fullscreen if you cannot read but it Gives $8 then $1 then $0 and repeats its self with $1's and $0's.
Why is this happening?

