Guest User

Untitled

a guest
Aug 13th, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.17 KB | None | 0 0
  1. public PayDay()
  2. {
  3. new string[128];
  4. new account,interest;
  5. new rent = 0;
  6. GiftAllowed = 1;
  7. foreach(Player, i)
  8. if(TimeAfterBankJob < TIME_BETWEEN_BANKJOBS) TimeAfterBankJob += 1;
  9. for(new i = 0; i < MAX_PLAYERS; i++)
  10. {
  11. if(PlayerInfo[i][pLevel] > 0)
  12. {
  13. if(MoneyMessage[i]==1)
  14. {
  15. if( PlayerInfo[i][pJailed] < 1 && !IsACop(i))
  16. {
  17. format(string,sizeof(string),"You're failing to pay your debt of $%d - now the police are on the look out for you.",GetPlayerCash(i));
  18. SendClientMessageEx(i, COLOR_LIGHTRED, string);
  19. if(PlayerInfo[i][pWantedLevel] < 6) PlayerInfo[i][pWantedLevel] += 1;
  20. PlayerInfo[i][pCrimes] += 1;
  21. SetPlayerWantedLevel(i, PlayerInfo[i][pWantedLevel]);
  22. }
  23. }
  24. account = PlayerInfo[i][pAccount];
  25. if(PlayerInfo[i][pRenting] != INVALID_HOUSE_ID)
  26. {
  27. if(HouseInfo[PlayerInfo[i][pRenting]][hRentFee] > PlayerInfo[i][pAccount])
  28. {
  29. PlayerInfo[i][pRenting] = INVALID_HOUSE_ID;
  30. SendClientMessageEx(i, COLOR_WHITE, "You have been evicted.");
  31. }
  32. else {
  33. HouseInfo[PlayerInfo[i][pRenting]][hSafeMoney] += HouseInfo[PlayerInfo[i][pRenting]][hRentFee];
  34. PlayerInfo[i][pAccount] -= HouseInfo[PlayerInfo[i][pRenting]][hRentFee];
  35. }
  36. }
  37. new tmpintrate, faretax;
  38. tmpintrate = 1;
  39.  
  40. // REMOVED FOR INTEREST RATE/ELECTRICITY BILL FIX
  41. /*if (PlayerInfo[i][pPhousekey] != INVALID_HOUSE_ID || PlayerInfo[i][pPhousekey2] != INVALID_HOUSE_ID)
  42. {
  43. if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = intrate+2; }
  44. else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel]
  45. }
  46. else
  47. {
  48. if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = 2; }
  49. else { tmpintrate = 1; }
  50. }*/
  51.  
  52.  
  53. if(PlayerInfo[i][pLevel] <= 5) SendClientMessageEx(i,COLOR_LIGHTBLUE,"Need to travel somewhere and don't have wheels? Use '/service taxi' to call a cab!");
  54. if(PlayerInfo[i][pPayDay] >= 5)
  55. {
  56. if(GetPVarInt(i, "AdvisorDuty") == 1)
  57. {
  58. PlayerInfo[i][pDutyHours]++;
  59. }
  60. if(PlayerInfo[i][pDonateRank] > 0)
  61. {
  62. new bonus = PlayerInfo[i][pPayCheck] / 2;
  63. PlayerInfo[i][pPayCheck] += bonus;
  64. }
  65. if(SpecTimer == 1)
  66. {
  67. AddSpecialToken(i);
  68. }
  69. rent = 0;
  70. faretax = 0;
  71. new checks = PlayerInfo[i][pPayCheck];
  72. if(PlayerInfo[i][pTaxiLicense] == 1) faretax = (checks/100)*5;
  73. new Taxable = (( checks / 100 ) * TaxValue);
  74. PlayerInfo[i][pAccount] -= Taxable + faretax;
  75. Tax += Taxable + faretax;
  76.  
  77. interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate);
  78.  
  79. if(PlayerInfo[i][pDonateRank] == 0 && interest > 50000)
  80. {
  81. interest = 50000;
  82. }
  83. else if(PlayerInfo[i][pDonateRank] == 1 && interest > 100000)
  84. {
  85. interest = 100000;
  86. }
  87. else if(PlayerInfo[i][pDonateRank] == 2 && interest > 150000)
  88. {
  89. interest = 150000;
  90. }
  91. else if(PlayerInfo[i][pDonateRank] == 3 && interest > 200000)
  92. {
  93. interest = 200000;
  94. }
  95. else if(PlayerInfo[i][pDonateRank] >= 4 && interest > 250000)
  96. {
  97. interest = 250000;
  98. }
  99.  
  100.  
  101. PlayerInfo[i][pExp]++;
  102. PlayerInfo[i][pAccount] = account+interest;
  103. PlayerInfo[i][pTikis] += 1;
  104. SendClientMessageEx(i, COLOR_WHITE, "________ BANK STATEMENT ________");
  105. format(string, sizeof(string), " Paycheck: $%d | Tax Money: -$%d (%d percent)", checks, Taxable, TaxValue);
  106. SendClientMessageEx(i, COLOR_GRAD1, string);
  107.  
  108. if(PlayerInfo[i][pDonateRank] == 0)
  109. {
  110. format(string, sizeof(string), " Balance: $%d | Interest rate: 0.%d percent (50k max)", account, tmpintrate);
  111. SendClientMessageEx(i, COLOR_GRAD1, string);
  112. }
  113. else if(PlayerInfo[i][pDonateRank] == 1)
  114. {
  115. format(string, sizeof(string), " Balance: $%d | Interest rate: 0.%d percent {FFFF00}(Bronze VIP: 100k max)", account, tmpintrate);
  116. SendClientMessageEx(i, COLOR_GRAD1, string);
  117. }
  118. else if(PlayerInfo[i][pDonateRank] == 2)
  119. {
  120. format(string, sizeof(string), " Balance: $%d | Interest rate: 0.%d percent {FFFF00}(Silver VIP: 150k max)", account, tmpintrate);
  121. SendClientMessageEx(i, COLOR_GRAD1, string);
  122. }
  123. else if(PlayerInfo[i][pDonateRank] == 3)
  124. {
  125. format(string, sizeof(string), " Balance: $%d | Interest rate: 0.%d percent {FFFF00}(Gold VIP: 200k max)", account, tmpintrate);
  126. SendClientMessageEx(i, COLOR_GRAD1, string);
  127. }
  128. else if(PlayerInfo[i][pDonateRank] >= 4)
  129. {
  130. format(string, sizeof(string), " Balance: $%d | Interest rate: 0.%d percent {FFFF00}(Platinum VIP: 250k max)", account, tmpintrate);
  131. SendClientMessageEx(i, COLOR_GRAD1, string);
  132. }
  133. else if(PlayerInfo[i][pDonateRank] == 5)
  134. {
  135. format(string, sizeof(string), " Balance: $%d | Interest rate: 0.%d percent {FFFF00}(VIP Moderator: 250k max)", account, tmpintrate);
  136. SendClientMessageEx(i, COLOR_GRAD1, string);
  137. }
  138.  
  139. if(PlayerInfo[i][pTaxiLicense] == 1)
  140. {
  141. format(string, sizeof(string), " Taxi licensing fee (5 percent): -$%d",faretax);
  142. SendClientMessageEx(i, COLOR_GRAD2, string);
  143. }
  144. if(PlayerInfo[i][pMember] != 0 && PlayerInfo[i][pMember] != 8 && PlayerInfo[i][pMember] != 13)
  145. {
  146. if(Tax <= 0)
  147. {
  148. SendClientMessageEx(i,COLOR_RED,"The government is in debt; no money is available for pay.");
  149. }
  150. else
  151. {
  152. Tax -= FactionPay[PlayerInfo[i][pMember]-1][PlayerInfo[i][pRank]];
  153. format(string,sizeof(string)," Government pay: $%d", FactionPay[PlayerInfo[i][pMember]-1][PlayerInfo[i][pRank]]);
  154. SendClientMessageEx(i, COLOR_GRAD2, string);
  155. }
  156. }
  157. format(string, sizeof(string), " Interest gained: $%d", interest);
  158. SendClientMessageEx(i, COLOR_GRAD3, string);
  159. SendClientMessageEx(i, COLOR_GRAD4, "______________________________________");
  160. format(string, sizeof(string), " New balance: $%d | Rent paid: -$%d", PlayerInfo[i][pAccount],rent);
  161. SendClientMessageEx(i, COLOR_GRAD5, string);
  162.  
  163. // Removal of hourly tokens
  164. /*if(PlayerInfo[i][pDonateRank] == 2)
  165. {
  166. PlayerInfo[i][pTokens] += 3;
  167. SendClientMessageEx(i, COLOR_YELLOW, "VIP: You have received 3 tokens.");
  168. }
  169. if(PlayerInfo[i][pDonateRank] == 1)
  170. {
  171. PlayerInfo[i][pTokens] += 2;
  172. SendClientMessageEx(i, COLOR_YELLOW, "VIP: You have received 2 tokens.");
  173. }*/
  174.  
  175. new paycheck = checks - Taxable - faretax;
  176. if(PlayerInfo[i][pMember] != 0 && PlayerInfo[i][pMember] != 8 && PlayerInfo[i][pMember] != 13 && Tax >= 0)
  177. {
  178. new facmemberpay = FactionPay[PlayerInfo[i][pMember]-1][PlayerInfo[i][pRank]];
  179. GivePlayerCash(i, facmemberpay);
  180. }
  181. GivePlayerCash(i, paycheck);
  182.  
  183. GameTextForPlayer(i, "~y~PayDay~n~~w~Paycheck", 5000, 1);
  184. SendAudioToPlayer(i, 1184, 100, 0);
  185. PlayerInfo[i][pPayDay] = 0;
  186. PlayerInfo[i][pPayCheck] = 0;
  187. PlayerInfo[i][pConnectTime] += 1;
  188. if(PlayerInfo[i][pConnectTime] == 2) SendClientMessageEx(i, COLOR_LIGHTRED, "You may now possess/use weapons!");
  189. if(PlayerInfo[i][pDonateRank] > 0)
  190. {
  191. PlayerInfo[i][pPayDayHad] += 1;
  192. if(PlayerInfo[i][pPayDayHad] >= 5)
  193. {
  194. PlayerInfo[i][pExp]++;
  195. PlayerInfo[i][pPayDayHad] = 0;
  196. }
  197. }
  198. if(PlayerInfo[i][pWRestricted] > 0)
  199. {
  200. PlayerInfo[i][pWRestricted]--;
  201. if(PlayerInfo[i][pWRestricted] == 0) SendClientMessageEx(i, COLOR_LIGHTRED, "Your weapons are no longer restricted!");
  202. }
  203.  
  204. }
  205. else
  206. {
  207. SendClientMessageEx(i, COLOR_LIGHTRED, "* You haven't played long enough to obtain a paycheck.");
  208. }
  209. }
  210. }
  211. for (new x=0; x<MAX_POINTS; x++)
  212. {
  213. Points[x][Announced] = 0;
  214. if (Points[x][Vulnerable] > 0)
  215. {
  216. Points[x][Vulnerable]--;
  217. UpdatePoints();
  218. }
  219. if(Points[x][Vulnerable] == 0 && Points[x][Announced] == 1)
  220. {
  221. }
  222. if (Points[x][Vulnerable] == 0 && Points[x][Type] >= 0 && Points[x][Announced] == 0 && Points[x][ClaimerId] == INVALID_PLAYER_ID)
  223. {
  224. format(string, sizeof(string), "%s has become available for capture.", Points[x][Name]);
  225. SendClientMessageToAllEx(COLOR_YELLOW, string);
  226. //SetPlayerCheckpoint(i, Points[i][Pointx], Points[i][Pointy], Points[i][Pointz], 3);
  227. ReadyToCapture(x);
  228. Points[x][Announced] = 1;
  229. }
  230. }
  231. SaveStuff();
  232. SaveServerStats();
  233. FMemberCounter(); // Family member counter (requested by game affairs to track gang activity)
  234. return 1;
  235. }
  236.  
  237. /* strtok(const string[], &index)
  238. {
  239. new length = strlen(string);
  240. while ((index < length) && (string[index] <= ' '))
  241. {
  242. index++;
  243. }
  244.  
  245. new offset = index;
  246. new result[20];
  247. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  248. {
  249. result[index - offset] = string[index];
  250. index++;
  251. }
  252. result[index - offset] = EOS;
  253. return result;
  254. }*/
  255.  
  256. public splits(const strsrc[], strdest[][], delimiter)
  257. {
  258. new i, li;
  259. new aNum;
  260. new len;
  261. while(i <= strlen(strsrc)){
  262. if(strsrc[i]==delimiter || i==strlen(strsrc)){
  263. len = strmid(strdest[aNum], strsrc, li, i, 128);
  264. strdest[aNum][len] = 0;
  265. li = i+1;
  266. aNum++;
  267. }
  268. i++;
  269. }
  270. return 1;
Advertisement
Add Comment
Please, Sign In to add comment