pizzaboy.pwn 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Pizzaboy 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. /*
  34. CMD:getpizza(playerid, params[]) {
  35. if(PlayerInfo[playerid][pJob] != 21 && PlayerInfo[playerid][pJob2] != 21 && PlayerInfo[playerid][pJob3] != 21) {
  36. SendClientMessageEx(playerid,COLOR_GREY," You are not a Pizza Boy!");
  37. }
  38. else if(!IsAPizzaCar(GetPlayerVehicleID(playerid))) {
  39. SendClientMessageEx(playerid,COLOR_GREY," You need to be driving a pizzaboy found at the side of the Pizza Stack!");
  40. }
  41. else if(GetPlayerSkin(playerid) != 155) {
  42. SendClientMessageEx(playerid,COLOR_GREY," You need to be in the Pizza Stack uniform!");
  43. }
  44. else if(GetPVarType(playerid, "Pizza")) {
  45. SendClientMessageEx(playerid, COLOR_GREY, " You are already delivering pizzas!");
  46. }
  47. else if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2103.6714,-1785.5222,12.9849)) {
  48. SendClientMessageEx(playerid,COLOR_GREY," You are not at the Pizza Stack pickup!");
  49. }
  50. else if(gettime() < GetPVarInt(playerid, "PizzaCoolDown")) {
  51. new str[53];
  52. format(str, sizeof(str), "Please wait %d seconds before getting another pizza!", GetPVarInt(playerid, "PizzaCoolDown")-gettime());
  53. SendClientMessageEx(playerid,COLOR_GREY, str);
  54. }
  55. else {
  56. new rand = random(MAX_HOUSES - 1), i;
  57. while(!(HouseInfo[rand][hOwned] && HouseInfo[rand][hExteriorZ] <= 100 && HouseInfo[rand][hExteriorX] > 516.5287 && HouseInfo[rand][hExteriorX] < 2881.0891 && HouseInfo[rand][hExteriorY] < -909.6716 && HouseInfo[rand][hExteriorY] > -1785.5222 && HouseInfo[rand][hExtIW] == PlayerInfo[playerid][pVW] && HouseInfo[rand][hExtVW] == PlayerInfo[playerid][pInt])) {
  58. if(++rand >= MAX_HOUSES) {
  59. rand = 0;
  60. }
  61. if (i++ > MAX_HOUSES) return 1;
  62. }
  63. new
  64. iDist = floatround(GetPlayerDistanceFromPoint(playerid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ])),
  65. szMessage[86];
  66. SetPVarInt(playerid, "tpPizzaTimer", iDist / 80);
  67. SetPVarInt(playerid, "pizzaTotal", iDist / 10);
  68. SetPVarInt(playerid, "pizzaTimer", iDist / 10);
  69. SetPVarInt(playerid, "Pizza", rand);
  70. SetPVarInt(playerid, "PizzaCoolDown", gettime()+60);
  71. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPPIZZARUNTIMER);
  72. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_PIZZATIMER);
  73. format(szMessage, sizeof(szMessage), "You have picked up a pizza for %s. You have %d seconds to deliver it!", StripUnderscore(HouseInfo[rand][hOwnerName]), iDist / 10);
  74. SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
  75. SetPlayerCheckpoint(playerid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ], 5);
  76. }
  77. return 1;
  78. }
  79. */
  80. CMD:getpizza(playerid, params[]) {
  81. if(PlayerInfo[playerid][pJob] != 21 && PlayerInfo[playerid][pJob2] != 21 && PlayerInfo[playerid][pJob3] != 21) {
  82. SendClientMessageEx(playerid,COLOR_GREY,"You are not a Pizza Boy!");
  83. }
  84. else if(!IsAPizzaCar(GetPlayerVehicleID(playerid))) {
  85. SendClientMessageEx(playerid,COLOR_GREY,"You need to be driving a pizzaboy found at the side of the Pizza Stack!");
  86. }
  87. else if(GetPlayerSkin(playerid) != 155) {
  88. SendClientMessageEx(playerid,COLOR_GREY,"You need to be in the Pizza Stack uniform!");
  89. }
  90. else if(GetPVarType(playerid, "Pizza")) {
  91. SendClientMessageEx(playerid, COLOR_GREY, "You are already delivering pizzas!");
  92. }
  93. else if (!IsPlayerInRangeOfPoint(playerid, 5.0, -1713.961425, 1348.545166, 7.180452) && !IsPlayerInRangeOfPoint(playerid, 5.0, 2103.6714,-1785.5222,12.9849)) { // Sort this out
  94. SendClientMessageEx(playerid,COLOR_GREY,"You are not at a Pizza Stack pickup!");
  95. }
  96. else if(gettime() < GetPVarInt(playerid, "PizzaCoolDown")) {
  97. new str[53];
  98. format(str, sizeof(str), "Please wait %d seconds before getting another pizza!", GetPVarInt(playerid, "PizzaCoolDown")-gettime());
  99. SendClientMessageEx(playerid,COLOR_GREY, str);
  100. }
  101. else if(IsPlayerInRangeOfPoint(playerid, 3.0, -1713.961425, 1348.545166, 7.180452)) { // Pier 69
  102. new rand = random(MAX_HOUSES - 1), i;
  103. while(!(HouseInfo[rand][hOwned] && HouseInfo[rand][hExteriorZ] <= 100 && HouseInfo[rand][hExteriorX] > -2802.389648 && HouseInfo[rand][hExteriorX] < -1400.710327 && HouseInfo[rand][hExteriorY] < 2800 && HouseInfo[rand][hExteriorY] > -216.298019 && HouseInfo[rand][hExtIW] == PlayerInfo[playerid][pVW] && HouseInfo[rand][hExtVW] == PlayerInfo[playerid][pInt])) {
  104. if(++rand >= MAX_HOUSES) {
  105. rand = 0;
  106. }
  107. if (i++ > MAX_HOUSES) return 1;
  108. }
  109. new
  110. iDist = floatround(GetPlayerDistanceFromPoint(playerid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ])),
  111. szMessage[86];
  112. SetPVarInt(playerid, "tpPizzaTimer", iDist / 80);
  113. SetPVarInt(playerid, "pizzaTotal", iDist / 10);
  114. SetPVarInt(playerid, "pizzaTimer", iDist / 10);
  115. SetPVarInt(playerid, "Pizza", rand);
  116. SetPVarInt(playerid, "PizzaCoolDown", gettime()+60);
  117. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPPIZZARUNTIMER);
  118. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_PIZZATIMER);
  119. format(szMessage, sizeof(szMessage), "You have picked up a pizza for %s. You have %d seconds to deliver it!", StripUnderscore(HouseInfo[rand][hOwnerName]), iDist / 10);
  120. SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
  121. SetPlayerCheckpoint(playerid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ], 5);
  122. }
  123. else if(IsPlayerInRangeOfPoint(playerid, 5.0, 2103.6714,-1785.5222,12.9849)) { // Idlewood
  124. new rand = random(MAX_HOUSES - 1), i;
  125. while(!(HouseInfo[rand][hOwned] && HouseInfo[rand][hExteriorZ] <= 100 && HouseInfo[rand][hExteriorX] > 516.5287 && HouseInfo[rand][hExteriorX] < 2881.0891 && HouseInfo[rand][hExteriorY] < -909.6716 && HouseInfo[rand][hExteriorY] > -1785.5222 && HouseInfo[rand][hExtIW] == PlayerInfo[playerid][pVW] && HouseInfo[rand][hExtVW] == PlayerInfo[playerid][pInt])) {
  126. if(++rand >= MAX_HOUSES) {
  127. rand = 0;
  128. }
  129. if (i++ > MAX_HOUSES) return 1;
  130. }
  131. new
  132. iDist = floatround(GetPlayerDistanceFromPoint(playerid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ])),
  133. szMessage[86];
  134. SetPVarInt(playerid, "tpPizzaTimer", iDist / 80);
  135. SetPVarInt(playerid, "pizzaTotal", iDist / 10);
  136. SetPVarInt(playerid, "pizzaTimer", iDist / 10);
  137. SetPVarInt(playerid, "Pizza", rand);
  138. SetPVarInt(playerid, "PizzaCoolDown", gettime()+60);
  139. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPPIZZARUNTIMER);
  140. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_PIZZATIMER);
  141. format(szMessage, sizeof(szMessage), "You have picked up a pizza for %s. You have %d seconds to deliver it!", StripUnderscore(HouseInfo[rand][hOwnerName]), iDist / 10);
  142. SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
  143. SetPlayerCheckpoint(playerid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ], 5);
  144. }
  145. return 1;
  146. }