bodyguard.pwn 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Bodyguard 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:frisk(playerid, params[])
  34. {
  35. if(IsACop(playerid) || PlayerInfo[playerid][pJob] == 8 || PlayerInfo[playerid][pJob2] == 8 || PlayerInfo[playerid][pJob3] == 8)
  36. {
  37. new giveplayerid;
  38. if(sscanf(params, "u", giveplayerid)) {
  39. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /frisk [player]");
  40. return 1;
  41. }
  42. /*if(sscanf(params, "ud", giveplayerid, storageid)) {
  43. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /frisk [player] [storageid]");
  44. SendClientMessageEx(playerid, COLOR_GREY, "StorageIDs: (0) Pocket - (1) Equipped Storage Device");
  45. return 1;
  46. }
  47. if(storageid < 0 || storageid > 1) {
  48. SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /frisk [player] [storageid]");
  49. SendClientMessageEx(playerid, COLOR_GREY, "StorageIDs: (0) Pocket - (1) Equipped Storage Device");
  50. return 1;
  51. }*/
  52. if(IsPlayerConnected(giveplayerid))
  53. {
  54. if (ProxDetectorS(8.0, playerid, giveplayerid))
  55. {
  56. if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot frisk yourself!"); return 1; }
  57. if(PlayerInfo[giveplayerid][pAdmin] >= 2 && !PlayerInfo[giveplayerid][pTogReports]) return 1;
  58. PlayerFriskPlayer(playerid, giveplayerid); // It did a frisk ... why request?
  59. }
  60. else
  61. {
  62. SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
  63. }
  64. }
  65. else
  66. {
  67. SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  68. return 1;
  69. }
  70. }
  71. else
  72. {
  73. SendClientMessageEx(playerid, COLOR_GREY, " You're not a law enforcement officer, or a bodyguard!");
  74. return 1;
  75. }
  76. return 1;
  77. }
  78. PlayerFriskPlayer(playerid, giveplayerid)
  79. {
  80. if(playerid == giveplayerid) return 1;
  81. if(!IsPlayerConnected(playerid) || !IsPlayerConnected(giveplayerid)) return 1;
  82. szMiscArray[0] = 0;
  83. new packages = GetPVarInt(giveplayerid, "Packages");
  84. new crates = PlayerInfo[giveplayerid][pCrates];
  85. SendClientMessageEx(playerid, COLOR_GREEN, "_______________________________________");
  86. format(szMiscArray, sizeof(szMiscArray), "Listing pocket for %s.", GetPlayerNameEx(giveplayerid));
  87. SendClientMessageEx(playerid, COLOR_YELLOW, szMiscArray);
  88. SendClientMessageEx(playerid, COLOR_WHITE, "** Items **");
  89. format(szMiscArray, sizeof(szMiscArray), "* %s has frisked %s for any illegal items.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
  90. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  91. if(PlayerInfo[giveplayerid][pMats] > 0)
  92. {
  93. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d materials.", PlayerInfo[giveplayerid][pMats]);
  94. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  95. }
  96. if(PlayerInfo[giveplayerid][pSyringes] > 0)
  97. {
  98. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d syringes.", PlayerInfo[giveplayerid][pSyringes]);
  99. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  100. }
  101. if(packages > 0)
  102. {
  103. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d material packages.", packages);
  104. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  105. }
  106. if(crates > 0)
  107. {
  108. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d drug crates.", crates);
  109. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  110. }
  111. SendClientMessageEx(playerid, COLOR_WHITE, "** Drugs **");
  112. for(new i = 0; i < sizeof(Drugs); ++i) {
  113. if(PlayerInfo[giveplayerid][pDrugs][i] > 0) {
  114. format(szMiscArray, sizeof(szMiscArray), "%s: %dg", Drugs[i], PlayerInfo[giveplayerid][pDrugs][i]);
  115. SendClientMessageEx(playerid, COLOR_GRAD1, szMiscArray);
  116. }
  117. }
  118. if(Fishes[giveplayerid][pWeight1] > 0 || Fishes[giveplayerid][pWeight2] > 0 || Fishes[giveplayerid][pWeight3] > 0 || Fishes[giveplayerid][pWeight4] > 0 || Fishes[giveplayerid][pWeight5] > 0)
  119. {
  120. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d fish.", PlayerInfo[giveplayerid][pFishes]);
  121. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  122. }
  123. SendClientMessageEx(playerid, COLOR_WHITE, "** Misc **");
  124. if(PlayerInfo[giveplayerid][pPhoneBook] > 0) SendClientMessageEx(playerid, COLOR_GREY, "Phone book.");
  125. if(PlayerInfo[giveplayerid][pCDPlayer] > 0) SendClientMessageEx(playerid, COLOR_GREY, "Music player.");
  126. new weaponname[50];
  127. SendClientMessageEx(playerid, COLOR_WHITE, "** Weapons **");
  128. for (new i = 0; i < 12; i++)
  129. {
  130. if(PlayerInfo[giveplayerid][pGuns][i] > 0)
  131. {
  132. GetWeaponName(PlayerInfo[giveplayerid][pGuns][i], weaponname, sizeof(weaponname));
  133. format(szMiscArray, sizeof(szMiscArray), "Weapon: %s.", weaponname);
  134. SendClientMessageEx(playerid, COLOR_GRAD1, szMiscArray);
  135. }
  136. }
  137. SendClientMessageEx(playerid, COLOR_GREEN, "_______________________________________");
  138. return 0;
  139. }
  140. CMD:guard(playerid, params[])
  141. {
  142. if(HungerPlayerInfo[playerid][hgInEvent] != 0) return SendClientMessageEx(playerid, COLOR_GREY, " You cannot do this while being in the Hunger Games Event!");
  143. if(PlayerInfo[playerid][pJob] != 8 && PlayerInfo[playerid][pJob2] != 8 && PlayerInfo[playerid][pJob3] != 8)
  144. {
  145. SendClientMessageEx(playerid, COLOR_GREY, "You're not a bodyguard.");
  146. return 1;
  147. }
  148. if(GetPVarInt(playerid, "WatchingTV")) return SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
  149. if(GetPVarType(playerid, "IsInArena"))
  150. {
  151. SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being in an arena!");
  152. return 1;
  153. }
  154. new string[128], giveplayerid, money;
  155. if(sscanf(params, "ud", giveplayerid, money)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /guard [player] [price]");
  156. if (GetPVarInt(playerid, "GuardTimer") > 0)
  157. {
  158. format(string, sizeof(string), " You must wait %d seconds before selling another vest.", GetPVarInt(playerid, "GuardTimer"));
  159. SendClientMessageEx(playerid,COLOR_GREY,string);
  160. return 1;
  161. }
  162. if(money < 2000 || money > 10000) { SendClientMessageEx(playerid, COLOR_GREY, "Specified price must be between $2,000 and $10,000."); return 1; }
  163. if(IsPlayerConnected(giveplayerid))
  164. {
  165. if(ProxDetectorS(8.0, playerid, giveplayerid))
  166. {
  167. if(giveplayerid == playerid)
  168. {
  169. SendClientMessageEx(playerid, COLOR_GREY, "You can't /guard yourself.");
  170. return 1;
  171. }
  172. SetPVarInt(playerid, "GuardTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GUARDTIMER);
  173. format(string, sizeof(string), "* You offered protection to %s for $%d.", GetPlayerNameEx(giveplayerid), money);
  174. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  175. format(string, sizeof(string), "* Bodyguard %s wants to protect you for $%d, type /accept bodyguard to accept.", GetPlayerNameEx(playerid), money);
  176. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  177. GuardOffer[giveplayerid] = playerid;
  178. GuardPrice[giveplayerid] = money;
  179. }
  180. else
  181. {
  182. SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
  183. }
  184. }
  185. else
  186. {
  187. SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  188. }
  189. return 1;
  190. }