Advertisement
Guest User

Untitled

a guest
Nov 12th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.97 KB | None | 0 0
  1. public PayDay()
  2. {
  3. new string[128],
  4. str[256],
  5. string3[128],
  6. interest,
  7. account[MAX_PLAYERS],
  8. hour,
  9. minn,
  10. sec,
  11. expamount,
  12. rent[MAX_PLAYERS];
  13. gettime(hour,minn,sec);
  14. foreach(Player,i)
  15. {
  16. if(IsPlayerConnected(i))
  17. {
  18. if(PlayerInfo[i][pLevel] >= 0)
  19. {
  20. new wakaname[25];
  21. GetPlayerName(i,wakaname,sizeof(wakaname));
  22. if(MoneyMessage[i]==1)
  23. {
  24. SendClientMessage(i, COLOR_LIGHTRED, "You failed to pay your debt, Jail time.");
  25. new rand;
  26. rand = random(sizeof(gRandomJailSpawns));
  27. SetPlayerInterior(i, 6);
  28. SetPlayerPos(i,gRandomJailSpawns[rand][0],gRandomJailSpawns[rand][1],gRandomJailSpawns[rand][2]);
  29. PlayerInfo[i][pJailed] = 1;
  30. ResetPlayerWeaponsEx(i);
  31. ResetPlayerWeapons(i);
  32. WantedPoints[i] = 0;
  33. PlayerInfo[i][pJailTime] = 240;
  34. format(string, sizeof(string), "You are jailed for %d seconds. Bail: Unable", PlayerInfo[i][pJailTime]);
  35. SendClientMessage(i, COLOR_LIGHTBLUE, string);
  36. Update(i,pJailedx);
  37. Update(i,pJailTimex);
  38. TogglePlayerControllable(i, 0);
  39. SetTimerEx("UnFreezeStation", 1000, false, "i", i);
  40. }
  41. new playername2[MAX_PLAYER_NAME];
  42. GetPlayerName(i, playername2, sizeof(playername2));
  43. new key = PlayerInfo[i][pPhousekey];
  44. if(key != 999)
  45. {
  46. rent[i] = HouseInfo[key][hRent];
  47. if(rent[i] > GetPlayerCash(i) && strcmp(playername2, HouseInfo[key][hOwner], false) == 0)
  48. {
  49. PlayerInfo[i][pPhousekey] = 999;
  50. Update(i,pPhousekeyx);
  51. }
  52. HouseInfo[key][hTakings] += rent[i];
  53. mysql_format(SQL,str,sizeof(str),"UPDATE `houses` SET `Takings`='%d' WHERE `ID`='%d'",HouseInfo[key][hTakings],key);
  54. mysql_tquery(SQL,str,"","");
  55. }
  56. if(PlayerInfo[i][pPayDay] >= 5)
  57. {
  58. new tmpintrate;
  59. if(PlayerInfo[i][pPremiumAccount] == 1)
  60. {
  61. tmpintrate = 2;
  62. PlayerInfo[i][pPayDayHad] += 1;
  63. if(PlayerInfo[i][pPayDayHad] >= 5)
  64. {
  65. PlayerInfo[i][pExp]++;
  66. PlayerInfo[i][pPayDayHad] = 0;
  67. SCM(i,COLOR_LIGHTBLUE,"You got 1 respect point bonus because you have premium account.");
  68. }
  69. new bonus = PlayerInfo[i][pPayCheck] / 2;
  70. PlayerInfo[i][pPayCheck] += bonus;
  71. }
  72. else
  73. {
  74. tmpintrate = 1;
  75. }
  76. account[i] = PlayerInfo[i][pAccount];
  77. Tax += TaxValue;
  78. PlayerInfo[i][pAccount] -= TaxValue;
  79. new checks = PlayerInfo[i][pPayCheck],
  80. ebill = (PlayerInfo[i][pLevel]*SBizzInfo[14][sbEntranceCost]/100);
  81. PlayerInfo[i][pAccount] += checks;
  82. interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate);
  83. PlayerInfo[i][pExp] += 1;
  84. PlayerInfo[i][pAccount] += interest;
  85. SendClientMessage(i, COLOR_TEAL, "----------------------------------------------------------------------------");
  86. SendClientMessage(i, COLOR_WHITE, "Your paycheck has arrived; please visit the bank to withdraw your money.");
  87. format(string, sizeof(string), "Paycheck: $%s | Bank balance: $%s | Bank interest: $%s | Tax: $%s (10 percent)", FormatNumber(checks), FormatNumber(PlayerInfo[i][pAccount]), FormatNumber(interest), FormatNumber(TaxValue));
  88. SendClientMessage(i, COLOR_GREY, string);
  89. format(string3, sizeof(string3), "Rent: $%s | Total earnings: $%d", FormatNumber(rent[i]), checks-TaxValue);
  90. SendClientMessage(i, COLOR_GREY, string3);
  91. SendClientMessage(i, COLOR_TEAL, "----------------------------------------------------------------------------");
  92. if(PlayerInfo[i][pAccount] >= ebill && key != 999 && strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
  93. {
  94. PlayerInfo[i][pAccount] -= ebill;
  95. SBizzInfo[14][sbTill] += ebill;
  96. mysql_format(SQL,str,sizeof(str),"UPDATE `sbizz` SET `Till`='%d' WHERE `ID`='14'",SBizzInfo[14][sbTill]);
  97. mysql_tquery(SQL,str,"","");
  98. }
  99. else
  100. {
  101. ebill = 0;
  102. }
  103. format(string, sizeof(string), "~y~payday");
  104. GameTextForPlayer(i, string, 5000, 1);
  105. PlayerInfo[i][pPayDay] = 0;
  106. PlayerInfo[i][pPayCheck] = 0;
  107. if(PlayerInfo[i][pCarLicT] > 0)
  108. {
  109. PlayerInfo[i][pCarLicT] -= 1;
  110. }
  111. if(PlayerInfo[i][pFlyLicT] > 0)
  112. {
  113. PlayerInfo[i][pFlyLicT] -= 1;
  114. }
  115. if(PlayerInfo[i][pBoatLicT] > 0)
  116. {
  117. PlayerInfo[i][pBoatLicT] -= 1;
  118. }
  119. if(PlayerInfo[i][pGunLicT] > 0)
  120. {
  121. PlayerInfo[i][pGunLicT] -= 1;
  122. }
  123. if(PlayerInfo[i][pRob] < 10)
  124. {
  125. PlayerInfo[i][pRob]++;
  126. }
  127. if(PlayerInfo[i][pFpunish] > 0)
  128. {
  129. PlayerInfo[i][pFpunish]--;
  130. }
  131. if(PlayerInfo[i][pSleeping] == 0)
  132. {
  133. PlayerInfo[i][pConnectTime] += 1;
  134. }
  135. if(IsACop(i))
  136. {
  137. PlayerInfo[i][pLawyer] += 1;
  138. }
  139. if(PlayerInfo[i][pLevel] == 1 || PlayerInfo[i][pLevel] == 2 || PlayerInfo[i][pLevel] == 3 || PlayerInfo[i][pLevel] == 4)
  140. {
  141. expamount = PlayerInfo[i][pLevel]*2;
  142. if(PlayerInfo[i][pExp] >= expamount)
  143. {
  144. SCM(i,COLOR_LIGHTBLUE,"** You can use buylevel because you have necessary respect points.");
  145. }
  146. }
  147. else if(PlayerInfo[i][pLevel] >= 5)
  148. {
  149. expamount = PlayerInfo[i][pLevel]*3;
  150. if(PlayerInfo[i][pExp] >= expamount)
  151. {
  152. SCM(i,COLOR_LIGHTBLUE,"** You can use buylevel because you have necessary respect points.");
  153. }
  154. }
  155. }
  156. else
  157. {
  158. SendClientMessage(i, COLOR_LIGHTRED, "* You haven't played long enough to obtain a PayDay.");
  159. }
  160. }
  161. }
  162. }
  163. for(new x = 0; x < MAX_GROUPS; x++)
  164. {
  165. DynamicFactions[x][fBank] += DynamicFactions[x][fPaydayMoney];
  166. mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Bank`='%d' WHERE `ID`='%d'",DynamicFactions[x][fBank],x);
  167. mysql_tquery(SQL,str,"","");
  168. }
  169. return 1;
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement