Advertisement
Guest User

Payday Bug,crash

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