1
0

service.pwn 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Service Commands
  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:service(playerid, params[])
  34. {
  35. new string[128], choice[32];
  36. if(sscanf(params, "s[32]", choice))
  37. {
  38. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /service [name]");
  39. SendClientMessageEx(playerid, COLOR_GREY, "Available names: Taxi, Bus, Medic, Mechanic, EMS");
  40. return 1;
  41. }
  42. if(PlayerInfo[playerid][pJailTime] > 0)
  43. {
  44. SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
  45. return 1;
  46. }
  47. if(gettime() < PlayerInfo[playerid][pServiceTime]) return SendClientMessage(playerid, COLOR_WHITE, "You must wait 30 seconds before using this command again. " );
  48. if(strcmp(choice,"ems",true) == 0)
  49. {
  50. if(GetPVarInt(playerid, "Injured") == 0)
  51. {
  52. SendClientMessageEx(playerid, COLOR_GREY, " You are not injured, you can't call for EMS now!");
  53. return 1;
  54. }
  55. new zone[MAX_ZONE_NAME];
  56. GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
  57. SetPVarInt(playerid, "EMSAttempt", 1);
  58. SendClientMessageEx(playerid, COLOR_WHITE, "The EMS has been informed of your current location and is on its way.");
  59. format(string, sizeof(string), "Emergency Dispatch has reported (%d) %s at %s. They require immediate emergency transport (/emslist).",playerid, GetPlayerNameEx(playerid), zone);
  60. SendMedicMessage(TEAM_MED_COLOR, string);
  61. PlayerInfo[playerid][pServiceTime] = gettime()+30;
  62. return 1;
  63. }
  64. else if(strcmp(choice,"taxi",true) == 0)
  65. {
  66. if(TaxiDrivers < 1) return SendClientMessageEx(playerid, COLOR_GREY, " There are no taxi drivers on duty at the moment, try again later!");
  67. if(TransportDuty[playerid] > 0) return SendClientMessageEx(playerid, COLOR_GREY, " You can't call for a taxi now!");
  68. if(GetPVarInt(playerid, "TaxiCall")) return SendClientMessage(playerid, COLOR_GREY, " You already have a pending taxi request (/cancel taxi).");
  69. new szZoneName[MAX_ZONE_NAME];
  70. GetPlayer2DZone(playerid, szZoneName, MAX_ZONE_NAME);
  71. format(string, sizeof(string), "** %s (%d) is in need of a taxi driver at %s - use /ataxi to accept the call.", GetPlayerNameEx(playerid), playerid, szZoneName );
  72. SendTaxiMessage(TEAM_AZTECAS_COLOR, string);
  73. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a taxi driver, wait for a reply.");
  74. SetPVarInt(playerid, "TaxiCall", 1);
  75. PlayerInfo[playerid][pServiceTime] = gettime()+30;
  76. return 1;
  77. }
  78. else if(strcmp(choice,"bus",true) == 0)
  79. {
  80. if(BusDrivers < 1) return SendClientMessageEx(playerid, COLOR_GREY, " There are no bus drivers at the moment, try again later!");
  81. if(TransportDuty[playerid] > 0) SendClientMessageEx(playerid, COLOR_GREY, " You can't call for a bus now!");
  82. new szZoneName[MAX_ZONE_NAME];
  83. GetPlayer2DZone(playerid, szZoneName, sizeof(szZoneName));
  84. format(string, sizeof(string), "** %s(%d) is in need of a bus driver at %s - use /abus to accept the call.", GetPlayerNameEx(playerid), playerid, szZoneName );
  85. SendTaxiMessage(TEAM_AZTECAS_COLOR, string);
  86. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a bus driver, wait for a reply.");
  87. SetPVarInt(playerid, "BusCall", 1);
  88. PlayerInfo[playerid][pServiceTime] = gettime()+30;
  89. return 1;
  90. }
  91. else if(strcmp(choice,"medic",true) == 0)
  92. {
  93. new OnDutyMedics;
  94. foreach(new i: Player)
  95. {
  96. if(IsAMedic(i) || IsFirstAid(i) && PlayerInfo[i][pDuty] == 1)
  97. {
  98. OnDutyMedics++;
  99. }
  100. }
  101. if(OnDutyMedics < 1)
  102. {
  103. SendClientMessageEx(playerid, COLOR_GREY, " There are no medics on duty at the moment, try again later!");
  104. return 1;
  105. }
  106. else
  107. {
  108. format(string, sizeof(string), "** %s is in need of a Medic - use /accept medic to accept the call.", GetPlayerNameEx(playerid));
  109. SendDivisionMessage(12, 2, TEAM_AZTECAS_COLOR, string);
  110. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a medic, wait for a reply.");
  111. MedicCall = playerid;
  112. PlayerInfo[playerid][pServiceTime] = gettime()+30;
  113. OnDutyMedics = 0;
  114. return 1;
  115. }
  116. }
  117. else if(strcmp(choice,"mechanic",true) == 0)
  118. {
  119. if(Mechanics < 1)
  120. {
  121. SendClientMessageEx(playerid, COLOR_GREY, " There are no car mechanics on duty at the moment, try again later!");
  122. return 1;
  123. }
  124. format(string, sizeof(string), "** %s is in need of a car mechanic - use /accept mechanic to accept the call.", GetPlayerNameEx(playerid));
  125. SendJobMessage(7, TEAM_AZTECAS_COLOR, string);
  126. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a car mechanic, wait for a reply.");
  127. MechanicCall = playerid;
  128. PlayerInfo[playerid][pServiceTime] = gettime()+30;
  129. return 1;
  130. }
  131. else
  132. {
  133. SendClientMessageEx(playerid, COLOR_GREY, " Unknown service name!");
  134. return 1;
  135. }
  136. }