27.03.2014, 09:45
(
Last edited by SiraBots; 23/06/2016 at 10:44 AM.
)
Delete this thread.
public OnGameModeInit() { SetTimer_("IsPayday", 500, 1000, -1); }
forward IsPayday(); public IsPayday() { new hour,mxn,sec; gettime(hour, mxn, sec); if(sec == 00 && mxn == 00) { print("Payday"); foreach(new i : Player) { if(Logged[i] && cInfo[i][cFirstLogin] <= 0 && Tutorial[i] <= 0) Call_Payday(i); } } return 1; }
stock Call_Payday(playerid) { new rentprice = hInfo[cInfo[playerid][cRenting]][RentPrice]; new Float:calculateSavings = cInfo[playerid][cSavings]*1.005; new calculatedSavings = floatround(calculateSavings, floatround_round); new Float:calculateBank = cInfo[playerid][cBank]*1.002; new calculatedBank = floatround(calculateBank, floatround_round); new calculatePaycheck; if(cInfo[playerid][cFaction] > 0) calculatePaycheck = (cInfo[playerid][cRank] * 250) + RandomEx(1500, 1750); else calculatePaycheck = RandomEx(1000, 1100) + cInfo[playerid][cPaycheck]; CPF(playerid, 0x33AA33FF, "_________ PAYDAY INCOME _________"); CPF(playerid, COLOR_FADE1, "Interest Gained: 0.2"); if(cInfo[playerid][cSavings] > 0) CPF(playerid, COLOR_FADE1, "Savings Gained: 0.5"); CPF(playerid, COLOR_FADE1, "Paycheck: $%d", calculatePaycheck); if(cInfo[playerid][cRenting] > 0 && cInfo[playerid][cBank] >= rentprice) CPF(playerid, COLOR_RED, "Rent: -$%d", rentprice); else if(cInfo[playerid][cRenting] > 0 && cInfo[playerid][cBank] < rentprice) cInfo[playerid][cRenting] = 0, CPF(playerid, COLOR_RED, "You have been evicted from your rented house due to lack of payment."); CPF(playerid, COLOR_FADE1, "------------------------"); CPF(playerid, COLOR_FADE1, "Old Balance: $%d", cInfo[playerid][cBank]); CPF(playerid, COLOR_FADE1, "New Balance: $%d", calculatedBank + calculatePaycheck); CPF(playerid, COLOR_FADE1, "------------------------"); if(cInfo[playerid][cSavings] > 0) { CPF(playerid, COLOR_FADE1, "Old Savings Balance: $%d", cInfo[playerid][cSavings]); CPF(playerid, COLOR_FADE1, "New Savings Balance: $%d", calculatedSavings); } format(gString, sizeof(gString), "~w~Paycheck~n~~g~+$%d", calculatePaycheck); GameTextForPlayer(playerid, gString, 3200, 1); if(cInfo[playerid][cRenting] > 0 && cInfo[playerid][cBank] >= rentprice) cInfo[playerid][cBank] = calculatedBank + calculatePaycheck - rentprice; else cInfo[playerid][cBank] = calculatedBank + calculatePaycheck; if(cInfo[playerid][cSavings] >= 20000000) cInfo[playerid][cSavings] = 20000000; else if(cInfo[playerid][cSavings] > 0) cInfo[playerid][cSavings] = calculatedSavings; new nxtlevel = cInfo[playerid][cLevel]+1; new expamount = nxtlevel*4; cInfo[playerid][cEXP] += 1; if(cInfo[playerid][cEXP] >= expamount) { cInfo[playerid][cLevel] += 1; cInfo[playerid][cEXP] = 0; CPF(playerid, -1, "Level up! You are now level %d.", cInfo[playerid][cLevel]); } if(cInfo[playerid][cJob] > 0) cInfo[playerid][cJobHours] += 1; cInfo[playerid][cTotalHours] += 1; cInfo[playerid][cPaycheck] = 0; return 1; }