Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PayDay() {
- new hour,minn,sec;
- gettime(hour,minn,sec);
- if(minn == 0 && Paydaydat == 0) PayDay2();
- return true;
- }
- CMD:payday(playerid, params[]) {
- if(PlayerInfo[playerid][pAdmin] < 6) return AdmOnly(playerid);
- PayDay2();
- return true;
- }
- function PayDay2() {
- SetTimer("ResetPD", 60000, false);
- Paydaydat = 1;
- new string[128];
- new interest,account[MAX_PLAYERS];
- new rent[MAX_PLAYERS];
- SetTimer("ScadeLicentele", 4000, false);
- foreach(Player,i) {
- if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1) {
- new key = PlayerInfo[i][pHouse];
- if(key != 999)
- {
- rent[i] = HouseInfo[key][hRent];
- HouseInfo[key][hTakings] += rent[i];
- }
- new tmpintrate;
- SCM(i, COLOR_SERVER, "------------------------------------------------------------------------------------------------");
- if(PlayerInfo[i][pPremiumAccount] == 1)
- {
- tmpintrate = 2;
- PlayerInfo[i][pPayDayHad] += 1;
- if(PlayerInfo[i][pPayDayHad] >= 5) {
- PlayerInfo[i][pExp]++;
- PlayerInfo[i][pPayDayHad] = 0;
- }
- new bonus = PlayerInfo[i][pPayCheck] / 2;
- PlayerInfo[i][pPayCheck] += bonus;
- }
- else
- {
- tmpintrate = 1;
- }
- account[i] = PlayerInfo[i][pAccount];
- Tax += TaxValue;
- //PlayerInfo[i][pAccount] -= TaxValue;
- new checks = PlayerInfo[i][pLevel]*2500+random(3000);
- if(PlayerInfo[i][pDailyLogin] == 0) checks = checks*2;
- GivePlayerCash(i, checks);
- interest = (PlayerInfo[i][pAccount]/5000)*(tmpintrate);
- if(PlayerInfo[i][pDailyLogin] == 0) interest = interest*2;
- if(PlayerInfo[i][pDailyLogin] == 0) PlayerInfo[i][pExp] += 2;
- else PlayerInfo[i][pExp] += 1;
- //[pet bonus]
- new bani = 30000 + random(30000);
- if(PlayerInfo[i][pPetLevel] < 3) {
- PlayerInfo[i][pExp] += 1; }
- else if(PlayerInfo[i][pPetLevel] > 3) {
- PlayerInfo[i][pExp] += 2;
- GivePlayerCash(i, bani*PlayerInfo[i][pPetLevel]);
- Update(i, pCashx);
- }
- PlayerInfo[i][pPetPoints] += 10;
- Update(i, pPetPointsx);
- PlayerInfo[i][pSpinPoints] ++; UpdateVar(i, "SpinPoints", PlayerInfo[i][pSpinPoints]);
- Update(i, pRP);
- UpdateProgress(i, 0);
- PlayerInfo[i][pAccount] += interest+1000;
- SCM(i, COLOR_WHITE, "Salariul tau a sosit! Viziteaza banca pentru a retrage banii.");
- format(string, sizeof(string), "Ai primit %0.2f ore jucate. (%.0f minute)", PlayerInfo[i][pSeconds]/3600, PlayerInfo[i][pSeconds]/60);
- SCM(i, COLOR_WHITE, string);
- PlayerInfo[i][pConnectTime] += PlayerInfo[i][pSeconds]/3600;
- if(PlayerInfo[i][pSeconds] >= 1800) {
- new query[180];
- format(query, sizeof(query), "UPDATE `users` SET `DayHours`=`DayHours`+1 WHERE `ID`='%d'", PlayerInfo[i][pSQLID]);
- mysql_query(SQL, query);
- format(query, sizeof(query), "UPDATE `users` SET `HoursMonth`=`HoursMonth`+1 WHERE `ID`='%d'", PlayerInfo[i][pSQLID]);
- mysql_query(SQL, query);
- if(PlayerInfo[i][pGiftPoints] < 5) {
- PlayerInfo[i][pGiftPoints] ++;
- Update(i, pGiftPointsx);
- }
- }
- PlayerInfo[i][pSeconds] = 0;
- if(PlayerInfo[i][pDailyLogin] == 0) {
- PlayerInfo[i][pDailyLogin] = 1;
- UpdateVar(i, "DailyLogin", 1);
- SCM(i, COLOR_LIGHTBLUE, "Ai primit de doua ori mai multe respect points si bani pentru primul tau payday de astazi.");
- }
- if(PlayerInfo[i][pHouse] != 999) {
- format(string, sizeof(string), "Paycheck: $%s | Rent: -$%d | Old Balance: $%s", FormatNumber(checks), HouseInfo[PlayerInfo[i][pHouse]][hRent], FormatNumber(account[i]));
- SCM(i, COLOR_GREY, string);
- format(string, sizeof(string), "Interest rate: 0.%d% | Interest: $%s | New balance: $%s", tmpintrate, FormatNumber(interest), FormatNumber(PlayerInfo[i][pAccount]));
- SCM(i, COLOR_GREY, string);
- }
- else {
- format(string, sizeof(string), "Paycheck: $%s | Rent: -$0 | Old Balance: $%s", FormatNumber(checks), FormatNumber(account[i]));
- SCM(i, COLOR_GREY, string);
- format(string, sizeof(string), "Interest rate: 0.%d% | Interest: $%s | New balance: $%s", tmpintrate, FormatNumber(interest), FormatNumber(PlayerInfo[i][pAccount]));
- SCM(i, COLOR_GREY, string);
- }
- /*if(PlayerInfo[playerid][pHouse] != 999) {
- PlayerTextDrawString(playerid, PaydayTD[1], "~h~~w~PAYDAY~n~~h~~n~~h~Bank Balance: $%s ~n~~w~Interest: $%s ~n~~w~Rent: $%d", FormatNumber(PlayerInfo[playerid][pAccount]), FormatNumber(interest), HouseInfo[PlayerInfo[playerid][pHouse]][hRent]);
- PlayerTextDrawShow(playerid, PaydayTD[1]);
- SetTimerEx("HidePayday", 8000, false, "i", playerid);
- }
- else {
- PlayerTextDrawString(playerid, PaydayTD[1], "~h~~w~PAYDAY~n~~h~~n~~h~Bank Balance: $%s ~n~~w~Interest: $%s ~n~~w~Rent: $0", FormatNumber(PlayerInfo[playerid][pAccount]), FormatNumber(interest));
- PlayerTextDrawShow(playerid, PaydayTD[1]);
- SetTimerEx("HidePayday", 8000, false, "i", playerid);
- }*/
- if(PlayerInfo[i][pPet] == 1) {
- PlayerInfo[i][pPayDay] = 0;
- PlayerInfo[i][pPayCheck] = 0;
- if(PlayerInfo[i][pPetLevel] < 3) {SCMEx(i, COLOR_YELLOW, "Deoarece pet-ul tau are level %d ai primit +1RP",PlayerInfo[i][pPetLevel]);}
- else SCMEx(i, COLOR_YELLOW, "Ai primit +2 RP si $%s deoarece pet-ul tau are level %d",FormatNumber(bani),PlayerInfo[i][pPetLevel]);
- SendClientMessage(i, COLOR_SERVER, "------------------------------------------------------------------------------------------------");
- }
- }
- }
- if(hour == 21) {
- new gold = 1 + random(4);
- new money = 10000 + random(5000);
- for(new h = 0; h < MAX_CLANS; h++) {
- if(strlen(ClanInfo[h][clName]) != 0) {
- if(GetClanTurfs(h) >= 10) {
- foreach(Player, i) {
- if(PlayerInfo[i][pClan] == h && h != 0) {
- PlayerInfo[i][pPremiumPoints] += gold;
- Update(i, pPremiumPointsx);
- GivePlayerCash(i, money);
- format(string, sizeof(string), "Ai primit %d puncte premium si $%s deoarece clanul tau are peste 10 teriotrii.", gold, FormatNumber(money));
- SCM(i, COLOR_MONEY, string);
- }
- }
- }
- }
- }
- }
- if(RestartPayday == 1) {
- SCMTA(COLOR_CLIENT, "Server-ul a fost restartat! Va rugam sa reveniti.");
- GameModeExit();
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement