bday.pwn 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Next Generation Gaming, LLC
  11. (created by Next Generation Gaming Development Team)
  12. Developers:
  13. (***) Austin
  14. * Copyright (c) 2016, Next Generation Gaming, LLC
  15. *
  16. * All rights reserved.
  17. *
  18. * Redistribution and use in source and binary forms, with or without modification,
  19. * are not permitted in any case.
  20. *
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  26. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  27. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  28. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  29. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  30. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  31. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. --
  34. This is a module, not a filterscript.
  35. VERSION: 0.1
  36. */
  37. new Float:_t_Pos[3];
  38. new _t_zone;
  39. new Float:_t_scatter[7][3] = {
  40. {520.026, -2006.262, 2.007},
  41. {504.765, -2006.710, 2.007},
  42. {504.792, -1995.228, 2.007},
  43. {508.803, -1985.477, 2.007},
  44. {517.988, -1980.903, 2.007},
  45. {520.514, -1972.035, 2.007},
  46. {505.900, -1970.852, 2.007}
  47. };
  48. hook OnGameModeInit()
  49. {
  50. _t_zone = CreateDynamicRectangle(496.749359, -2013.100585, 526.126831, -1963.961425);
  51. _t_resetTreasure();
  52. return 1;
  53. }
  54. _t_resetTreasure()
  55. {
  56. new point = random(sizeof(_t_scatter));
  57. _t_Pos[0] = _t_scatter[point][0]+random(2);
  58. _t_Pos[1] = _t_scatter[point][1]+random(3);
  59. _t_Pos[2] = _t_scatter[point][2];
  60. printf("[TREASURE_ISLAND] %.f %.f %.f", _t_Pos[0], _t_Pos[1], _t_Pos[2]);
  61. return 1;
  62. }
  63. _t_ableTo(playerid)
  64. {
  65. new year, month, day;
  66. getdate(year, month, day);
  67. if(!(month == 4 && day == 26)) return SendClientMessageEx(playerid, COLOR_GRAD2, "It's not NGG's BDay!"), 0;
  68. if(GetPVarType(playerid, "PlayerCuffed") || GetPVarInt(playerid, "pBagged") >= 1 || GetPVarType(playerid, "Injured") || GetPVarType(playerid, "IsFrozen") || GetPVarInt(playerid, "Hospital") || GetPVarType(playerid, "IsLive")) {
  69. SendClientMessage(playerid, COLOR_GRAD2, "You perform this action right now.");
  70. return 0;
  71. }
  72. new animlib[32],tmp[32];
  73. GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,tmp,32);
  74. if(!strcmp(animlib, "SWIM")) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this command while swimming!"), 0;
  75. if(IsPlayerInAnyVehicle(playerid) == 1)
  76. {
  77. SendClientMessage(playerid, COLOR_GRAD2, "You cannot use this whilst in a vehicle.");
  78. return 0;
  79. }
  80. new string[128];
  81. if(gettime() < PlayerInfo[playerid][pDigCooldown])
  82. {
  83. new seconds = PlayerInfo[playerid][pDigCooldown]-gettime();
  84. new minutes = seconds/60;
  85. format(string, sizeof(string), "[Treasure Island] %d minute(s) before you can use /dig again.", minutes);
  86. SendClientMessageEx(playerid, COLOR_GRAD2, string);
  87. return 0;
  88. }
  89. if(gettime() < GetPVarInt(playerid, "AntiDigSpam"))
  90. {
  91. format(string, sizeof(string), "Please wait %d seconds before using the command again.", GetPVarInt(playerid, "AntiDigSpam")-gettime());
  92. SendClientMessageEx(playerid, COLOR_GRAD2, string);
  93. return 0;
  94. }
  95. return 1;
  96. }
  97. CMD:dig(playerid, params[])
  98. {
  99. if(IsPlayerInDynamicArea(playerid, _t_zone)) {
  100. if(!_t_ableTo(playerid)) return 1;
  101. ApplyAnimation(playerid, "MEDIC", "CPR", 4.0, 0, 0, 0, 0, 0, 1);
  102. SetPVarInt(playerid, "AntiDigSpam", gettime()+30);
  103. if(IsPlayerInRangeOfPoint(playerid, 2.0, _t_Pos[0], _t_Pos[1], _t_Pos[2])) {
  104. SendClientMessageEx(playerid, COLOR_YELLOW, "TREASURE: You have found it! You may try again in 5 hours.");
  105. GiftPlayer(MAX_PLAYERS, playerid);
  106. PlayerInfo[playerid][pDigCooldown] = gettime()+18000;
  107. _t_resetTreasure();
  108. }
  109. else {
  110. SendClientMessageEx(playerid, COLOR_GRAD2, "Sorry! Seems you did not find it this time around.");
  111. }
  112. }
  113. else {
  114. SendClientMessageEx(playerid, COLOR_GRAD2, "You must be in the digging area at the beach to use this command!");
  115. }
  116. return 1;
  117. }