wrappers.pwn 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. //--------------------------------[WRAPPERS.PWN]--------------------------------
  11. * Copyright (c) 2016, Next Generation Gaming, LLC
  12. *
  13. * All rights reserved.
  14. *
  15. * Redistribution and use in source and binary forms, with or without modification,
  16. * are not permitted in any case.
  17. *
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  23. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  24. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  25. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  26. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  27. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  28. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  29. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. /* ---------------- WRAPPERS ----------------- */
  32. Internal_SetPlayerPos(playerid, Float:X, Float:Y, Float:Z) {
  33. Bit_On(arrPAntiCheat[playerid], ac_bitValidPlayerPos);
  34. return SetPlayerPos(playerid, X, Y, Z);
  35. }
  36. Internal_TogglePlayerSpectating(playerid, toggle) {
  37. Bit_On(arrPAntiCheat[playerid], ac_bitValidSpectating);
  38. return TogglePlayerSpectating(playerid, toggle);
  39. }
  40. /*
  41. Internal_ShowPlayerNameTag(playerid, showplayerid, show) {
  42. if(PlayerInfo[playerid][pAdmin] > 0 || PlayerInfo[showplayerid][pAdmin] > 0) show = 1;
  43. return ShowPlayerNameTagForPlayer(playerid, showplayerid, show);
  44. }
  45. */
  46. /*
  47. Internal_SetPlayerHealth(playerid, Float:health) {
  48. //PlayerInfo[playerid][pHealth] = health;
  49. return SetPlayerHealth(playerid, health);
  50. }
  51. Internal_SetPlayerArmour(playerid, Float:armour) {
  52. //PlayerInfo[playerid][pArmor] = armour;
  53. return SetPlayerArmour(playerid, armour);
  54. }
  55. */
  56. ClearAnimationsEx(playerid, forcesync = 0) {
  57. IsDoingAnim[playerid] = 0;
  58. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  59. return ClearAnimations(playerid, forcesync);
  60. }
  61. ShowPlayerDialogEx(playerid, dialogid, style, caption[], info[], button1[], button2[]) {
  62. iLastDialogID[playerid] = dialogid;
  63. return ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
  64. }
  65. Internal_PutPlayerInVehicle(playerid, vehicle, seat){
  66. arrAntiCheat[playerid][ac_iVehID] = vehicle;
  67. return PutPlayerInVehicle(playerid,vehicle,seat);
  68. }
  69. Internal_SetPlayerWeather(playerid, iWeatherID) {
  70. if(Bit_State(arrPlayerBits[playerid], dr_bitInDrugEffect)) return 1;
  71. return SetPlayerWeather(playerid, iWeatherID);
  72. }
  73. Internal_SetPlayerTime(playerid, iHour, iMinute) {
  74. if(Bit_State(arrPlayerBits[playerid], dr_bitInDrugEffect)) return 1;
  75. return SetPlayerTime(playerid, iHour, iMinute);
  76. }
  77. Internal_CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0) {
  78. new i = CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren);
  79. Iter_Add(Vehicles, i);
  80. return i;
  81. }
  82. Internal_DestroyVehicle(vehicleid) {
  83. Iter_Remove(Vehicles, vehicleid);
  84. return DestroyVehicle(vehicleid);
  85. }
  86. Internal_SetPlayerVirtualWorld(playerid, iVW) {
  87. PlayerInfo[playerid][pVW] = iVW;
  88. return SetPlayerVirtualWorld(playerid, iVW);
  89. }
  90. Internal_SetPlayerInterior(playerid, iInt) {
  91. PlayerInfo[playerid][pInt] = iInt;
  92. return SetPlayerInterior(playerid, iInt);
  93. }
  94. /*
  95. Internal_SetPlayerName(playerid, szName[]) {
  96. UpdateDynamic3DTextLabelText(PlayerLabel[playerid], 0xFFFFFFFF, GetHealthArmorForLabel(playerid));
  97. return SetPlayerName(playerid, szName);
  98. }
  99. Internal_SetPlayerColor(playerid, color) {
  100. UpdateDynamic3DTextLabelText(PlayerLabel[playerid], color + 255, GetHealthArmorForLabel(playerid));
  101. return SetPlayerColor(playerid, color);
  102. }
  103. */
  104. // From fixer.inc
  105. stock FIX_GetTickCount() {
  106. new ret = GetTickCount();
  107. if (ret < 0)
  108. ret += 2147483647;
  109. return ret;
  110. }
  111. #if defined TEXTLABEL_DEBUG
  112. Int_DestDyn3DTxtLabel(Text3D:id) {
  113. new szString[128],
  114. iTrackID = Streamer_GetIntData(STREAMER_TYPE_3D_TEXT_LABEL, id, E_STREAMER_EXTRA_ID),
  115. Float:fPos[3],
  116. iData[2];
  117. Streamer_GetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, id, E_STREAMER_X, fPos[0]);
  118. Streamer_GetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, id, E_STREAMER_Y, fPos[1]);
  119. Streamer_GetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, id, E_STREAMER_Z, fPos[2]);
  120. iData[0] = Streamer_GetIntData(STREAMER_TYPE_3D_TEXT_LABEL, id, E_STREAMER_WORLD_ID);
  121. iData[1] = Streamer_GetIntData(STREAMER_TYPE_3D_TEXT_LABEL, id, E_STREAMER_INTERIOR_ID);
  122. switch(iTrackID) {
  123. case 1: szString = "Businesses[iBusiness][GasPumpSaleTextID][iPump]";
  124. case 2: szString = "Businesses[i][bDoorText]";
  125. case 3: szString = "Businesses[i][bStateText]";
  126. case 4: szString = "Businesses[i][bSupplyText]";
  127. case 5: szString = "RFLTeamN3D[playerid]";
  128. case 6: szString = "Text3D:GetPVarInt(playerid, PVAR_TEMPTEXT)";
  129. case 7: szString = "arrPayPhoneData[i][pp_iTextID]";
  130. case 8: szString = "PollInfo[iPollID][poll_textLabel]";
  131. case 9: szString = "DynPoints[id][poTextID]";
  132. case 10: szString = "Businesses[iBusiness][GasPumpInfoTextID][iPump]";
  133. default: szString = "Unknown";
  134. }
  135. format(szString, sizeof(szString), "Removed TextLabel: %d | Tracker: %s", _:id, szString);
  136. SendDiscordMessage(3, szString);
  137. format(szString, sizeof(szString), "TL (%d) data: %0.2f, %0.2f, %0.2f, VW: %d, INT: %d", _:id, fPos[0], fPos[1], fPos[2], iData[0], iData[1]);
  138. SendDiscordMessage(3, szString);
  139. if(!IsValidDynamic3DTextLabel(id)) {
  140. format(szString, sizeof(szString), "Text Label %d (Tracker %s) deleted a non-created text label.", _:id, szString);
  141. SendDiscordMessage(3, szString);
  142. }
  143. return DestroyDynamic3DTextLabel(id);
  144. }
  145. #endif
  146. #if defined AREA_DEBUG
  147. Internal_CreateDynamicSphere(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1) {
  148. new iTemp = CreateDynamicSphere(x, y, z, size, worldid, interiorid, playerid);
  149. printf("[DEBUG][AREA][SPHERE][A%d] X: %f Y: %f Z: %f SIZE: %f WID: %d INTID: %d PID: %d", iTemp, x, y, z, size, worldid, interiorid, playerid);
  150. return iTemp;
  151. }
  152. Internal_DestroyDynamicArea(areaid) {
  153. printf("[DEBUG][AREA][DESTROY] AID: %d", areaid);
  154. return DestroyDynamicArea(areaid);
  155. }
  156. Internal_CreateDynamicCuboid(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1) {
  157. new iTemp = CreateDynamicCuboid(minx, miny, minz, maxx, maxy, maxz, worldid, interiorid, playerid);
  158. printf("[DEBUG][AREA][CUBOID][A%d] MINX: %f MINY: %f MINZ: %f MAXX: %f MAXY: %f MAXZ: %f WID: %d INTID: %d PID: %d", iTemp, minx, miny, minz, maxx, maxy, maxz, worldid, interiorid, playerid);
  159. return iTemp;
  160. }
  161. Internal_StreamerSetIntData(type, id, data, value) {
  162. printf("[DEBUG][STREAMER][INTDATA] T: %d ID: %d D: %d V: %d", type, id, data, value);
  163. return Streamer_SetIntData(type, id, data, value);
  164. }
  165. #endif
  166. #define PutPlayerInVehicle(%0) Internal_PutPlayerInVehicle(%0)
  167. #define SetPlayerWeather(%0) Internal_SetPlayerWeather(%0)
  168. #define SetPlayerTime(%0) Internal_SetPlayerTime(%0)
  169. //#define SetPlayerHealth(%0) Internal_SetPlayerHealth(%0)
  170. //#define SetPlayerArmour(%0) Internal_SetPlayerArmour(%0)
  171. #define CreateVehicle(%0) Internal_CreateVehicle(%0)
  172. #define DestroyVehicle(%0) Internal_DestroyVehicle(%0)
  173. #define SetPlayerPos(%0) Internal_SetPlayerPos(%0)
  174. #define TogglePlayerSpectating(%0) Internal_TogglePlayerSpectating(%0)
  175. //#define ShowPlayerNameTagForPlayer(%0) Internal_ShowPlayerNameTag(%0)
  176. //#define SetPlayerHealth(%0) Internal_SetPlayerHealth(%0)
  177. //#define SetPlayerArmour(%0) Internal_SetPlayerArmour(%0)
  178. #define SetPlayerVirtualWorld(%0) Internal_SetPlayerVirtualWorld(%0)
  179. #define SetPlayerInterior(%0) Internal_SetPlayerInterior(%0)
  180. //#define SetPlayerName(%0) Internal_SetPlayerName(%0)
  181. //#define SetPlayerColor(%0) Internal_SetPlayerColor(%0)
  182. #define GetTickCount(%0) FIX_GetTickCount(%0)
  183. #if defined TEXTLABEL_DEBUG
  184. #define DestroyDynamic3DTextLabel(%0) Int_DestDyn3DTxtLabel(%0)
  185. #endif
  186. #if defined AREA_DEBUG
  187. #define CreateDynamicSphere(%0) Internal_CreateDynamicSphere(%0)
  188. #define CreateDynamicCuboid(%0) Internal_CreateDynamicCuboid(%0)
  189. #define DestroyDynamicArea(%0) Internal_DestroyDynamicArea(%0)
  190. #define Streamer_SetIntData(%0) Internal_StreamerSetIntData(%0)
  191. #endif