1
0

y_lock.inc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #if defined _INC_y_lock
  2. #endinput
  3. #endif
  4. #define _INC_y_lock
  5. /**
  6. * <library name="y_lock">
  7. * <section>
  8. * Description
  9. * </section>
  10. * Ensures that the server is running on the IP specified by "bind".
  11. * <section>
  12. * Version
  13. * </section>
  14. * 0.1
  15. * </library>
  16. *//** *//*
  17. Legal:
  18. Version: MPL 1.1
  19. The contents of this file are subject to the Mozilla Public License Version
  20. 1.1 the "License"; you may not use this file except in compliance with
  21. the License. You may obtain a copy of the License at
  22. http://www.mozilla.org/MPL/
  23. Software distributed under the License is distributed on an "AS IS" basis,
  24. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  25. for the specific language governing rights and limitations under the
  26. License.
  27. The Original Code is the YSI framework.
  28. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  29. Portions created by the Initial Developer are Copyright C 2011
  30. the Initial Developer. All Rights Reserved.
  31. Contributors:
  32. Y_Less
  33. koolk
  34. JoeBullet/Google63
  35. g_aSlice/Slice
  36. Misiur
  37. samphunter
  38. tianmeta
  39. maddinat0r
  40. spacemud
  41. Crayder
  42. Dayvison
  43. Ahmad45123
  44. Zeex
  45. irinel1996
  46. Yiin-
  47. Chaprnks
  48. Konstantinos
  49. Masterchen09
  50. Southclaws
  51. PatchwerkQWER
  52. m0k1
  53. paulommu
  54. udan111
  55. Thanks:
  56. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  57. ZeeX - Very productive conversations.
  58. koolk - IsPlayerinAreaEx code.
  59. TheAlpha - Danish translation.
  60. breadfish - German translation.
  61. Fireburn - Dutch translation.
  62. yom - French translation.
  63. 50p - Polish translation.
  64. Zamaroht - Spanish translation.
  65. Los - Portuguese translation.
  66. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes for
  67. me to strive to better.
  68. Pixels^ - Running XScripters where the idea was born.
  69. Matite - Pestering me to release it and using it.
  70. Very special thanks to:
  71. Thiadmer - PAWN, whose limits continue to amaze me!
  72. Kye/Kalcor - SA:MP.
  73. SA:MP Team past, present and future - SA:MP.
  74. Optional plugins:
  75. Gamer_Z - GPS.
  76. Incognito - Streamer.
  77. Me - sscanf2, fixes2, Whirlpool.
  78. */
  79. #if defined _inc_y_version
  80. #error YSI\y_lock must be the first include if you want to use it.
  81. #endif
  82. #if defined _DEBUG
  83. #if _DEBUG >= 1
  84. #define y_lock%0; _DoYLock(%0);
  85. #else
  86. #define y_lock%0; _DoYLock();
  87. #endif
  88. #else
  89. #define y_lock%0; _DoYLock();
  90. #endif
  91. #if !defined BIND_IP
  92. #if defined Y_LOCK_IP
  93. #define BIND_IP MAKE_LOCK_IP(Y_LOCK_IP)
  94. #else
  95. #define BIND_IP MAKE_LOCK_IP(127.0.0.1)
  96. #endif
  97. #endif
  98. // MASSIVE reliance on operator precedence here!
  99. #define MAKE_LOCK_IP(%0.%1.%2.%3) ((%0&0xFF)<<24|(%1&0xFF)<<16|(%2&0xFF)<<8|%3&0xFF)
  100. #define _LOCK_IP_0 (BIND_IP>>>24)
  101. #define _LOCK_IP_1 (BIND_IP>>>16&0xFF)
  102. #define _LOCK_IP_2 (BIND_IP>>>8&0xFF)
  103. #define _LOCK_IP_3 (BIND_IP&0xFF)
  104. #define UNHOOK for(from=AMX_HEADER_PUBLICS;from!=AMX_HEADER_NATIVES;from+= 8)AMX_Write(from,-1);
  105. #if _LOCK_IP_0 == 0
  106. #define _LOCK_LEN_0 1
  107. #else
  108. #define _LOCK_LEN_0 _LOCK_IP_0
  109. #endif
  110. #if _LOCK_IP_1 == 0
  111. #define _LOCK_LEN_1 1
  112. #else
  113. #define _LOCK_LEN_1 _LOCK_IP_1
  114. #endif
  115. #if _LOCK_IP_2 == 0
  116. #define _LOCK_LEN_2 1
  117. #else
  118. #define _LOCK_LEN_2 _LOCK_IP_2
  119. #endif
  120. #if _LOCK_IP_3 == 0
  121. #define _LOCK_LEN_3 1
  122. #else
  123. #define _LOCK_LEN_3 _LOCK_IP_3
  124. #endif
  125. #define YSI_LOCK_MODE
  126. #include "..\YSI_Internal\y_version"
  127. #include "..\YSI_Storage\y_amx"
  128. #include "..\YSI_Coding\y_hooks"
  129. _DoYLock(P:C(from);)
  130. {
  131. new
  132. arr[][] =
  133. {
  134. ";23#w",
  135. "32g2"
  136. };
  137. P:1("%d", from);
  138. #pragma unused arr
  139. #if !defined _DEBUG || _DEBUG < 1
  140. new from;
  141. #endif
  142. UNHOOK
  143. }