14.01.2011, 16:39
Quote:
public PayDay() { if (gdebug >= 1){printf("DEBUG PayDay()");} new string[128]; new pay,account,interest; new rent = 0; for(new i = 0; i <= MAX_PLAYERS; i++) { if(IsPlayerConnected(i) == 1 && PlayerInfo[i][pLevel] > 0) { new playername2[MAX_PLAYER_NAME]; GetPlayerName(i, playername2, sizeof(playername2)); account = PlayerInfo[i][pAccount]; new key = PlayerInfo[i][pPhousekey]; if(key != -1) { rent = HouseInfo[key][hRent]; if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0) { rent = 0; } else if(rent > GetPlayerMoney(i)) { PlayerInfo[i][pPhousekey] = -1; SendClientMessage(i, COLOR_WHITE, "You have been evicted"); rent = 0; } HouseInfo[key][hTakings] = HouseInfo[key][hTakings]+rent; } new tmpintrate; if (key != -1 && strcmp(playername2, HouseInfo[key][hOwner], true) == 0) { if(PlayerInfo[i][pAdmin] > 1) { tmpintrate = intrate+4; } else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel] } else { if(PlayerInfo[i][pAdmin] > 1) { tmpintrate = 3; } else { tmpintrate = 1; } } interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate); pay = PlayerInfo[i][pLevel]*paycheck; PlayerInfo[i][pExp]++; PlayerPlayMusic(i); SafeGivePlayerMoney(i,pay-rent); PlayerInfo[i][pAccount] = account+interest; BizzInfo[4][bTakings] = BizzInfo[4][bTakings]+((PlayerInfo[i][pAccount]/1000)+intrate); SendClientMessage(i, COLOR_GREEN, "|___ BANK STATMENT ___|"); format(string, sizeof(string), " Balance: $%d", account); SendClientMessage(i, COLOR_WHITE, string); format(string, sizeof(string), " Interest Rate: 0.%d percent",tmpintrate); SendClientMessage(i, COLOR_WHITE, string); format(string, sizeof(string), " Interest Gained $%d", interest); SendClientMessage(i, COLOR_WHITE, string); SendClientMessage(i, COLOR_GREEN, "|--------------------------------------|"); format(string, sizeof(string), " New Balance: $%d", PlayerInfo[i][pAccount]); SendClientMessage(i, COLOR_WHITE, string); format(string, sizeof(string), " Rent: -$%d", rent); SendClientMessage(i, COLOR_WHITE, string); format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck ~n~~g~$%d", pay); GameTextForPlayer(i, string, 5000, 1); rent = 0; PlayerInfo[i][pPayDay] = 0; 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."); } } Checkprop(); return 1; } |