lawyer.pwn 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Lawyer System
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. CMD:lawyerduty(playerid, params[])
  34. {
  35. if(!IsALawyer(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, " You are not a Lawyer!");
  36. if(GetPVarInt(playerid, "LawyerDuty") == 1)
  37. {
  38. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You are now off duty on your lawyer job and will not receive calls anymore.");
  39. SetPVarInt(playerid, "LawyerDuty", 0);
  40. Lawyers -= 1;
  41. }
  42. else if(GetPVarInt(playerid, "LawyerDuty") == 0)
  43. {
  44. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You are now on duty on your lawyer job and will receive calls from people in need.");
  45. SetPVarInt(playerid, "LawyerDuty", 1);
  46. Lawyers += 1;
  47. }
  48. return 1;
  49. }
  50. CMD:defendtime(playerid, params[])
  51. {
  52. new string[128];
  53. if(PlayerInfo[playerid][pDefendTime] < 1)
  54. {
  55. SendClientMessageEx(playerid, COLOR_YELLOW, "You're able to receive defense now.");
  56. }
  57. else {
  58. format(string, sizeof(string), "You will be able to receive a defense in %d minutes.", PlayerInfo[playerid][pDefendTime]);
  59. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  60. }
  61. return 1;
  62. }
  63. CMD:offerappeal(playerid, params[])
  64. {
  65. if(!IsALawyer(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, " You are not a Lawyer!");
  66. new string[128], giveplayerid;
  67. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /offerappeal [player]");
  68. if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GRAD1, "You can't use this command on yourself!");
  69. if(IsPlayerConnected(giveplayerid))
  70. {
  71. if(PlayerInfo[giveplayerid][pBeingSentenced] == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "That person isn't pending a sentence!");
  72. if(AppealOfferAccepted[giveplayerid] == 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "That person has already accepted a lawyer to appeal for him!");
  73. AppealOffer[giveplayerid] = playerid;
  74. format(string, sizeof(string), "You have offered your lawyer services to %s.",GetPlayerNameEx(giveplayerid));
  75. SendClientMessageEx(playerid, COLOR_WHITE, string);
  76. format(string, sizeof(string), "%s has offered their lawyer services (use /accept appeal to accept them).", GetPlayerNameEx(playerid));
  77. SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
  78. }
  79. return 1;
  80. }
  81. CMD:free(playerid, params[])
  82. {
  83. if(!IsALawyer(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, " You are not a Lawyer!");
  84. if(PlayerInfo[playerid][pLawSkill] >= 401)
  85. {
  86. ApprovedLawyer[playerid] = 1;
  87. }
  88. new
  89. giveplayerid;
  90. if(sscanf(params, "u", giveplayerid)) {
  91. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /free [player]");
  92. }
  93. else if(!IsPlayerConnected(giveplayerid)) {
  94. SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  95. }
  96. else if(giveplayerid == playerid) {
  97. SendClientMessageEx(playerid, COLOR_GREY, "You cannot free yourself.");
  98. }
  99. else if(PlayerInfo[giveplayerid][pJailTime] > 0 && ApprovedLawyer[playerid] == 1 && WantLawyer[giveplayerid] >= 1) {
  100. new
  101. string[128];
  102. format(string, sizeof(string), "* You freed %s from jail.", GetPlayerNameEx(giveplayerid));
  103. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  104. format(string, sizeof(string), "* You were freed from jail, by Lawyer %s.", GetPlayerNameEx(playerid));
  105. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  106. ApprovedLawyer[playerid] = 0;
  107. WantLawyer[giveplayerid] = 0;
  108. CallLawyer[giveplayerid] = 0;
  109. PlayerInfo[giveplayerid][pBailPrice] = 0;
  110. PlayerInfo[giveplayerid][pJailTime] = 1;
  111. if(PlayerInfo[playerid][pDoubleEXP] > 0)
  112. {
  113. format(string, sizeof(string), "You have gained 2 lawyer skill points instead of 1. You have %d hours left on the Double EXP token.", PlayerInfo[playerid][pDoubleEXP]);
  114. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  115. PlayerInfo[playerid][pLawSkill] += 2;
  116. }
  117. else ++PlayerInfo[playerid][pLawSkill];
  118. switch(PlayerInfo[playerid][pLawSkill]) {
  119. case 50: SendClientMessageEx(playerid, COLOR_YELLOW, "* Your lawyer skill is now Level 2, you will earn more money and now have a shorter reload time.");
  120. case 100: SendClientMessageEx(playerid, COLOR_YELLOW, "* Your lawyer skill is now Level 3, you will earn more money and now have a shorter reload time.");
  121. case 200: SendClientMessageEx(playerid, COLOR_YELLOW, "* Your lawyer skill is now Level 4, you will earn more money and now have a shorter reload time.");
  122. case 400: SendClientMessageEx(playerid, COLOR_YELLOW, "* Your lawyer skill is now Level 5, you will earn more money and now have a shorter reload time.");
  123. }
  124. }
  125. else SendClientMessageEx(playerid, COLOR_GRAD1, "That person doesn't need a laywer.");
  126. return 1;
  127. }
  128. CMD:finishappeal(playerid, params[])
  129. {
  130. if(!IsALawyer(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, " You are not a Lawyer!");
  131. new string[128], giveplayerid;
  132. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /finishappeal [player]");
  133. if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GRAD1, "You can't use this command on yourself!");
  134. if(IsPlayerConnected(giveplayerid))
  135. {
  136. if(AppealOffer[giveplayerid] != playerid) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not offering your services to this player!");
  137. format(string, sizeof(string), "You have finished your Lawyer services to %s.",GetPlayerNameEx(giveplayerid));
  138. SendClientMessageEx(playerid, COLOR_WHITE, string);
  139. format(string, sizeof(string), "%s has finished offering their Lawyer services.", GetPlayerNameEx(playerid));
  140. SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
  141. AppealOffer[giveplayerid] = INVALID_PLAYER_ID;
  142. AppealOfferAccepted[giveplayerid] = 0;
  143. }
  144. return 1;
  145. }
  146. CMD:defend(playerid, params[])
  147. {
  148. if(!IsALawyer(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, " You are not a Lawyer!");
  149. new string[128];
  150. if(gettime() < PlayerInfo[playerid][pLawyerTime])
  151. {
  152. format(string, sizeof(string), "You must wait %d seconds!", PlayerInfo[playerid][pLawyerTime]-gettime());
  153. SendClientMessageEx(playerid, COLOR_GRAD1,string);
  154. return 1;
  155. }
  156. new giveplayerid, money;
  157. if(sscanf(params, "ud", giveplayerid, money)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /defend [player] [price]");
  158. if(money < 20000 || money > 1000000) { SendClientMessageEx(playerid, COLOR_GREY, " Price not lower then $20,000 or above $1,000,000!"); return 1; }
  159. if(IsPlayerConnected(giveplayerid))
  160. {
  161. if(ProxDetectorS(8.0, playerid, giveplayerid))
  162. {
  163. if(giveplayerid == playerid)
  164. {
  165. SendClientMessageEx(playerid, COLOR_GREY, " Cant offer protection to yourself!");
  166. return 1;
  167. }
  168. if(PlayerInfo[giveplayerid][pDefendTime] > 0) {
  169. return SendClientMessageEx(playerid, COLOR_GRAD2, "You need wait 1 hour before defending this player.");
  170. }
  171. if(PlayerInfo[giveplayerid][pWantedLevel] > 0)
  172. {
  173. format(string, sizeof(string), "* You offered to defend %s for $%d.", GetPlayerNameEx(giveplayerid), money);
  174. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  175. format(string, sizeof(string), "* Lawyer %s wants to defend you for $%d, (type /accept defense) to accept.", GetPlayerNameEx(playerid), money);
  176. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  177. PlayerInfo[playerid][pLawyerTime] = gettime()+60;
  178. DefendOffer[giveplayerid] = playerid;
  179. DefendPrice[giveplayerid] = money;
  180. }
  181. else
  182. {
  183. SendClientMessageEx(playerid, COLOR_GREY, " That person is not wanted!");
  184. }
  185. }
  186. else
  187. {
  188. SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
  189. }
  190. }
  191. else
  192. {
  193. SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  194. }
  195. return 1;
  196. }