y_users_entry.inc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #if defined _INC_y_users
  2. #endinput
  3. #endif
  4. #define _INC_y_users
  5. /*
  6. Legal:
  7. Version: MPL 1.1
  8. The contents of this file are subject to the Mozilla Public License Version
  9. 1.1 the "License"; you may not use this file except in compliance with
  10. the License. You may obtain a copy of the License at
  11. http://www.mozilla.org/MPL/
  12. Software distributed under the License is distributed on an "AS IS" basis,
  13. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  14. for the specific language governing rights and limitations under the
  15. License.
  16. The Original Code is the YSI framework.
  17. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  18. Portions created by the Initial Developer are Copyright C 2011
  19. the Initial Developer. All Rights Reserved.
  20. Contributors:
  21. Y_Less
  22. koolk
  23. JoeBullet/Google63
  24. g_aSlice/Slice
  25. Misiur
  26. samphunter
  27. tianmeta
  28. maddinat0r
  29. spacemud
  30. Crayder
  31. Dayvison
  32. Ahmad45123
  33. Zeex
  34. irinel1996
  35. Yiin-
  36. Chaprnks
  37. Konstantinos
  38. Masterchen09
  39. Southclaws
  40. PatchwerkQWER
  41. m0k1
  42. paulommu
  43. udan111
  44. Thanks:
  45. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  46. ZeeX - Very productive conversations.
  47. koolk - IsPlayerinAreaEx code.
  48. TheAlpha - Danish translation.
  49. breadfish - German translation.
  50. Fireburn - Dutch translation.
  51. yom - French translation.
  52. 50p - Polish translation.
  53. Zamaroht - Spanish translation.
  54. Los - Portuguese translation.
  55. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes for
  56. me to strive to better.
  57. Pixels^ - Running XScripters where the idea was born.
  58. Matite - Pestering me to release it and using it.
  59. Very special thanks to:
  60. Thiadmer - PAWN, whose limits continue to amaze me!
  61. Kye/Kalcor - SA:MP.
  62. SA:MP Team past, present and future - SA:MP.
  63. Optional plugins:
  64. Gamer_Z - GPS.
  65. Incognito - Streamer.
  66. Me - sscanf2, fixes2, Whirlpool.
  67. */
  68. #if !defined MODE_NAME
  69. #error Please define "MODE_NAME" before including y_users.
  70. #endif
  71. forward OnPlayerLogin(playerid, uid);
  72. forward OnPlayerLogout(playerid, uid);
  73. forward OnPlayerSaved(playerid, uid);
  74. #include "..\..\YSI_Core\y_utils"
  75. #include "..\..\YSI_Players\y_text"
  76. #include "..\..\YSI_Coding\y_remote"
  77. #include "..\..\YSI_Storage\y_ini"
  78. #include "..\..\YSI_Coding\y_timers"
  79. #define YSIM_U_DISABLE
  80. #define MASTER 55
  81. #include "..\..\YSI_Core\y_master"
  82. #define MAX_INDEX_LENGTH 8
  83. #include "..\..\YSI_Coding\y_hooks"
  84. #if defined PP_ADLER32
  85. //#define MAX_PASSWORD_LENGTH 11
  86. #error Adler32 sucks!
  87. #elseif defined PP_MD5
  88. #if defined MD5_Hash
  89. #define MAX_PASSWORD_LENGTH 32
  90. #else
  91. #error Could not find MD5_Hash.
  92. #endif
  93. #elseif defined PP_SHA1
  94. #error SHA1 unsupported.
  95. #elseif defined PP_YSI
  96. #define MAX_PASSWORD_LENGTH 16
  97. #elseif defined PP_WP || defined PP_WHIRLPOOL
  98. #if defined _YSI_PLUGINS_WHIRLPOOL
  99. #define MAX_PASSWORD_LENGTH 128
  100. #else
  101. #error Could not find WP_Hash.
  102. #endif
  103. #else
  104. #error Default hash removed: See YSI topic for details.
  105. //#define PP_YSI
  106. //#define MAX_PASSWORD_LENGTH 16
  107. #endif
  108. //#define INDEX_DATA_LINE_LENGTH (MAX_INDEX_LENGTH + 1 + MAX_PLAYER_NAME + 1 + MAX_PASSWORD_LENGTH + 3 + 3 + 9 + 9)
  109. // MAX_INDEX_LENGTH - The player's ID.
  110. // 1 - Space.
  111. // MAX_PLAYER_NAME - The player's name.
  112. // 1 - Space.
  113. // MAX_PASSWORD_LENGTH - The password hash.
  114. // 1 - Space.
  115. // 2 - Language.
  116. // 1 - Space.
  117. // 8 - Free HEX bits.
  118. // 1 - Space.
  119. // 8 - Join timestamp.
  120. // 3 - Newline + Null.
  121. const
  122. INDEX_DATA_LINE_LENGTH = MAX_INDEX_LENGTH + 1 + MAX_PLAYER_NAME + 1 + MAX_PASSWORD_LENGTH + 1 + 2 + 1 + 8 + 1 + 8 + 3;
  123. #if !defined USER_FILE_PATH
  124. #if defined YSI_TESTS
  125. // Create a separate path for any test data so that we don't ruin any
  126. // live user data.
  127. #define USER_FILE_PATH "YSI/test_users/"
  128. #define USER_FILE_LENGTH 15
  129. #else
  130. #define USER_FILE_PATH "YSI/users/"
  131. #define USER_FILE_LENGTH 10
  132. #endif
  133. #endif
  134. #define OnUserData[%0](%1) @yU_%0(%1)
  135. #define PINI:%0(%1) forward OnUserData[%0](%1);public OnUserData[%0](%1)
  136. FOREIGN__ Player_TryRegister(playerid, string:password[]);
  137. FOREIGN__ Player_TryLogin(playerid, string:password[]);
  138. FOREIGN__ Player_TryGroup(playerid, string:other[], string:password[]);
  139. FOREIGN__ Player_ChangePassword(playerid, string:password[]);
  140. FOREIGN__ Player_ForceGroup(playerid, string:other[]);
  141. FOREIGN__ Player_ForceLogin(playerid);
  142. FOREIGN__ Player_ChangeLanguage(playerid, string:code[]);
  143. #if defined USERS_USE_MYSQL
  144. /*
  145. #if _YSI_PLUGINS_MYSQL == 7
  146. #include "y_users_blueg7"
  147. #elseif _YSI_PLUGINS_MYSQL == 6
  148. #include "y_users_blueg6"
  149. #elseif _YSI_PLUGINS_MYSQL == 7
  150. #include "y_users_stricken"
  151. #else
  152. #error No MySQL plugin found.
  153. #endif
  154. */
  155. // I know it is a bit odd that this should need y_ini for database access, but
  156. // there is a very good reason (loading passwords).
  157. #include "..\..\YSI_Storage\y_ini"
  158. #include "..\..\YSI_Data\y_iterate"
  159. #include "y_users_dan10"
  160. #elseif defined USERS_USE_SQLITE
  161. #include "y_users_sqlite"
  162. #else
  163. #include "y_users_ini"
  164. #endif
  165. #if defined YSI_TESTS
  166. #include "y_users_tests"
  167. #endif
  168. #include "..\..\YSI_Core\y_master"