y_classes.inc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /**--------------------------------------------------------------------------**\
  2. ======================================
  3. y_classes - Advanced class selection
  4. ======================================
  5. Description:
  6. Allows greater control over classes so not everyone has every class. Uses
  7. a form of compression for locations.
  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 classes 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. 0.1
  44. Changelog:
  45. 14/04/12:
  46. Readded OnRequestSpawn logic.
  47. Fixed Class_AddWithGroupSet.
  48. Improved GM/FS interaction.
  49. 02/01/08:
  50. First '08 edit - Fixed minus numbers in spawn points.
  51. 18/11/07:
  52. Improved location compression to allow larger areas.
  53. Moved position code to Class_OnPlayerSpawn to reduce overhead.
  54. 10/10/07:
  55. Fixed spawn data problem.
  56. 31/08/07:
  57. Added cheap master system - YSI_SLAVE_CLASSs can't be master.
  58. 05/08/07:
  59. Fixed a few bugs with repeated selection.
  60. 04/08/07:
  61. First version.
  62. Functions:
  63. Public:
  64. Class_AddRemote - Adds a class to the remote master.
  65. Class_Remote - Updates settings remotely.
  66. Core:
  67. Class_Class - Sets up the system.
  68. Class_OnPlayerRequestSpawn - Called when a player requests a spawn.
  69. Class_OnPlayerRequestClass - Called when a player requests a class.
  70. Class_OnPlayerConnect - Called when a player connects.
  71. Stock:
  72. Class_Delete - Removes a class.
  73. Class_SetPlayer - Sets whether or not a player can use a class.
  74. Class_Disable - Disables a class.
  75. Class_Enable - Enables a disabled class.
  76. Class_AddForGroup - Adds a class to the system for only one group.
  77. Class_Add - Adds a class to the system.
  78. Class_AddEx - Adds a class to the system with group selection and setting.
  79. Class_AddWithGroupSet - Adds a class and sets their group on selection.
  80. Class_AllowReselection - Allows or disallows people to return to reselect a class.
  81. Class_RequireSpawnLogin - Require people to login before spawning.
  82. Class_RequireSelectionLogin - Require people to login before selecting.
  83. Class_RequireSelectionReg - Require people to register before selecting.
  84. Class_RequireSpawnReg - Require people to register before spawning.
  85. Static:
  86. Class_AddClass - Adds a class, wrapped by API and remote functions.
  87. Inline:
  88. Class_IsActive - Checks a class is active.
  89. Class_Enabled - Checks a class is enabled.
  90. Class_IsValid - Checks a class is valid.
  91. Class_X - Gets a classes x position.
  92. Class_Y - Gets a classes y position.
  93. Class_Z - Gets a classes z position.
  94. Class_A - Gets a classes angle.
  95. Class_Skin - Gets a classes skin.
  96. API:
  97. -
  98. Callbacks:
  99. -
  100. Definitions:
  101. MAX_CLASSES - Maximum number of classes storeable by the system.
  102. CLASS_LEFT - Flag for last internal class viewed.
  103. CLASS_MIDDLE - Flag for last internal class viewed.
  104. CLASS_RIGHT - Flag for last internal class viewed.
  105. Enums:
  106. e_CLASS_FLAGS - Small data for individual classes.
  107. E_CLASS - Class data structure.
  108. Macros:
  109. -
  110. Tags:
  111. -
  112. Variables:
  113. Global:
  114. -
  115. Static:
  116. YSI_g_sClasses - Data for classes.
  117. YSI_g_sPlayerClass - Player's current classes.
  118. YSI_g_sLeft - Handle for the first internal class.
  119. YSI_g_sMiddle - Handle for the second internal class.
  120. YSI_g_sRight - Handle for the third internal class.
  121. YSI_g_sClassCount - Number of classes stored.
  122. Commands:
  123. -
  124. Compile options:
  125. -
  126. Operators:
  127. -
  128. \**--------------------------------------------------------------------------**/
  129. #if defined _INC_y_classes
  130. #endinput
  131. #endif
  132. #define _INC_y_classes
  133. stock _YSI_HAS_y_classes(_do_not_call_me_ever_, _like_never_)
  134. {
  135. P:E("You called _YSI_HAS_y_classes! Bad, don't do that!", _do_not_call_me_ever_, _like_never_);
  136. assert(false);
  137. return 0;
  138. }
  139. #include "..\YSI_Internal\y_version"
  140. #if !defined MAX_CLASSES
  141. #define MAX_CLASSES (512)
  142. #endif
  143. #if !defined MAX_CLASS_SPAWN_WEAPONS
  144. #define MAX_CLASS_SPAWN_WEAPONS (13)
  145. #endif
  146. #if !defined WEAPON_ARMOUR
  147. #define WEAPON_ARMOUR (100)
  148. #endif
  149. #define INFINATE_ARMOUR (0x00800000)
  150. #define MASTER 61
  151. #define YSIM_U_DISABLE
  152. #include "..\YSI_Core\y_master"
  153. #include "..\YSI_Data\y_bit"
  154. #include "..\YSI_Core\y_debug"
  155. #include "..\YSI_Data\y_iterate"
  156. #include "..\YSI_Data\y_playerarray"
  157. #include "..\YSI_Data\y_iterate"
  158. #include "..\YSI_Internal\y_natives"
  159. #include "..\YSI_Coding\y_hooks"
  160. #define _GROUP_MAKE_NAME<%0...%1> %0Class%1
  161. #define _GROUP_MAKE_LIMIT MAX_CLASSES
  162. #include "..\YSI_Players\y_groups\_funcs"
  163. //#include "..\YSI_Players\y_groups\y_classes"
  164. #include "y_classes/multiclass"
  165. //#include "y_classes/classcontrol"
  166. #if defined YSI_TESTS
  167. #include "..\YSI_Core\y_testing"
  168. #include "y_classes/tests"
  169. #endif
  170. // Reset.
  171. #undef _GROUP_MAKE_LIMIT
  172. #undef _GROUP_MAKE_NAME
  173. #include "..\YSI_Core\y_master"