1
0

xmas.pwn 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Xmas Holidays Events
  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. #include <YSI\y_hooks>
  34. CMD:carol(playerid, params[]) // Christmas Event
  35. {
  36. new year, month, day, string[256], cstring[32];
  37. getdate(year, month, day);
  38. if(month == 12 && day == 24)
  39. {
  40. if(PlayerInfo[playerid][pConnectHours] > 2)
  41. {
  42. for(new i = 0; i < sizeof(HouseInfo); i++)
  43. {
  44. if (IsPlayerInRangeOfPoint(playerid,3,HouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ]))
  45. {
  46. if(PlayerInfo[playerid][pTrickortreat] == 0)
  47. {
  48. GiftPlayer(MAX_PLAYERS, playerid);
  49. switch(PlayerInfo[playerid][pDonateRank])
  50. {
  51. case 0, 1: PlayerInfo[playerid][pTrickortreat] = 5;
  52. case 2: PlayerInfo[playerid][pTrickortreat] = 4;
  53. case 3: PlayerInfo[playerid][pTrickortreat] = 3;
  54. case 4: PlayerInfo[playerid][pTrickortreat] = 2;
  55. case 5: PlayerInfo[playerid][pTrickortreat] = 2;
  56. }
  57. new rand = Random(1, 5);
  58. switch(rand)
  59. {
  60. case 1: cstring = "Deck the Halls";
  61. case 2: cstring = "We Wish You a Merry Christmas";
  62. case 3: cstring = "Jingle Bells";
  63. case 4: cstring = "Jingle Bells Rock";
  64. case 5: cstring = "Silent Night";
  65. default: cstring = "Deck the Halls";
  66. }
  67. format(string, sizeof(string), "* %s begins to sing the Christmas Carol %s.",GetPlayerNameEx(playerid), cstring);
  68. ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  69. return 1;
  70. }
  71. else
  72. {
  73. if(GetPVarInt(playerid, "PinConfirmed"))
  74. {
  75. format(string, sizeof(string),"Item: Reset Caroling Timer\nYour Credits: %s\nCost: {FFD700}%s{A9C4E4}\nCredits Left: %s", number_format(PlayerInfo[playerid][pCredits]), number_format(20), number_format(PlayerInfo[playerid][pCredits]-20));
  76. ShowPlayerDialogEx( playerid, DIALOG_SHOPTOTRESET, DIALOG_STYLE_MSGBOX, "Reset Timer", string, "Purchase", "Exit" );
  77. SendClientMessageEx(playerid, COLOR_GRAD2, "You have already sang in the last few hours!");
  78. return 1;
  79. }
  80. else
  81. {
  82. PinLogin(playerid);
  83. SendClientMessageEx(playerid, COLOR_GRAD2, "You have already sang in the last few hours!");
  84. return 1;
  85. }
  86. }
  87. }
  88. }
  89. SendClientMessageEx(playerid, COLOR_GREY, "You are not at a house. (green house icon)");
  90. }
  91. else
  92. {
  93. SendClientMessageEx(playerid, COLOR_GREY, "You have not played 2 hours.");
  94. }
  95. }
  96. else SendClientMessageEx(playerid, COLOR_GREY, "It isn't Christmas Eve!");
  97. return 1;
  98. }
  99. CMD:xmas(playerid, params[])
  100. {
  101. if(PlayerInfo[playerid][pAdmin] >= 1337)
  102. {
  103. if(XMASGifts == 0)
  104. {
  105. XMASGifts = 1;
  106. new string[128];
  107. format( string, sizeof( string ), "%s would like for you to come to Pershing Square for free gifts and great times", GetPlayerNameEx(playerid));
  108. SendClientMessageToAllEx(COLOR_LIGHTGREEN, string);
  109. }
  110. else
  111. {
  112. XMASGifts = 0;
  113. new string[128];
  114. format( string, sizeof( string ), "AdmCmd: %s has disabled the /getgift command", GetPlayerNameEx(playerid));
  115. ABroadCast( COLOR_LIGHTRED, string, 1337 );
  116. format(string, sizeof(string), "Pershing Square is no longer giving away free gifts. Thanks for coming!", VIPGiftsName, VIPGiftsTimeLeft);
  117. SendClientMessageToAllEx(COLOR_LIGHTGREEN, string);
  118. }
  119. }
  120. return 1;
  121. }
  122. CMD:christmasshop(playerid, params[]) {
  123. new year, month, day;
  124. getdate(year, month, day);
  125. if(!GetPVarType(playerid, "PinConfirmed")) return PinLogin(playerid);
  126. if(month == 12 && (24 <= day <= 27)) {
  127. format(szMiscArray, sizeof(szMiscArray), "Ornament 1\t(100)\n\
  128. Ornament 2\t(100)\n\
  129. Ornament 3\t(100)\n\
  130. Ornament 4\t(100)\n\
  131. Ornament 5\t(100)\n\
  132. Xmas Tree\t(150)"
  133. );
  134. ShowPlayerDialogEx(playerid, XMAS_SHOP, DIALOG_STYLE_LIST, "Xmas Shop", szMiscArray, "Select", "Cancel");
  135. }
  136. else SendClientMessageEx(playerid, COLOR_GREY, "Humbug! No presents available yet!");
  137. return 1;
  138. }
  139. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  140. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  141. switch(dialogid) {
  142. case XMAS_SHOP: {
  143. new
  144. iLocate[2],
  145. szCreditCost[5],
  146. iExtCredCost,
  147. iToyID = 0;
  148. // extracting the credit cost position
  149. iLocate[0] = strfind(inputtext, "(");
  150. iLocate[1] = strfind(inputtext, ")");
  151. strmid(szCreditCost, inputtext, iLocate[0]+1, iLocate[1]);
  152. iExtCredCost = strval(szCreditCost);
  153. if(PlayerInfo[playerid][pCredits] < iExtCredCost) return SendClientMessageEx(playerid, COLOR_RED, "You do not have enough credits.");
  154. // extracting the item name
  155. if(strcmp(inputtext, "Ornament 1", false, iLocate[0]-1) == 0) {
  156. iToyID = 19059;
  157. SendClientMessageEx(playerid, COLOR_CYAN, "You have purchased Ornament 1 (19059) for 100 credits.");
  158. format(szMiscArray, sizeof(szMiscArray), "[TOYSALE] [User: %s(%i)] [IP: %s] [Credits: %s] [Ornament 1] [Price: %s]",GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], GetPlayerIpEx(playerid), number_format(PlayerInfo[playerid][pCredits]), number_format(iExtCredCost));
  159. }
  160. else if(strcmp(inputtext, "Ornament 2", false, iLocate[0]-1) == 0) {
  161. iToyID = 19060;
  162. SendClientMessageEx(playerid, COLOR_CYAN, "You have purchased Ornament 2 (19060) for 100 credits.");
  163. format(szMiscArray, sizeof(szMiscArray), "[TOYSALE] [User: %s(%i)] [IP: %s] [Credits: %s] [Ornament 2] [Price: %s]",GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], GetPlayerIpEx(playerid), number_format(PlayerInfo[playerid][pCredits]), number_format(iExtCredCost));
  164. }
  165. else if(strcmp(inputtext, "Ornament 3", false, iLocate[0]-1) == 0) {
  166. iToyID = 19061;
  167. SendClientMessageEx(playerid, COLOR_CYAN, "You have purchased Ornament 3 (19061) for 100 credits.");
  168. format(szMiscArray, sizeof(szMiscArray), "[TOYSALE] [User: %s(%i)] [IP: %s] [Credits: %s] [Ornament 3] [Price: %s]",GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], GetPlayerIpEx(playerid), number_format(PlayerInfo[playerid][pCredits]), number_format(iExtCredCost));
  169. }
  170. else if(strcmp(inputtext, "Ornament 4", false, iLocate[0]-1) == 0) {
  171. iToyID = 19062;
  172. SendClientMessageEx(playerid, COLOR_CYAN, "You have purchased Ornament 4 (19062) for 100 credits.");
  173. format(szMiscArray, sizeof(szMiscArray), "[TOYSALE] [User: %s(%i)] [IP: %s] [Credits: %s] [Ornament 4] [Price: %s]",GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], GetPlayerIpEx(playerid), number_format(PlayerInfo[playerid][pCredits]), number_format(iExtCredCost));
  174. }
  175. else if(strcmp(inputtext, "Ornament 5", false, iLocate[0]-1) == 0) {
  176. iToyID = 19063;
  177. SendClientMessageEx(playerid, COLOR_CYAN, "You have purchased Ornament 5 (19063) for 100 credits.");
  178. format(szMiscArray, sizeof(szMiscArray), "[TOYSALE] [User: %s(%i)] [IP: %s] [Credits: %s] [Ornament 5] [Price: %s]",GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], GetPlayerIpEx(playerid), number_format(PlayerInfo[playerid][pCredits]), number_format(iExtCredCost));
  179. }
  180. else if(strcmp(inputtext, "Xmas Tree", false, iLocate[0]-1) == 0) {
  181. iToyID = 19076;
  182. SendClientMessageEx(playerid, COLOR_CYAN, "You have purchased an Xmas Tree (19076) for 150 credits.");
  183. format(szMiscArray, sizeof(szMiscArray), "[TOYSALE] [User: %s(%i)] [IP: %s] [Credits: %s] [Xmas Tree] [Price: %s]",GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], GetPlayerIpEx(playerid), number_format(PlayerInfo[playerid][pCredits]), number_format(iExtCredCost));
  184. }
  185. Log("logs/micro.log", szMiscArray), print(szMiscArray);
  186. GivePlayerCredits(playerid, -iExtCredCost, 1);
  187. g_mysql_SaveAccount(playerid);
  188. new icount = GetPlayerToySlots(playerid);
  189. for(new v = 0; v < icount; v++) {
  190. if(PlayerToyInfo[playerid][v][ptModelID] == 0) {
  191. PlayerToyInfo[playerid][v][ptModelID] = iToyID;
  192. PlayerToyInfo[playerid][v][ptBone] = 6;
  193. PlayerToyInfo[playerid][v][ptPosX] = 0.0;
  194. PlayerToyInfo[playerid][v][ptPosY] = 0.0;
  195. PlayerToyInfo[playerid][v][ptPosZ] = 0.0;
  196. PlayerToyInfo[playerid][v][ptRotX] = 0.0;
  197. PlayerToyInfo[playerid][v][ptRotY] = 0.0;
  198. PlayerToyInfo[playerid][v][ptRotZ] = 0.0;
  199. PlayerToyInfo[playerid][v][ptScaleX] = 1.0;
  200. PlayerToyInfo[playerid][v][ptScaleY] = 1.0;
  201. PlayerToyInfo[playerid][v][ptScaleZ] = 1.0;
  202. PlayerToyInfo[playerid][v][ptTradable] = 1;
  203. g_mysql_NewToy(playerid, v);
  204. return 1;
  205. }
  206. }
  207. for(new i = 0; i < MAX_PLAYERTOYS; i++) {
  208. if(PlayerToyInfo[playerid][i][ptModelID] == 0) {
  209. PlayerToyInfo[playerid][i][ptModelID] = iToyID;
  210. PlayerToyInfo[playerid][i][ptBone] = 6;
  211. PlayerToyInfo[playerid][i][ptPosX] = 0.0;
  212. PlayerToyInfo[playerid][i][ptPosY] = 0.0;
  213. PlayerToyInfo[playerid][i][ptPosZ] = 0.0;
  214. PlayerToyInfo[playerid][i][ptRotX] = 0.0;
  215. PlayerToyInfo[playerid][i][ptRotY] = 0.0;
  216. PlayerToyInfo[playerid][i][ptRotZ] = 0.0;
  217. PlayerToyInfo[playerid][i][ptScaleX] = 1.0;
  218. PlayerToyInfo[playerid][i][ptScaleY] = 1.0;
  219. PlayerToyInfo[playerid][i][ptScaleZ] = 1.0;
  220. PlayerToyInfo[playerid][i][ptTradable] = 1;
  221. PlayerToyInfo[playerid][i][ptSpecial] = 1;
  222. g_mysql_NewToy(playerid, i);
  223. SendClientMessageEx(playerid, COLOR_GRAD1, "Due to you not having any available slots, we've temporarily given you an additional slot to use/sell/trade your toy.");
  224. SendClientMessageEx(playerid, COLOR_RED, "Note: Please take note that after selling the toy, the temporarily additional toy slot will be removed.");
  225. break;
  226. }
  227. }
  228. }
  229. }
  230. return 0;
  231. }