y_groups.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. /*----------------------------------------------------------------------------*\
  2. =======================================
  3. y_groups - Player group abstractions!
  4. =======================================
  5. Description:
  6. Admin levels, gangs, teams etc - they're all "groups" of people, this
  7. provides an abstraction for all of these collections.
  8. Legal:
  9. Version: MPL 1.1
  10. The contents of this file are subject to the Mozilla Public License Version
  11. 1.1 (the "License"); you may not use this file except in compliance with
  12. the License. You may obtain a copy of the License at
  13. http://www.mozilla.org/MPL/
  14. Software distributed under the License is distributed on an "AS IS" basis,
  15. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  16. for the specific language governing rights and limitations under the
  17. License.
  18. The Original Code is the YSI groups include.
  19. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  20. Portions created by the Initial Developer are Copyright (C) 2011
  21. the Initial Developer. All Rights Reserved.
  22. Contributors:
  23. ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice
  24. Thanks:
  25. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  26. ZeeX - Very productive conversations.
  27. koolk - IsPlayerinAreaEx code.
  28. TheAlpha - Danish translation.
  29. breadfish - German translation.
  30. Fireburn - Dutch translation.
  31. yom - French translation.
  32. 50p - Polish translation.
  33. Zamaroht - Spanish translation.
  34. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes
  35. for me to strive to better.
  36. Pixels^ - Running XScripters where the idea was born.
  37. Matite - Pestering me to release it and using it.
  38. Very special thanks to:
  39. Thiadmer - PAWN, whose limits continue to amaze me!
  40. Kye/Kalcor - SA:MP.
  41. SA:MP Team past, present and future - SA:MP.
  42. Version:
  43. 1.0
  44. Changelog:
  45. 29/11/10:
  46. First version
  47. \*----------------------------------------------------------------------------*/
  48. #include "internal\y_version"
  49. #if !defined _inc_y_groups
  50. #error Did you do <YSI/y_groups> instead of the required <YSI\y_groups>?
  51. #endif
  52. #undef _inc_y_groups
  53. #include "internal\y_nogroups"
  54. /*#if defined YSI_GROUPS_LAST
  55. #if YSI_GROUPS_LAST == 25
  56. #undef _GROUP_MAKE_NAME
  57. #undef _GROUP_MAKE_LIMIT
  58. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_CMD
  59. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_CMD
  60. #elseif YSI_GROUPS_LAST == 22
  61. #undef _GROUP_MAKE_NAME
  62. #undef _GROUP_MAKE_LIMIT
  63. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_CLASSES
  64. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_CLASSES
  65. #elseif YSI_GROUPS_LAST == 9
  66. #undef _GROUP_MAKE_NAME
  67. #undef _GROUP_MAKE_LIMIT
  68. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_INTTEST
  69. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_INTTEST
  70. #elseif YSI_GROUPS_LAST == 8
  71. #undef _GROUP_MAKE_NAME
  72. #undef _GROUP_MAKE_LIMIT
  73. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_INTTEST2
  74. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_INTTEST2
  75. #endif
  76. #undef YSI_GROUPS_LAST
  77. #endif*/
  78. #if defined _YSI_GROUPS_FIRST_HALF
  79. #undef _YSI_GROUPS_FIRST_HALF
  80. #endif
  81. // First, detect which library has included this. If none then it was the user.
  82. #if defined _inc_y_classes
  83. #if !defined _YSI_GROUP_CLASSES_INCLUDED
  84. // Although this is included before _GROUP_MAKE_NAME is set, it will
  85. // still be the correct value eventually.
  86. // Mark this library as existing.
  87. #define _YSI_GROUP_CLASSES_INCLUDED
  88. // These all need doing twice - once here and once below.
  89. //#if defined _YSI_HAS_GROUP_SYSTEM
  90. // #include "internal\y_groupfirst"
  91. //#endif
  92. #undef _GROUP_MAKE_NAME
  93. #undef _GROUP_MAKE_LIMIT
  94. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_CLASSES
  95. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_CLASSES
  96. #if defined _YSI_HAS_GROUP_SYSTEM
  97. #include "internal\y_groupsecond"
  98. #include "internal\y_classgroups"
  99. #endif
  100. #include "internal\y_groupsingle"
  101. // End.
  102. #endinput
  103. #endif
  104. #endif
  105. #if defined _inc_y_commands
  106. #if !defined _YSI_GROUP_COMMANDS_INCLUDED
  107. // Although this is included before _GROUP_MAKE_NAME is set, it will
  108. // still be the correct value eventually.
  109. // Mark this library as existing.
  110. #define _YSI_GROUP_COMMANDS_INCLUDED
  111. // These all need doing twice - once here and once below.
  112. //#if defined _YSI_HAS_GROUP_SYSTEM
  113. // #include "internal\y_groupfirst"
  114. //#endif
  115. #undef _GROUP_MAKE_NAME
  116. #undef _GROUP_MAKE_LIMIT
  117. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_CMD
  118. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_CMD
  119. #if defined _YSI_HAS_GROUP_SYSTEM
  120. #include "internal\y_groupsecond"
  121. #endif
  122. #include "internal\y_groupsingle"
  123. // End.
  124. #endinput
  125. #endif
  126. #endif
  127. #if defined _inc_y_areas
  128. #if !defined _YSI_GROUP_AREAS_INCLUDED
  129. // Although this is included before _GROUP_MAKE_NAME is set, it will
  130. // still be the correct value eventually.
  131. // Mark this library as existing.
  132. #define _YSI_GROUP_AREAS_INCLUDED
  133. // These all need doing twice - once here and once below.
  134. //#if defined _YSI_HAS_GROUP_SYSTEM
  135. // #include "internal\y_groupfirst"
  136. //#endif
  137. #undef _GROUP_MAKE_NAME
  138. #undef _GROUP_MAKE_LIMIT
  139. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_AREAS
  140. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_AREAS
  141. #if defined _YSI_HAS_GROUP_SYSTEM
  142. #include "internal\y_groupsecond"
  143. #endif
  144. #include "internal\y_groupsingle"
  145. // End.
  146. #endinput
  147. #endif
  148. #endif
  149. #if defined _YSI_ALLOW_INTERNAL_TEST
  150. #if defined _inc_y_inttest
  151. #if !defined _YSI_GROUP_INTTEST_INCLUDED
  152. // Mark this library as existing.
  153. #define _YSI_GROUP_INTTEST_INCLUDED
  154. // These all need doing twice - once here and once below.
  155. //#if defined _YSI_HAS_GROUP_SYSTEM
  156. // #include "internal\y_groupfirst"
  157. //#endif
  158. #undef _GROUP_MAKE_NAME
  159. #undef _GROUP_MAKE_LIMIT
  160. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_INTTEST
  161. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_INTTEST
  162. #if defined _YSI_HAS_GROUP_SYSTEM
  163. #include "internal\y_groupsecond"
  164. #endif
  165. #include "internal\y_groupsingle"
  166. // End.
  167. #endinput
  168. #endif
  169. #endif
  170. #if defined _inc_y_inttest2
  171. #if !defined _YSI_GROUP_INTTEST2_INCLUDED
  172. // Mark this library as existing.
  173. #define _YSI_GROUP_INTTEST2_INCLUDED
  174. // These all need doing twice - once here and once below.
  175. //#if defined _YSI_HAS_GROUP_SYSTEM
  176. // #include "internal\y_groupfirst"
  177. //#endif
  178. #undef _GROUP_MAKE_NAME
  179. #undef _GROUP_MAKE_LIMIT
  180. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_INTTEST2
  181. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_INTTEST2
  182. #if defined _YSI_HAS_GROUP_SYSTEM
  183. #include "internal\y_groupsecond"
  184. #endif
  185. #include "internal\y_groupsingle"
  186. // End.
  187. #endinput
  188. #endif
  189. #endif
  190. #endif
  191. // || ||
  192. // =============================================================================
  193. // || ||
  194. #define _YSI_GROUPS_FIRST_HALF
  195. // || ||
  196. // =============================================================================
  197. // || ||
  198. // User inclusion.
  199. #if !defined _YSI_HAS_GROUP_SYSTEM
  200. #define _YSI_HAS_GROUP_SYSTEM
  201. // Include the main code.
  202. #include <a_samp>
  203. #include "internal\y_grouponce"
  204. // Include code for previous libraries.
  205. #if defined _YSI_GROUP_CLASSES_INCLUDED
  206. // This only needs to be done if the library was previously included.
  207. #define _YSIM_OVERRIDE 22
  208. #include "y_master"
  209. // Include the first half of the file for the call chain.
  210. //#include "internal\y_groupfirst"
  211. #undef _GROUP_MAKE_NAME
  212. #undef _GROUP_MAKE_LIMIT
  213. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_CLASSES
  214. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_CLASSES
  215. // Include the second half of the file for the methods.
  216. #include "internal\y_groupsecond"
  217. #include "internal\y_classgroups"
  218. #endif
  219. #if defined _YSI_GROUP_COMMANDS_INCLUDED
  220. // This only needs to be done if the library was previously included.
  221. #define _YSIM_OVERRIDE 25
  222. #include "y_master"
  223. // Include the first half of the file for the call chain.
  224. //#include "internal\y_groupfirst"
  225. #undef _GROUP_MAKE_NAME
  226. #undef _GROUP_MAKE_LIMIT
  227. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_CMD
  228. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_CMD
  229. // Include the second half of the file for the methods.
  230. #include "internal\y_groupsecond"
  231. #endif
  232. #if defined _YSI_GROUP_AREAS_INCLUDED
  233. // This only needs to be done if the library was previously included.
  234. #define _YSIM_OVERRIDE 18
  235. #include "y_master"
  236. // Include the first half of the file for the call chain.
  237. //#include "internal\y_groupfirst"
  238. #undef _GROUP_MAKE_NAME
  239. #undef _GROUP_MAKE_LIMIT
  240. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_AREAS
  241. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_AREAS
  242. // Include the second half of the file for the methods.
  243. #include "internal\y_groupsecond"
  244. #endif
  245. // Internal test library.
  246. #if defined _YSI_ALLOW_INTERNAL_TEST
  247. #if defined _YSI_GROUP_INTTEST_INCLUDED
  248. #define _YSIM_OVERRIDE 9
  249. #include "y_master"
  250. //#include "internal\y_groupfirst"
  251. #undef _GROUP_MAKE_NAME
  252. #undef _GROUP_MAKE_LIMIT
  253. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_INTTEST
  254. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_INTTEST
  255. #include "internal\y_groupsecond"
  256. #endif
  257. #if defined _YSI_GROUP_INTTEST2_INCLUDED
  258. #define _YSIM_OVERRIDE 8
  259. #include "y_master"
  260. //#include "internal\y_groupfirst"
  261. #undef _GROUP_MAKE_NAME
  262. #undef _GROUP_MAKE_LIMIT
  263. #define _GROUP_MAKE_NAME _GROUP_MAKE_NAME_INTTEST2
  264. #define _GROUP_MAKE_LIMIT _GROUP_MAKE_LIMIT_INTTEST2
  265. #include "internal\y_groupsecond"
  266. #endif
  267. #endif
  268. #endif
  269. // Now include any user defined libraries.
  270. #if defined GROUP_LIBRARY_NAME
  271. #if defined GROUP_LIBRARY_SIZE
  272. // Include the generic group code for this new custom group.
  273. #if defined _YSIM_MANUAL_SET
  274. #define _YSIM_RESET_USER
  275. #endif
  276. #include "y_master"
  277. //#include "internal\y_groupsingle"
  278. //#include "internal\y_groupfirst"
  279. #undef _GROUP_MAKE_NAME
  280. #undef _GROUP_MAKE_LIMIT
  281. #define _GROUP_MAKE_NAME GROUP_LIBRARY_NAME
  282. #define _GROUP_MAKE_LIMIT GROUP_LIBRARY_SIZE
  283. #undef _YSI_GROUPS_FIRST_HALF
  284. // Include the second half of the file for the methods.
  285. #include "internal\y_groupsecond"
  286. #define _YSI_GROUPS_FIRST_HALF
  287. #include "internal\y_groupsingle"
  288. // Remove the definitions.
  289. //#undef GROUP_LIBRARY_SIZE
  290. //#undef GROUP_LIBRARY_NAME
  291. #else
  292. #error You must define both GROUP_LIBRARY_SIZE and GROUP_LIBRARY_NAME.
  293. #endif
  294. #else
  295. #if defined GROUP_LIBRARY_SIZE
  296. #error You must define both GROUP_LIBRARY_SIZE and GROUP_LIBRARY_NAME.
  297. #endif
  298. #endif
  299. // Revert to the user's included definition if y_groups was included after all
  300. // group using libraries and after explicit y_master inclusion.
  301. //#include "internal\y_grouprevert"
  302. //#define YSI_SET_LAST_GROUP 24
  303. #include "internal\y_grouprevert"