1
0

helmet.pwn 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Helmets
  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:hm(playerid, params[]) return cmd_helmet(playerid, params);
  34. CMD:helmet(playerid, params[])
  35. {
  36. if(!IsABike(GetPlayerVehicleID(playerid)))
  37. {
  38. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not on a bike!");
  39. return 1;
  40. }
  41. new string[60 + MAX_PLAYER_NAME];
  42. if(Seatbelt[playerid] == 0)
  43. {
  44. new icount = GetPlayerToySlots(playerid), helmetlist[8], helmetcount;
  45. for(new x = 0; x < icount; x++)
  46. {
  47. if(PlayerToyInfo[playerid][x][ptModelID] != 0 && PlayerToyInfo[playerid][x][ptSpecial] == 2)
  48. {
  49. helmetlist[helmetcount] = PlayerToyInfo[playerid][x][ptModelID];
  50. gCustomExtraList[playerid][helmetcount] = x;
  51. helmetcount++;
  52. }
  53. }
  54. if(helmetcount != 0)
  55. ShowModelSelectionMenuEx(playerid, helmetlist, helmetcount, "Helmet Selector", 2000, 0.0, 0.0, 120.0);
  56. else
  57. SendClientMessageEx(playerid, COLOR_GRAD2, "You do not own any helmets! Get one at any 24/7 in order to use /helmet");
  58. }
  59. else if(Seatbelt[playerid] == 2)
  60. {
  61. Seatbelt[playerid] = 0;
  62. for(new i; i < 10; i++) {
  63. if(PlayerHoldingObject[playerid][i] == GetPVarInt(playerid, "HelmetOn")) {
  64. PlayerHoldingObject[playerid][i] = 0;
  65. RemovePlayerAttachedObject(playerid, i);
  66. DeletePVar(playerid, "HelmetOn");
  67. break;
  68. }
  69. }
  70. format(string, sizeof(string), "{FF8000}** {C2A2DA}%s reaches for their helmet and takes it off.", GetPlayerNameEx(playerid));
  71. SendClientMessageEx(playerid, COLOR_WHITE, "You have taken off your helmet.");
  72. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  73. }
  74. return 1;
  75. }
  76. CMD:chm(playerid, params[]) return cmd_checkhelmet(playerid, params);
  77. CMD:checkhelmet(playerid, params[])
  78. {
  79. new giveplayerid;
  80. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /checkhelmet [player]");
  81. if(GetPlayerState(giveplayerid) == PLAYER_STATE_ONFOOT)
  82. {
  83. SendClientMessageEx(playerid,COLOR_GREY,"That person is not in any vehicle!");
  84. return 1;
  85. }
  86. if (ProxDetectorS(9.0, playerid, giveplayerid))
  87. {
  88. new string[128];
  89. new stext[4];
  90. if(Seatbelt[giveplayerid] == 0) { stext = "off"; }
  91. else { stext = "on"; }
  92. if(IsABike(GetPlayerVehicleID(playerid)))
  93. {
  94. format(string, sizeof(string), "%s's helmet is currently %s." , GetPlayerNameEx(giveplayerid) , stext);
  95. SendClientMessageEx(playerid,COLOR_WHITE,string);
  96. format(string, sizeof(string), "* %s looks at %s, checking to see if they are wearing a helmet.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
  97. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  98. }
  99. }
  100. else { SendClientMessageEx(playerid, COLOR_GREY, "You are not around that player!"); }
  101. return 1;
  102. }