05.04.2012, 10:24
Someone help me with this payday system all the time says ''You haven't played long enough to obtain a Paycheck."
Код:
public PayDay() { new string[128]; new account,interest; //foreach(Player, i) for(new i; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pLevel] > 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); 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); } new sendername[MAX_PLAYER_NAME]; new tmpintrate = 1; //interest rate if(PlayerInfo[i][pDonateRank] == 1){ tmpintrate = 3; } GetPlayerName(i, sendername, sizeof(sendername)); account = PlayerInfo[i][pAccount]; //bank account amount if(PlayerInfo[i][pPayDay] >= 5) { new checks = PlayerInfo[i][pPayCheck]; //paycheck amount new incometax = PlayerInfo[i][pPayCheck] / 100 * Tax; //income tax amount PlayerInfo[i][pCash] = PlayerInfo[i][pCash]+checks-incometax; //give money GivePlayerMoney(i, checks-incometax); //give money //TAX MONEY TaxValue = TaxValue+incometax; //ELECTRICITY new randomv = random(1000); //INTEREST interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate); //bank interest PlayerInfo[i][pAccount] = account+interest; //add interest money to bank //EXP PlayerInfo[i][pExp]++; //experience points SendClientMessage(i, COLOR_WHITE, "|___ BANK STATEMENT ___|"); format(string, sizeof(string), " Paycheck: $%d", checks); SendClientMessage(i, COLOR_GRAD1, string); format(string, sizeof(string), " Income Tax: -$%d", incometax); SendClientMessage(i, COLOR_GRAD1, string); format(string, sizeof(string), " Balance: $%d", account); SendClientMessage(i, COLOR_GRAD1, 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_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."); } } } } return 1; }