1
0

points.pwn 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Point System (Re-done)
  11. by Shane Roberts
  12. Next Generation Gaming, LLC
  13. (created by Next Generation Gaming Development Team)
  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. #include <YSI\y_hooks>
  35. CMD:getmats(playerid, params[])
  36. {
  37. if(PlayerInfo[playerid][pJob] != 9 && PlayerInfo[playerid][pJob2] != 9 && PlayerInfo[playerid][pJob3] != 9 && PlayerInfo[playerid][pJob] != 18 && PlayerInfo[playerid][pJob2] != 18 && PlayerInfo[playerid][pJob3] != 18) return SendClientMessageEx(playerid,COLOR_GREY," You are not an Arms Dealer or Craftsman!");
  38. if(CheckPointCheck(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
  39. new point, drank[64], vip = ((0 <= PlayerInfo[playerid][pDonateRank] < 5) ? PlayerInfo[playerid][pDonateRank] : 0);
  40. switch(vip)
  41. {
  42. case 0: drank = "Non-VIP";
  43. case 1: drank = "Bronze VIP";
  44. case 2: drank = "Silver VIP";
  45. case 3: drank = "Gold VIP";
  46. case 4: drank = "Platinum VIP";
  47. }
  48. FetchPoint(playerid, point, (IsABoat(GetPlayerVehicleID(playerid)) ? 15.0 : 3.0));
  49. if(point == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not at a material point!");
  50. if(DynPoints[point][poType] != 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point doesn't offer material runs!");
  51. if(DynPoints[point][poAmount][vip] < 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "There is no material amount set up for %s for this point!", drank);
  52. if(DynPoints[point][poPos2][0] == 0.0 || DynPoints[point][poPos2][1] == 0.0) return SendClientMessageEx(playerid, COLOR_GRAD1, "The end delivery point hasn't been setup yet!");
  53. if(DynPoints[point][poBoat] && !IsABoat(GetPlayerVehicleID(playerid))) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be in a boat!");
  54. if(vip == 0) {
  55. if(GetPlayerCash(playerid) < 500) return SendClientMessageEx(playerid, COLOR_RED, "You cannot afford the $500 for the materials packages!");
  56. GivePlayerCash(playerid, -500);
  57. SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %s materials packages for $500", number_format(DynPoints[point][poAmount][vip]));
  58. } else {
  59. if(GetPlayerCash(playerid) < (500 * vip)) return SendClientMessageEx(playerid, COLOR_RED, "You cannot afford the $%s for the materials packages!", number_format((500 * vip)));
  60. GivePlayerCash(playerid, -(500 * vip));
  61. SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %s materials packages for $%s", number_format(DynPoints[point][poAmount][vip]), number_format((500 * vip)));
  62. }
  63. MatsAmount[playerid] = DynPoints[point][poAmount][vip];
  64. if(vip > 0) SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "VIP: You have recieved more materials packages because of your %s.", drank);
  65. MatDeliver[playerid] = point;
  66. SetPVarInt(playerid, "tpMatRunTimer", 10);
  67. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPMATRUNTIMER);
  68. if((0 <= DynPoints[point][poCaptureGroup] < MAX_GROUPS)) arrGroupData[DynPoints[point][poCaptureGroup]][g_iBudget] +=500;
  69. SetPlayerCheckpoint(playerid, DynPoints[point][poPos2][0], DynPoints[point][poPos2][1], DynPoints[point][poPos2][2], 5);
  70. return 1;
  71. }
  72. CMD:getdrugs(playerid, params[]) {
  73. if(PlayerInfo[playerid][pJob] != 14 && PlayerInfo[playerid][pJob2] != 14 && PlayerInfo[playerid][pJob3] != 14 && !IsACriminal(playerid)) return SendClientMessageEx(playerid,COLOR_GREY," You are not a drug smuggler or in a family!");
  74. if(CheckPointCheck(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
  75. new point, drank[64], vip = ((0 <= PlayerInfo[playerid][pDonateRank] < 5) ? PlayerInfo[playerid][pDonateRank] : 0), string[128];
  76. switch(vip)
  77. {
  78. case 0: drank = "Non-VIP";
  79. case 1: drank = "Bronze VIP";
  80. case 2: drank = "Silver VIP";
  81. case 3: drank = "Gold VIP";
  82. case 4: drank = "Platinum VIP";
  83. }
  84. FetchPoint(playerid, point, (IsABoat(GetPlayerVehicleID(playerid)) ? 15.0 : 3.0));
  85. if(point == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not at a drug point!");
  86. if(DynPoints[point][poType] < 1 || DynPoints[point][poType] > 4) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point doesn't offer any drug runs! (TYPE: %d)", DynPoints[point][poType]);
  87. if(DynPoints[point][poAmount][vip] < 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "There is no material amount set up for %s for this point!", drank);
  88. if(DynPoints[point][poPos2][0] == 0.0 || DynPoints[point][poPos2][1] == 0.0) return SendClientMessageEx(playerid, COLOR_GRAD1, "The end delivery point hasn't been setup yet!");
  89. if(DynPoints[point][poBoat] && !IsABoat(GetPlayerVehicleID(playerid))) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be in a boat!");
  90. if(DynPoints[point][poType] == 1) { // Pot
  91. if(GetPlayerMoney(playerid) < 2000) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot afford the $2,000!");
  92. GivePlayerCashEx(playerid, TYPE_ONHAND, -2000);
  93. SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %sg of pot packages for $2,000", number_format(DynPoints[point][poAmount][vip]));
  94. }
  95. if(DynPoints[point][poType] == 2) { // Crack
  96. if(PlayerInfo[playerid][pDrugSmuggler] < 50) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be at least level two drug smuggler to do this run!");
  97. if(GetPlayerMoney(playerid) < 10000) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot afford the $10,000!");
  98. GivePlayerCashEx(playerid, TYPE_ONHAND, -10000);
  99. SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %sg of crack packages for $10,000!", number_format(DynPoints[point][poAmount][vip]));
  100. }
  101. if(DynPoints[point][poType] == 3) { // Meth
  102. if(PlayerInfo[playerid][pDrugSmuggler] < 200) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be at least level four drug smuggler to do this run!");
  103. if(GetPlayerMoney(playerid) < 25000) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot afford the $25,000!");
  104. GivePlayerCashEx(playerid, TYPE_ONHAND, -25000);
  105. SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %sg of meth packages for $25,000!", number_format(DynPoints[point][poAmount][vip]));
  106. }
  107. if(DynPoints[point][poType] == 4) { // Ecstasy
  108. if(PlayerInfo[playerid][pDrugSmuggler] < 400) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be at least level five drug smuggler to do this run!");
  109. if(GetPlayerMoney(playerid) < 50000) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot afford the $50,000!");
  110. GivePlayerCashEx(playerid, TYPE_ONHAND, -50000);
  111. SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %sg of ecstasy packages for $50,000!", number_format(DynPoints[point][poAmount][vip]));
  112. }
  113. format(string, sizeof(string), "* %s takes a drug package.", GetPlayerNameEx(playerid));
  114. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  115. MatsAmount[playerid] = DynPoints[point][poAmount][vip];
  116. MatDeliver[playerid] = point;
  117. if(vip > 0) SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "VIP: You have recieved more packages because of your %s.", drank);
  118. SetPlayerCheckpoint(playerid, DynPoints[point][poPos2][0], DynPoints[point][poPos2][1], DynPoints[point][poPos2][2], 5);
  119. SetPVarInt(playerid, "tpMatRunTimer", 10);
  120. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPMATRUNTIMER);
  121. return 1;
  122. }
  123. CMD:pointtime(playerid, params[])
  124. {
  125. new point;
  126. if(sscanf(params, "i", point)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /pointtime [pointid]");
  127. if((1 <= point <= MAX_POINTS)) {
  128. if(strcmp(DynPoints[point-1][poName], "NULL", true) == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point hasn't officaly been setup yet!");
  129. if(DynPoints[point-1][poCapturable] != 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "%s is not ready for takeover.", DynPoints[point-1][poName]);
  130. if(!DynPoints[point-1][poTimeLeft]) return SendClientMessageEx(playerid, COLOR_GRAD1, "%s is currently is not being captured!", DynPoints[point-1][poName]);
  131. SendClientMessageEx(playerid, COLOR_YELLOW, "This point is currently being captured by: %s | Time left: %d minute(s)", arrGroupData[DynPoints[point-1][poCapperGroup]][g_szGroupName], DynPoints[point-1][poTimeLeft]);
  132. } else {
  133. SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid point ID given - You can only select from 1 - %d!", MAX_POINTS);
  134. }
  135. return 1;
  136. }
  137. CMD:gotodpoint(playerid, params[]) {
  138. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1) {
  139. new pid;
  140. if(sscanf(params, "d", pid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /gotodpoint [number]");
  141. if((1 <= pid <= MAX_POINTS)) {
  142. if(DynPoints[pid-1][poPos][0] == 0.0 || DynPoints[pid-1][poPos][1] == 0.0) return SendClientMessageEx(playerid, COLOR_GRAD1, "The selected point ID hasn't been setup!");
  143. SetPlayerPos(playerid, DynPoints[pid-1][poPos][0], DynPoints[pid-1][poPos][1], DynPoints[pid-1][poPos][2]);
  144. PlayerInfo[playerid][pInt] = DynPoints[pid-1][poInt];
  145. SetPlayerInterior(playerid,DynPoints[pid-1][poInt]);
  146. PlayerInfo[playerid][pVW] = DynPoints[pid-1][poVW];
  147. SetPlayerVirtualWorld(playerid,DynPoints[pid-1][poVW]);
  148. GameTextForPlayer(playerid, "~w~Teleporting", 5000, 1);
  149. } else {
  150. SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid point ID given - You can only select from 1 - %d!", MAX_POINTS);
  151. }
  152. }
  153. return 1;
  154. }
  155. CMD:capture(playerid, params[])
  156. {
  157. new point, string[128];
  158. if(!IsACriminal(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be apart of a criminal organization to do this!");
  159. FetchPoint(playerid, point, 1.0);
  160. if(point == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not at a capture point!");
  161. if(PlayerInfo[playerid][pRank] < arrGroupData[PlayerInfo[playerid][pMember]][g_iPointCapRank]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not high rank enough to capture points!");
  162. if(DynPoints[point][poLocked]) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point is not available for capture!");
  163. if(DynPoints[point][poCapturable] != 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point is not ready to be taken over!");
  164. if(DynPoints[point][poCapperGroup] == PlayerInfo[playerid][pMember]) return SendClientMessageEx(playerid, COLOR_GRAD1, "Your family is currently processing this take over!");
  165. if(DynPoints[point][poCapping] != INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_GRAD1, "Someone is currently starting the takeover for this point!");
  166. if(GetPlayerPing(playerid) > 500) return SendClientMessageEx(playerid, COLOR_WHITE, "You can not capture with 500+ ping!");
  167. format(string, sizeof(string), "%s is attempting to capture the point (VW: %d).", GetPlayerNameEx(playerid), DynPoints[point][poVW]);
  168. ProxDetector(70.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
  169. GetPlayerPos(playerid, DynPoints[point][CapturePos][0], DynPoints[point][CapturePos][1], DynPoints[point][CapturePos][2]);
  170. DynPoints[point][poCapping] = playerid;
  171. DynPoints[point][poTimeCapLeft] = 10;
  172. SetTimerEx("ProgressTimer", 1000, 0, "d", point);
  173. return 1;
  174. }
  175. forward ProgressTimer(id);
  176. public ProgressTimer(id)
  177. {
  178. szMiscArray[0] = 0;
  179. new Float: x, Float: y, Float: z;
  180. if(DynPoints[id][poCapping] != INVALID_PLAYER_ID && IsPlayerConnected(DynPoints[id][poCapping])) {
  181. if(--DynPoints[id][poTimeCapLeft] > 0) {
  182. format(szMiscArray, sizeof(szMiscArray), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~%d seconds left", DynPoints[id][poTimeCapLeft]);
  183. GameTextForPlayer(DynPoints[id][poCapping], szMiscArray, 1100, 3);
  184. format(szMiscArray, sizeof(szMiscArray), "%s is attempting to capture the point, time left: %d", GetPlayerNameEx(DynPoints[id][poCapping]), DynPoints[id][poTimeCapLeft]);
  185. UpdateDynamic3DTextLabelText(DynPoints[id][poTextID], COLOR_RED, szMiscArray);
  186. SetTimerEx("ProgressTimer", 1000, 0, "d", id);
  187. } else {
  188. GetPlayerPos(DynPoints[id][poCapping], x, y, z);
  189. if (DynPoints[id][CapturePos][0] != x || DynPoints[id][CapturePos][1] != y || DynPoints[id][CapturePos][2] != z || GetPVarInt(DynPoints[id][poCapping],"Injured") == 1) {
  190. SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. You either moved or died while attempting to capture.");
  191. DynPoints[id][poCapping] = INVALID_PLAYER_ID;
  192. DynPoints[id][poTimeCapLeft] = 0;
  193. UpdatePoint(id);
  194. return 1;
  195. }
  196. if(DynPoints[id][poCapturable] < 1)
  197. {
  198. SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. The point was already captured.");
  199. DynPoints[id][poCapping] = INVALID_PLAYER_ID;
  200. DynPoints[id][poTimeCapLeft] = 0;
  201. UpdatePoint(id);
  202. return 1;
  203. }
  204. if(playerTabbed[DynPoints[id][poCapping]] != 0)
  205. {
  206. SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. You were alt-tabbed.");
  207. format(szMiscArray, sizeof(szMiscArray), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may have possibly alt tabbed to capture a point.", GetPlayerNameEx(DynPoints[id][poCapping]), DynPoints[id][poCapping]);
  208. ABroadCast( COLOR_YELLOW, szMiscArray, 2 );
  209. DynPoints[id][poCapping] = INVALID_PLAYER_ID;
  210. DynPoints[id][poTimeCapLeft] = 0;
  211. UpdatePoint(id);
  212. return 1;
  213. }
  214. if(GetPlayerVirtualWorld(DynPoints[id][poCapping]) != DynPoints[id][poVW] || GetPlayerInterior(DynPoints[id][poCapping]) != DynPoints[id][poInt])
  215. {
  216. SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. You were not in the point virtual/interior world.");
  217. format(szMiscArray, sizeof(szMiscArray), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may have possibly desynced himself to capture a point.", GetPlayerNameEx(DynPoints[id][poCapping]), DynPoints[id][poCapping]);
  218. ABroadCast( COLOR_YELLOW, szMiscArray, 2 );
  219. DynPoints[id][poCapping] = INVALID_PLAYER_ID;
  220. DynPoints[id][poTimeCapLeft] = 0;
  221. UpdatePoint(id);
  222. return 1;
  223. }
  224. if(!IsACriminal(DynPoints[id][poCapping])) {
  225. SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. You either left the group or were kicked!");
  226. DynPoints[id][poCapping] = INVALID_PLAYER_ID;
  227. DynPoints[id][poTimeCapLeft] = 0;
  228. UpdatePoint(id);
  229. return 1;
  230. }
  231. new fam = PlayerInfo[DynPoints[id][poCapping]][pMember];
  232. DynPoints[id][poPName] = GetPlayerNameEx(DynPoints[id][poCapping]);
  233. if(IsValidDynamicPickup(DynPoints[id][poPickupID])) DestroyDynamicPickup(DynPoints[id][poPickupID]);
  234. DynPoints[id][poPickupID] = CreateDynamicPickup(1313, 23, DynPoints[id][poPos][0], DynPoints[id][poPos][1], DynPoints[id][poPos][2], .worldid = DynPoints[id][poVW], .interiorid = DynPoints[id][poInt]);
  235. format(szMiscArray, sizeof(szMiscArray), "%s has attempted to take control of the %s for %s, it will be theirs in 10 minutes.", DynPoints[id][poPName], DynPoints[id][poName], arrGroupData[fam][g_szGroupName]);
  236. SendClientMessageToAllEx(COLOR_YELLOW, szMiscArray);
  237. UpdateDynamic3DTextLabelText(DynPoints[id][poTextID], COLOR_YELLOW, szMiscArray);
  238. DynPoints[id][poCapping] = INVALID_PLAYER_ID;
  239. DynPoints[id][poTimeCapLeft] = 0;
  240. DynPoints[id][poCapperGroup] = fam;
  241. DynPoints[id][poTimeLeft] = 10;
  242. if(DynPoints[id][CapTimer] != 0) KillTimer(DynPoints[id][CapTimer]);
  243. DynPoints[id][CapTimer] = SetTimerEx("CaptureTimer", 60000, 1, "d", id);
  244. }
  245. } else {
  246. DynPoints[id][poCapping] = INVALID_PLAYER_ID;
  247. DynPoints[id][poTimeCapLeft] = 0;
  248. UpdatePoint(id);
  249. }
  250. return 1;
  251. }
  252. forward CaptureTimer(id);
  253. public CaptureTimer(id)
  254. {
  255. szMiscArray[0] = 0;
  256. if(--DynPoints[id][poTimeLeft] > 0) {
  257. format(szMiscArray, sizeof(szMiscArray), "%s has successfully attempted to take over of %s for %s, it will be theirs in %d minutes!", DynPoints[id][poPName], DynPoints[id][poName], arrGroupData[DynPoints[id][poCapperGroup]][g_szGroupName], DynPoints[id][poTimeLeft]);
  258. UpdateDynamic3DTextLabelText(DynPoints[id][poTextID], COLOR_YELLOW, szMiscArray);
  259. } else {
  260. format(szMiscArray, sizeof(szMiscArray), "%s has successfully taken control of the %s for %s.", DynPoints[id][poPName], DynPoints[id][poName], arrGroupData[DynPoints[id][poCapperGroup]][g_szGroupName]);
  261. SendClientMessageToAllEx(COLOR_YELLOW, szMiscArray);
  262. DynPoints[id][poCaptureGroup] = DynPoints[id][poCapperGroup];
  263. DynPoints[id][poCapperGroup] = INVALID_GROUP_ID;
  264. strmid(DynPoints[id][poCaptureName], DynPoints[id][poPName], 0, 32, 32);
  265. DynPoints[id][poTimeLeft] = 0;
  266. DynPoints[id][poCapturable] = 0;
  267. DynPoints[id][poTimer] = 25;
  268. KillTimer(DynPoints[id][CapTimer]);
  269. DynPoints[id][CapTimer] = 0;
  270. UpdatePoint(id);
  271. SavePoint(id);
  272. }
  273. return 1;
  274. }
  275. stock FetchPoint(playerid, &point, Float:range)
  276. {
  277. point = -1;
  278. for(new p = 0; p < MAX_POINTS; p++)
  279. {
  280. if(IsPlayerInRangeOfPoint(playerid,range,DynPoints[p][poPos][0], DynPoints[p][poPos][1], DynPoints[p][poPos][2]))
  281. {
  282. if(GetPlayerVirtualWorld(playerid) == DynPoints[p][poVW] && GetPlayerInterior(playerid) == DynPoints[p][poInt]) {
  283. point = p;
  284. }
  285. break;
  286. }
  287. }
  288. }
  289. CMD:points(playerid, params[])
  290. {
  291. szMiscArray[0] = 0;
  292. for(new i; i < MAX_POINTS; i++)
  293. {
  294. if(strcmp(DynPoints[i][poName], "NULL", true) != 0) {
  295. if(DynPoints[i][poID] != 0)
  296. {
  297. if (DynPoints[i][poType] >= 0)
  298. {
  299. if(DynPoints[i][poLocked] != 1)
  300. {
  301. if((0 <= DynPoints[i][poCaptureGroup] < MAX_GROUPS)) {
  302. format(szMiscArray, sizeof(szMiscArray), "Point ID: %d | Name: %s | Owner: %s | Captured By: %s | Hours: %d", DynPoints[i][poID], DynPoints[i][poName],arrGroupData[DynPoints[i][poCaptureGroup]][g_szGroupName],DynPoints[i][poCaptureName],DynPoints[i][poTimer]);
  303. }
  304. else {
  305. format(szMiscArray, sizeof(szMiscArray), "Point ID: %d | Name: %s | Owner: Nobody | Captured By: Nobody | Hours: %d", DynPoints[i][poID], DynPoints[i][poName], DynPoints[i][poTimer]);
  306. }
  307. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  308. }
  309. }
  310. }
  311. }
  312. }
  313. return 1;
  314. }
  315. CMD:editpoint(playerid, params[])
  316. {
  317. if(PlayerInfo[playerid][pFactionModerator] >= 2 || PlayerInfo[playerid][pAdmin] >= 1337)
  318. {
  319. ListPoints(playerid);
  320. }
  321. else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to preform this command.");
  322. return 1;
  323. }
  324. ListPoints(playerid) {
  325. new szDialogStr[MAX_POINTS * 25], i;
  326. while(i < MAX_POINTS)
  327. {
  328. if(strcmp(DynPoints[i][poName], "NULL", true) != 0)
  329. format(szDialogStr, sizeof szDialogStr, "%s\n(%i) %s{FFFFFF}", szDialogStr, i + 1, DynPoints[i][poName]);
  330. else
  331. format(szDialogStr, sizeof szDialogStr, "%s\n(%i) (empty)", szDialogStr, i + 1);
  332. ++i;
  333. }
  334. return ShowPlayerDialogEx(playerid, DIALOG_LISTPOINTS, DIALOG_STYLE_LIST, "Edit Points", szDialogStr, "Select", "Cancel");
  335. }
  336. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  337. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  338. new szDialogStr[1256];
  339. switch(dialogid)
  340. {
  341. case DIALOG_LISTPOINTS:
  342. {
  343. if(!response) return 1;
  344. switch(listitem)
  345. {
  346. case 0 .. MAX_POINTS:
  347. {
  348. SetPVarInt(playerid, "pEditingPoint", listitem);
  349. format(szDialogStr, sizeof szDialogStr, "Name: %s\n\
  350. Type: %s\n\
  351. Edit Exterior/Interior Position\n\
  352. Amount Per Hour (%s)\n\
  353. Edit Delivery Packages\n\
  354. Edit Capture Time\n\
  355. Boat Run Only (%s)\n\
  356. Locked (%s)\n\
  357. Reset\n\
  358. Delete", DynPoints[listitem][poName],
  359. PointTypeToName(DynPoints[listitem][poType]),
  360. number_format(DynPoints[listitem][poAmountHour]),
  361. (DynPoints[listitem][poBoat]) ? ("Yes") : ("No"),
  362. (DynPoints[listitem][poLocked]) ? ("Yes") : ("No")
  363. );
  364. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT, DIALOG_STYLE_LIST, "Edit Points", szDialogStr, "Select", "Cancel");
  365. }
  366. }
  367. }
  368. case DIALOG_EDITPOINT:
  369. {
  370. if(!response) return 1;
  371. szMiscArray[0] = 0;
  372. switch(listitem)
  373. {
  374. case 0:
  375. {
  376. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_NAME, DIALOG_STYLE_INPUT, "Edit Points - Name", "Please enter a new name for the point.", "Select", "Cancel");
  377. }
  378. case 1:
  379. {
  380. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_TYPE, DIALOG_STYLE_LIST, "Edit Points - Type", "Materials\nPot\nCrack\nMeth\nEcstasy", "Select", "Cancel");
  381. }
  382. case 2:
  383. {
  384. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_POSITION, DIALOG_STYLE_LIST, "Edit Points - Position", "Pickup Point\nDelivery Point", "Select", "Cancel");
  385. }
  386. case 3:
  387. {
  388. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATERIALS, DIALOG_STYLE_INPUT, "Edit Points - Amount Per Hour", "Please enter the amount this point will give per hour to the owned group.", "Select", "Cancel");
  389. }
  390. case 4:
  391. {
  392. if(!response) return ResetDialog(playerid);
  393. format(szDialogStr, sizeof szDialogStr, "Package Non-VIP (%s)\n\
  394. Package Bronze VIP (%s)\n\
  395. Package Silver VIP (%s)\n\
  396. Package Gold VIP (%s)\n\
  397. Package Platinum VIP (%s)",
  398. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][0]),
  399. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][1]),
  400. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][2]),
  401. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][3]),
  402. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][4])
  403. );
  404. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPLIST, DIALOG_STYLE_LIST, "Edit Points - Edit Delivery Packages", szDialogStr, "Select", "Cancel");
  405. }
  406. case 5:
  407. {
  408. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_CAPTIME, DIALOG_STYLE_INPUT, "Edit Points - Capturable Timer", "Specify a time (hours) to when the point is allowed to be captured.\nSetting 0 will announce point is ready for capture!", "Select", "Cancel");
  409. }
  410. case 6:
  411. {
  412. switch(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poBoat])
  413. {
  414. case 0: DynPoints[GetPVarInt(playerid, "pEditingPoint")][poBoat] = 1;
  415. case 1: DynPoints[GetPVarInt(playerid, "pEditingPoint")][poBoat] = 0;
  416. }
  417. ResetDialog(playerid);
  418. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  419. }
  420. case 7:
  421. {
  422. switch(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked])
  423. {
  424. case 0: DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked] = 1;
  425. case 1: DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked] = 0;
  426. }
  427. UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
  428. ResetDialog(playerid);
  429. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  430. }
  431. case 8:
  432. {
  433. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimer] = 0;
  434. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapturable] = 1;
  435. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCaptureGroup] = INVALID_GROUP_ID;
  436. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimeLeft] = 0;
  437. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimeCapLeft] = 0;
  438. DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapturePos][0] = 0.00000;
  439. DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapturePos][1] = 0.00000;
  440. DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapturePos][2] = 0.00000;
  441. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapperGroup] = INVALID_GROUP_ID;
  442. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapping] = INVALID_PLAYER_ID;
  443. format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPName], MAX_PLAYER_NAME, "No One");
  444. if(DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer] != 0) KillTimer(DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer]);
  445. DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer] = 0;
  446. SendClientMessageEx(playerid, COLOR_YELLOW, "You have reset %s's capture timer / group owner.", DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName]);
  447. UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
  448. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  449. ResetDialog(playerid);
  450. }
  451. case 9:
  452. {
  453. for(new p; p < 3; p++)
  454. {
  455. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos][p] = 0.00000;
  456. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos2][p] = 0.00000;
  457. DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapturePos][p] = 0.00000;
  458. }
  459. for(new m; m < 5; m++)
  460. {
  461. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][m] = 0;
  462. }
  463. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked] = 1;
  464. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmountHour] = 0;
  465. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poInt] = 0;
  466. DynPoints[GetPVarInt(playerid, "pEditingPoint")][po2Int] = 0;
  467. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poVW] = 0;
  468. DynPoints[GetPVarInt(playerid, "pEditingPoint")][po2VW] = 0;
  469. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimer] = 0;
  470. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapturable] = 1;
  471. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCaptureGroup] = INVALID_GROUP_ID;
  472. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimeLeft] = 0;
  473. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimeCapLeft] = 0;
  474. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapperGroup] = INVALID_GROUP_ID;
  475. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapping] = INVALID_PLAYER_ID;
  476. format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPName], MAX_PLAYER_NAME, "No One");
  477. if(DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer] != 0) KillTimer(DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer]);
  478. DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer] = 0;
  479. SendClientMessageEx(playerid, COLOR_YELLOW, "You have delete point: %s.", DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName]);
  480. format(szMiscArray, sizeof(szMiscArray), "%s has deleted point ID: %d", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"));
  481. Log("logs/editpoint.log", szMiscArray);
  482. format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName], MAX_PLAYER_NAME, "NULL");
  483. UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
  484. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  485. ResetDialog(playerid);
  486. }
  487. }
  488. }
  489. case DIALOG_EDITPOINT_NAME:
  490. {
  491. szMiscArray[0] = 0;
  492. if(!response) return ResetDialog(playerid);
  493. if(strlen(inputtext) > 24) return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_NAME, DIALOG_STYLE_INPUT, "Edit Points - Name", "Please enter a new name for the point.\n\nPlease specify a name under 25 characters.", "Select", "Cancel");
  494. strcpy(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName], (isnull(inputtext) ? "NULL" : inputtext), 24);
  495. format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's name to %s", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), inputtext);
  496. Log("logs/editpoint.log", szMiscArray);
  497. ResetDialog(playerid);
  498. UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
  499. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  500. }
  501. case DIALOG_EDITPOINT_TYPE:
  502. {
  503. szMiscArray[0] = 0;
  504. if(!response) return ResetDialog(playerid);
  505. switch(listitem)
  506. {
  507. case 0 .. 4:
  508. {
  509. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poType] = listitem;
  510. format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's type to %s.", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), PointTypeToName(listitem));
  511. Log("logs/editpoint.log", szMiscArray);
  512. SendClientMessageEx(playerid, COLOR_YELLOW, "You have edited point %d's type to %s", GetPVarInt(playerid, "pEditingPoint"), PointTypeToName(listitem));
  513. ResetDialog(playerid);
  514. UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
  515. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  516. }
  517. }
  518. }
  519. case DIALOG_EDITPOINT_POSITION:
  520. {
  521. new Float: pvPos[3];
  522. GetPlayerPos(playerid, pvPos[0], pvPos[1], pvPos[2]);
  523. if(!response) return ResetDialog(playerid);
  524. switch(listitem)
  525. {
  526. case 0:
  527. {
  528. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos][0] = pvPos[0];
  529. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos][1] = pvPos[1];
  530. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos][2] = pvPos[2];
  531. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poVW] = GetPlayerVirtualWorld(playerid);
  532. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poInt] = GetPlayerInterior(playerid);
  533. SendClientMessageEx(playerid, COLOR_YELLOW, "You updated the points default location.");
  534. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  535. }
  536. case 1:
  537. {
  538. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos2][0] = pvPos[0];
  539. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos2][1] = pvPos[1];
  540. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos2][2] = pvPos[2];
  541. DynPoints[GetPVarInt(playerid, "pEditingPoint")][po2VW] = GetPlayerVirtualWorld(playerid);
  542. DynPoints[GetPVarInt(playerid, "pEditingPoint")][po2Int] = GetPlayerInterior(playerid);
  543. SendClientMessageEx(playerid, COLOR_YELLOW, "You updated the delivery destination for %s", DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName]);
  544. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  545. }
  546. }
  547. UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
  548. format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's position %d amount to X: %f, Y: %f, Z: %f, VW: %d", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), listitem, pvPos[0], pvPos[0], pvPos[0], GetPlayerVirtualWorld(playerid));
  549. Log("logs/editpoint.log", szMiscArray);
  550. }
  551. case DIALOG_EDITPOINT_MATERIALS:
  552. {
  553. szMiscArray[0] = 0;
  554. if(!response) return ResetDialog(playerid);
  555. if(!IsNumeric(inputtext) || strval(inputtext) < 0) return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATERIALS, DIALOG_STYLE_INPUT, "Edit Points - Amount Per Hour", "Please enter the amount this point will give per hour to the owned group.\n\nPlease enter a numerical integer and is 0 or above.", "Select", "Cancel");
  556. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmountHour] = strval(inputtext);
  557. format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's per hour amount to %d", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), inputtext);
  558. Log("logs/editpoint.log", szMiscArray);
  559. ResetDialog(playerid);
  560. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  561. }
  562. case DIALOG_EDITPOINT_MATVIPLIST:
  563. {
  564. if(response) {
  565. SetPVarInt(playerid, "pEditingVIPPoint", listitem);
  566. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPSET, DIALOG_STYLE_INPUT, "Edit Points - Package", "Please enter an amount this package is to give to per delivery.", "Select", "Cancel");
  567. } else {
  568. ResetDialog(playerid);
  569. }
  570. }
  571. case DIALOG_EDITPOINT_CAPTIME:
  572. {
  573. szMiscArray[0] = 0;
  574. if(!response) return ResetDialog(playerid);
  575. if(!IsNumeric(inputtext) || strval(inputtext) < 0) return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_CAPTIME, DIALOG_STYLE_INPUT, "Edit Points - Capturable Timer", "Specify a time (hours) to when the point is allowed to be captured.\nSetting 0 will announce point is ready for capture!\n\nPlease enter a numerical integer and is 0 or above.", "Select", "Cancel");
  576. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapturable] = (strval(inputtext) == 0 ? 1 : 0);
  577. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimer] = strval(inputtext);
  578. format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's capturable timer to %d", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), inputtext);
  579. Log("logs/editpoint.log", szMiscArray);
  580. ResetDialog(playerid);
  581. UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
  582. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  583. }
  584. case DIALOG_EDITPOINT_MATVIPSET:
  585. {
  586. if(response) {
  587. if(!IsNumeric(inputtext) || strval(inputtext) < 1) return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPSET, DIALOG_STYLE_INPUT, "Edit Points - Package", "Please enter an amount this package is to give to per delivery.\n\nPlease enter a numerical integer and is 0 or above.", "Select", "Cancel");
  588. new drank[16];
  589. szMiscArray[0] = 0;
  590. switch(GetPVarInt(playerid, "pEditingVIPPoint"))
  591. {
  592. case 0: drank = "Non-VIP";
  593. case 1: drank = "Bronze VIP";
  594. case 2: drank = "Silver VIP";
  595. case 3: drank = "Gold VIP";
  596. case 4: drank = "Platinum VIP";
  597. }
  598. DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][GetPVarInt(playerid, "pEditingVIPPoint")] = strval(inputtext);
  599. DeletePVar(playerid, "pEditingVIPPoint");
  600. SavePoint(GetPVarInt(playerid, "pEditingPoint"));
  601. SendClientMessageEx(playerid, COLOR_YELLOW, "You set %s to get %s per package delivery!", drank, number_format(strval(inputtext)));
  602. format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's delivery package to %s for %s.", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), number_format(strval(inputtext)), drank);
  603. Log("logs/editpoint.log", szMiscArray);
  604. format(szDialogStr, sizeof szDialogStr, "Package Non-VIP (%s)\n\
  605. Package Bronze VIP (%s)\n\
  606. Package Silver VIP (%s)\n\
  607. Package Gold VIP (%s)\n\
  608. Package Platinum VIP (%s)",
  609. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][0]),
  610. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][1]),
  611. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][2]),
  612. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][3]),
  613. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][4])
  614. );
  615. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPLIST, DIALOG_STYLE_LIST, "Edit Points - Edit Delivery Packages", szDialogStr, "Select", "Cancel");
  616. } else {
  617. format(szDialogStr, sizeof szDialogStr, "Package Non-VIP (%s)\n\
  618. Package Bronze VIP (%s)\n\
  619. Package Silver VIP (%s)\n\
  620. Package Gold VIP (%s)\n\
  621. Package Platinum VIP (%s)",
  622. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][0]),
  623. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][1]),
  624. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][2]),
  625. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][3]),
  626. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][4])
  627. );
  628. ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPLIST, DIALOG_STYLE_LIST, "Edit Points - Edit Delivery Packages", szDialogStr, "Select", "Cancel");
  629. }
  630. }
  631. }
  632. return 0;
  633. }
  634. stock ResetDialog(playerid) {
  635. new szDialogStr[1256];
  636. format(szDialogStr, sizeof szDialogStr, "Name: %s\n\
  637. Type: %s\n\
  638. Edit Exterior/Interior Position\n\
  639. Amount Hour Hour (%s)\n\
  640. Edit Delivery Packages\n\
  641. Edit Capture Time\n\
  642. Boat Run Only (%s)\n\
  643. Locked (%s)\n\
  644. Reset\n\
  645. Delete", DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName],
  646. PointTypeToName(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poType]),
  647. number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmountHour]),
  648. (DynPoints[GetPVarInt(playerid, "pEditingPoint")][poBoat]) ? ("Yes") : ("No"),
  649. (DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked]) ? ("Yes") : ("No")
  650. );
  651. return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT, DIALOG_STYLE_LIST, "Edit Points", szDialogStr, "Select", "Cancel");
  652. }
  653. PointTypeToName(id)
  654. {
  655. new type[24];
  656. switch(id)
  657. {
  658. case 0: format(type, 24, "Materials");
  659. case 1: format(type, 24, "Pot");
  660. case 2: format(type, 24, "Crack");
  661. case 3: format(type, 24, "Meth");
  662. case 4: format(type, 24, "Ecstasy");
  663. }
  664. return type;
  665. }
  666. stock SavePoint(point) {
  667. new szQuery[2048];
  668. mysql_format(MainPipeline, szQuery, sizeof(szQuery), "UPDATE `dynpoints` SET \
  669. `pointname` = '%e', \
  670. `type` = %d, \
  671. `posx` = %f, \
  672. `posy` = %f, \
  673. `posz` = %f, \
  674. `pos2x` = %f, \
  675. `pos2y` = %f, \
  676. `pos2z` = %f, \
  677. `vw` = %d, \
  678. `int` = %d, \
  679. `vw2` = %d, \
  680. `int2` = %d, \
  681. `boatonly` = %d, \
  682. `capturename` = '%e', \
  683. `capturegroup` = %d, \
  684. `ready` = %d, \
  685. `timer` = %d, \
  686. `amounthour` = %d, \
  687. `amount0` = %d, \
  688. `amount1` = %d, \
  689. `amount2` = %d, \
  690. `amount3` = %d, \
  691. `amount4` = %d, \
  692. `locked` = %d WHERE `id` = %d",
  693. DynPoints[point][poName],
  694. DynPoints[point][poType],
  695. DynPoints[point][poPos][0],
  696. DynPoints[point][poPos][1],
  697. DynPoints[point][poPos][2],
  698. DynPoints[point][poPos2][0],
  699. DynPoints[point][poPos2][1],
  700. DynPoints[point][poPos2][2],
  701. DynPoints[point][poVW],
  702. DynPoints[point][poInt],
  703. DynPoints[point][po2VW],
  704. DynPoints[point][po2Int],
  705. DynPoints[point][poBoat],
  706. DynPoints[point][poCaptureName],
  707. DynPoints[point][poCaptureGroup],
  708. DynPoints[point][poCapturable],
  709. DynPoints[point][poTimer],
  710. DynPoints[point][poAmountHour],
  711. DynPoints[point][poAmount][0],
  712. DynPoints[point][poAmount][1],
  713. DynPoints[point][poAmount][2],
  714. DynPoints[point][poAmount][3],
  715. DynPoints[point][poAmount][4],
  716. DynPoints[point][poLocked],
  717. point + 1);
  718. mysql_tquery(MainPipeline, szQuery, "OnQueryFinish", "i", SENDDATA_THREAD);
  719. }
  720. stock UpdatePoint(id)
  721. {
  722. new string[256];
  723. if(IsValidDynamicPickup(DynPoints[id][poPickupID])) DestroyDynamicPickup(DynPoints[id][poPickupID]);
  724. if(IsValidDynamic3DTextLabel(DynPoints[id][poTextID])) DestroyDynamic3DTextLabel(DynPoints[id][poTextID]);
  725. if(DynPoints[id][poPos][0] == 0.0) return 1;
  726. DynPoints[id][poPickupID] = CreateDynamicPickup(((DynPoints[id][poType] == 1) ? 1279 : (DynPoints[id][poType] == 2 || DynPoints[id][poType] == 3 || DynPoints[id][poType] == 4) ? 1241 : 1239), 23, DynPoints[id][poPos][0], DynPoints[id][poPos][1], DynPoints[id][poPos][2], .worldid = DynPoints[id][poVW], .interiorid = DynPoints[id][poInt]);
  727. switch(DynPoints[id][poType])
  728. {
  729. case 0: format(string, sizeof(string), "Materials Pickup (ID: %d)\nType /getmats to get materials.", DynPoints[id][poID]);
  730. case 1: format(string, sizeof(string), "Pot Pickup (ID: %d)\nType /getdrugs to get pot.", DynPoints[id][poID]);
  731. case 2: format(string, sizeof(string), "Crack Pickup (ID: %d)\nType /getdrugs to get crack.", DynPoints[id][poID]);
  732. case 3: format(string, sizeof(string), "Meth Pickup (ID: %d)\nType /getdrugs to get meth.", DynPoints[id][poID]);
  733. case 4: format(string, sizeof(string), "Ecstasy Pickup (ID: %d)\nType /getdrugs to get ecstasy.", DynPoints[id][poID]);
  734. }
  735. if(DynPoints[id][poCapturable] && !DynPoints[id][poLocked]) {
  736. format(string, sizeof(string), "%s\n%s has become available for capture! Stand here and /capture it.", string, DynPoints[id][poName]);
  737. }
  738. DynPoints[id][poTextID] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, DynPoints[id][poPos][0], DynPoints[id][poPos][1], DynPoints[id][poPos][2]+0.6, 10.0, .testlos = 1, .worldid = DynPoints[id][poVW], .interiorid = DynPoints[id][poInt], .streamdistance = 10.0);
  739. return 1;
  740. }
  741. stock LoadPoints()
  742. {
  743. printf("[Dynamic Points] Loading Dynamic Points from the database, please wait...");
  744. mysql_tquery(MainPipeline, "SELECT * FROM `dynpoints`", "OnLoadPoints", "");
  745. }
  746. forward OnLoadPoints();
  747. public OnLoadPoints()
  748. {
  749. new i, rows, szField[24];
  750. cache_get_row_count(rows);
  751. while(i < rows)
  752. {
  753. cache_get_value_name(i, "pointname", DynPoints[i][poName], MAX_PLAYER_NAME);
  754. cache_get_value_name_int(i, "type", DynPoints[i][poType]);
  755. cache_get_value_name_int(i, "id", DynPoints[i][poID]);
  756. cache_get_value_name_float(i, "posx", DynPoints[i][poPos][0]);
  757. cache_get_value_name_float(i, "posy", DynPoints[i][poPos][1]);
  758. cache_get_value_name_float(i, "posz", DynPoints[i][poPos][2]);
  759. cache_get_value_name_float(i, "pos2x", DynPoints[i][poPos2][0]);
  760. cache_get_value_name_float(i, "pos2y", DynPoints[i][poPos2][1]);
  761. cache_get_value_name_float(i, "pos2z", DynPoints[i][poPos2][2]);
  762. cache_get_value_name_int(i, "vw", DynPoints[i][poVW]);
  763. cache_get_value_name_int(i, "int", DynPoints[i][poInt]);
  764. cache_get_value_name_int(i, "vw2", DynPoints[i][po2VW]);
  765. cache_get_value_name_int(i, "int2", DynPoints[i][po2Int]);
  766. cache_get_value_name_int(i, "boatonly", DynPoints[i][poBoat]);
  767. cache_get_value_name(i, "capturename", DynPoints[i][poCaptureName], MAX_PLAYER_NAME);
  768. cache_get_value_name_int(i, "capturegroup", DynPoints[i][poCaptureGroup]);
  769. cache_get_value_name_int(i, "ready", DynPoints[i][poCapturable]);
  770. cache_get_value_name_int(i, "timer", DynPoints[i][poTimer]);
  771. cache_get_value_name_int(i, "amounthour", DynPoints[i][poAmountHour]);
  772. for(new m; m < 5; m++)
  773. {
  774. format(szField, sizeof(szField), "amount%d", m);
  775. cache_get_value_name_int(i, szField, DynPoints[i][poAmount][m]);
  776. }
  777. cache_get_value_name_int(i, "locked", DynPoints[i][poLocked]);
  778. // Ensure our non-loaded data has something.
  779. DynPoints[i][poTimeLeft] = 0; // 10 minute timer
  780. DynPoints[i][poTimeCapLeft] = 0; // 10 second timer
  781. DynPoints[i][CapturePos][0] = 0.00000;
  782. DynPoints[i][CapturePos][1] = 0.00000;
  783. DynPoints[i][CapturePos][2] = 0.00000;
  784. DynPoints[i][poCapperGroup] = INVALID_GROUP_ID;
  785. DynPoints[i][poCapping] = INVALID_PLAYER_ID;
  786. format(DynPoints[i][poPName], MAX_PLAYER_NAME, "No One");
  787. DynPoints[i][CapTimer] = 0;
  788. UpdatePoint(i);
  789. i++;
  790. }
  791. if(i > 0) printf("[Dynamic Points] %d dynamic points has been loaded.", i);
  792. else printf("[Dynamic Points] No dynamic points has been loaded.");
  793. return 1;
  794. }