1
0

taxi.pwn 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Taxi Group Type
  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. stock SendTaxiMessage(color, string[])
  34. {
  35. foreach(new i: Player)
  36. {
  37. if((IsATaxiDriver(i) && PlayerInfo[i][pDuty] > 0) || (IsATaxiDriver(i) && TransportDuty[i] > 0)) {
  38. SendClientMessageEx(i, color, string);
  39. }
  40. }
  41. }
  42. CMD:fare(playerid, params[])
  43. {
  44. if(IsATaxiDriver(playerid))
  45. {
  46. new string[128], fare;
  47. if(sscanf(params, "d", fare)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /fare [price]");
  48. if(PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot do this at this time.");
  49. if(TransportDuty[playerid] > 0)
  50. {
  51. if(TransportDuty[playerid] == 1)
  52. {
  53. TaxiDrivers -= 1;
  54. }
  55. else if(TransportDuty[playerid] == 2)
  56. {
  57. BusDrivers -= 1;
  58. }
  59. TransportDuty[playerid] = 0;
  60. format(string, sizeof(string), "* You are now off duty and earned $%d.", TransportMoney[playerid]);
  61. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  62. GivePlayerCash(playerid, (TransportMoney[playerid] / 100 * 50));
  63. if((0 <= PlayerInfo[playerid][pMember] < MAX_GROUPS) && (arrGroupData[PlayerInfo[playerid][pMember]][g_iGroupType] == GROUP_TYPE_TAXI))
  64. {
  65. arrGroupData[PlayerInfo[playerid][pMember]][g_iBudget] += (TransportMoney[playerid] / 100 * 50);
  66. if(TransportMoney[playerid]) format(szMiscArray, sizeof(szMiscArray), "%s is now off duty and earned $%s", GetPlayerNameEx(playerid), number_format(TransportMoney[playerid])), GroupLog(PlayerInfo[playerid][pMember], szMiscArray);
  67. }
  68. TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
  69. SetPlayerToTeamColor(playerid);
  70. return 1;
  71. }
  72. if(GetPVarInt(playerid, "MechanicDuty") == 1 || GetPVarInt(playerid, "LawyerDuty") == 1) return SendClientMessageEx(playerid,COLOR_GREY,"You need to get off duty with your mechanic/lawyer job first.");
  73. if(GetPlayerState(playerid) != 2) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the driver!");
  74. if(fare < 1 || fare > 2000) return SendClientMessageEx(playerid, COLOR_GREY, " Fare price must be between $1 and $2000!");
  75. new newcar = GetPlayerVehicleID(playerid);
  76. if(IsAnBus(newcar))
  77. {
  78. fare = 1500;
  79. BusDrivers += 1; TransportDuty[playerid] = 2; TransportValue[playerid] = fare;
  80. format(string, sizeof(string), "You are now on-duty as Bus Driver, fare: $%d.", TransportValue[playerid]);
  81. }
  82. else
  83. {
  84. TaxiDrivers += 1; TransportDuty[playerid] = 1; TransportValue[playerid] = fare;
  85. format(string, sizeof(string), "You are now on-duty as Taxi Driver, fare: $%d.", TransportValue[playerid]);
  86. }
  87. SendClientMessageEx(playerid, COLOR_WHITE, string);
  88. if(IsATaxiDriver(playerid)) SetPlayerColor(playerid, COLOR_TAXI); else SetPlayerColor(playerid,TEAM_TAXI_COLOR);
  89. }
  90. else
  91. {
  92. return SendClientMessageEx(playerid,COLOR_GREY,"You're not a licensed taxi/bus driver!");
  93. }
  94. return 1;
  95. }
  96. CMD:eba(playerid, params[]) {
  97. return cmd_emergencybutton(playerid, params);
  98. }
  99. CMD:emergencybutton(playerid, params[]) {
  100. if(arrGroupData[PlayerInfo[playerid][pMember]][g_iGroupType] == 7 || arrGroupData[PlayerInfo[playerid][pLeader]][g_iGroupType] == 7 || IsAReporter(playerid)) {
  101. new
  102. szLocation[MAX_ZONE_NAME];
  103. if(PlayerCuffed[playerid] >= 1 || PlayerInfo[playerid][pJailTime] > 0 || PlayerInfo[playerid][pHospital] > 0 || PlayerTied[playerid] > 0 ) {
  104. return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now.");
  105. }
  106. if(GetPVarType(playerid, "UsedEBA")) {
  107. if(!IsAReporter(playerid)) {
  108. format(szMiscArray, sizeof(szMiscArray), "HQ: The SA News distress signal from %s has been cancelled", GetPlayerNameEx(playerid));
  109. SendGroupMessage(GROUP_TYPE_NEWS, TEAM_BLUE_COLOR, szMiscArray);
  110. }
  111. else {
  112. format(szMiscArray, sizeof(szMiscArray), "HQ: The taxi co. distress signal from %s has been cancelled", GetPlayerNameEx(playerid));
  113. SendTaxiMessage(TEAM_AZTECAS_COLOR, szMiscArray);
  114. }
  115. foreach(new i: Player) {
  116. if(IsACop(i)) SendClientMessageEx(i, TEAM_BLUE_COLOR, szMiscArray);
  117. }
  118. SendClientMessage(playerid, COLOR_WHITE, "You have cancelled the emergency button.");
  119. DeletePVar(playerid, "UsedEBA");
  120. return 1;
  121. }
  122. GetPlayer2DZone(playerid, szLocation, MAX_ZONE_NAME);
  123. foreach(new i: Player) {
  124. if(IsACop(i)) {
  125. if(!IsAReporter(playerid)) SendClientMessageEx(i, TEAM_BLUE_COLOR, "HQ: All Units APB: Reporter: Taxi Company Office");
  126. else SendClientMessageEx(i, TEAM_BLUE_COLOR, "HQ: All Units APB: Reporter: SA News");
  127. if(!IsAReporter(playerid)) format(szMiscArray, sizeof(szMiscArray), "HQ: A distress signal is forwarded from the Taxi Company Office for %s at %s",GetPlayerNameEx(playerid), szLocation);
  128. else format(szMiscArray, sizeof szMiscArray, "HQ: A distress signal is forwarded from SA News for %s at %s", GetPlayerNameEx(playerid), szLocation);
  129. SendClientMessageEx(i, TEAM_BLUE_COLOR, szMiscArray);
  130. }
  131. }
  132. format(szMiscArray, sizeof(szMiscArray), "* An alarm engages in %s's vehicle at %s. A message is dispatched to the company's office.", GetPlayerNameEx(playerid), szLocation);
  133. SendTaxiMessage(TEAM_AZTECAS_COLOR, szMiscArray);
  134. SendClientMessage(playerid, COLOR_WHITE, "You have pressed the emergency button. The police have been informed.");
  135. SetPVarInt(playerid, "UsedEBA", 1);
  136. }
  137. return 1;
  138. }
  139. CMD:abus(playerid, params[]) return cmd_ataxi(playerid, params);
  140. CMD:ataxi(playerid, params[])
  141. {
  142. if(!IsATaxiDriver(playerid))
  143. return SendClientMessageEx(playerid, COLOR_GREY, "You are not a taxi/bus driver!");
  144. if(TransportDuty[playerid] == 0) return SendClientMessageEx(playerid, COLOR_GREY, "You are currently not on duty.");
  145. new
  146. szMessage[128],
  147. iTarget;
  148. if(TransportDuty[playerid] == 1)
  149. {
  150. if(sscanf(params, "u", iTarget)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /ataxi [player]");
  151. if(!IsPlayerConnected(iTarget)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  152. if(iTarget == playerid) return SendClientMessageEx(playerid, COLOR_GREY, "You can't accept your own taxi call.");
  153. if(TaxiCallTime[playerid] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "You have already accepted a call.");
  154. if(!GetPVarType(iTarget, "TaxiCall")) return SendClientMessageEx(playerid, COLOR_GREY, "That person has not called for a taxi.");
  155. format(szMessage, sizeof(szMessage), "** Taxi Driver %s has accepted the Taxi Call from %s(%d)" , GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget), iTarget);
  156. SendTaxiMessage(TEAM_AZTECAS_COLOR, szMessage);
  157. format(szMessage, sizeof(szMessage), "* Taxi Driver %s has accepted your Taxi Call, please wait at your current position.", GetPlayerNameEx(playerid));
  158. SendClientMessageEx(iTarget, COLOR_LIGHTBLUE, szMessage);
  159. GameTextForPlayer(playerid, "~w~Taxi Caller~n~~r~Go to the red marker.", 5000, 1);
  160. TaxiCallTime[playerid] = 1;
  161. TaxiAccepted[playerid] = iTarget;
  162. DeletePVar(iTarget, "TaxiCall");
  163. }
  164. if(TransportDuty[playerid] == 2)
  165. {
  166. if(sscanf(params, "u", iTarget)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /abus [player]");
  167. if(!IsPlayerConnected(iTarget)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  168. if(iTarget == playerid) return SendClientMessageEx(playerid, COLOR_GREY, "You can't accept your own bus call.");
  169. if(BusCallTime[playerid] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "You have already accepted a call.");
  170. if(!GetPVarType(iTarget, "BusCall")) return SendClientMessageEx(playerid, COLOR_GREY, "That person has not called for a bus.");
  171. format(szMessage, sizeof(szMessage), "** Bus Driver %s has accepted the Bus Call from %s(%d)" , GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget), iTarget);
  172. SendTaxiMessage(TEAM_AZTECAS_COLOR, szMessage);
  173. format(szMessage, sizeof(szMessage), "* Bus Driver %s has accepted your Bus Call, please wait at your current position.", GetPlayerNameEx(playerid));
  174. SendClientMessageEx(iTarget, COLOR_LIGHTBLUE, szMessage);
  175. GameTextForPlayer(playerid, "~w~Bus Caller~n~~r~Goto redmarker", 5000, 1);
  176. BusCallTime[playerid] = 1;
  177. BusAccepted[playerid] = iTarget;
  178. DeletePVar(iTarget, "BusCall");
  179. }
  180. PlayerInfo[playerid][pCallsAccepted]++;
  181. return 1;
  182. }