y_commands.inc 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /**
  2. * <library name="y_commands">
  3. * <section>
  4. * Description
  5. * </section>
  6. * Runs commands registered with the system and calls the required functions.
  7. * Also handles alternate names and prefixes. Based very loosely on dcmd.
  8. * <section>
  9. * Version
  10. * </section>
  11. * 0.1.4
  12. * <section>
  13. * Functions
  14. * </section>
  15. * <subsection>
  16. * Public
  17. * </subsection><ul>
  18. * <symbol name="Command_Add">Adds a command to the array for processing.</symbol>
  19. * <symbol name="Command_Remove">Removes a command.</symbol>
  20. * <symbol name="Command_Name">Gets the name of a command in a property.</symbol>
  21. * </ul><subsection>
  22. * Core
  23. * </subsection><ul>
  24. * <symbol name="Command_Process">Called from OnPlayerCommandText to process entered commands.</symbol>
  25. * <symbol name="Command_Parse">Sorts added commands into a binary tree.</symbol>
  26. * <symbol name="Command_Hash">Hashes a word for command hashing.</symbol>
  27. * <symbol name="Command_ProcRem">Processes a help command in the master script.</symbol>
  28. * </ul><subsection>
  29. * Stock
  30. * </subsection><ul>
  31. * <symbol name="Command_SetDisconnectReturn">Sets the return value for unconnected players.</symbol>
  32. * <symbol name="Command_UseShortCuts">Toggles use of per-player command shortcuts.</symbol>
  33. * <symbol name="Command_SetDeniedReturn">Sets the return value for denied use commands.</symbol>
  34. * <symbol name="Command_UseDeniedMessage">Toggles the use of an error message for denied.</symbol>
  35. * <symbol name="Command_SetIllegalReturn">Sets the return value for illegal characters.</symbol>
  36. * <symbol name="Command_UseAltNames">Toggles the use of ini defined alternate names.</symbol>
  37. * <symbol name="Command_UsePrefix">Toggles the use of a global prefix.</symbol>
  38. * <symbol name="Command_UseSpace">Toggles the use of a space between prefix and command.</symbol>
  39. * <symbol name="Command_SetAltName">Sets the alternate name of a function.</symbol>
  40. * <symbol name="Command_SetPrefix">Sets the pfexix to be typed.</symbol>
  41. * <symbol name="Comamnd_SetPlayerUse">Sets wether or not a player can use a command.</symbol>
  42. * <symbol name="Comamnd_SetPlayerUseByID">Sets wether or not a player can use a command.</symbol>
  43. * <symbol name="Command_FindByName">Finds a command in a possibly sorted list.</symbol>
  44. * </ul><section>
  45. * Definitions
  46. * </section><ul>
  47. * <symbol name="MAX_COMMAND_LENGTH">The maximum length of a command string.</symbol>
  48. * <symbol name="COMMAND_NOT_FOUND">Indicates that a searched for string is not a function.</symbol>
  49. * </ul><section>
  50. * Enums
  51. * </section><ul>
  52. * <symbol name="e_COMM_FLAG">Bit mappings for command options.</symbol>
  53. * <symbol name="E_COMMANDS">Structure of the array holding the string data.</symbol>
  54. * </ul><section>
  55. * Macros
  56. * </section><ul>
  57. * <symbol name="Command_(%1)">Forwards and declares a standard command for calling.</symbol>
  58. * <symbol name="ycmd(%1)">Adds a command to the array (wrapper for Command_Add).</symbol>
  59. * </ul><section>
  60. * Tags
  61. * </section><ul>
  62. * <symbol name="e_COMM_FLAG">Flag type.</symbol>
  63. * </ul><section>
  64. * Variables
  65. * </section>
  66. * <subsection>
  67. * Static
  68. * </subsection><ul>
  69. * <symbol name="YSI_g_sCommands">Holds all the textual data of the commands.</symbol>
  70. * <symbol name="YSI_g_sSearchTree">Tree of hashes for function names.</symbol>
  71. * <symbol name="YSI_g_sAltTree">Tree of hashes for alternate names.</symbol>
  72. * <symbol name="YSI_g_sPrefix">The command prefix.</symbol>
  73. * <symbol name="YSI_g_sPrefixLength">Length of the prefix.</symbol>
  74. * <symbol name="YSI_g_sCommandIndex">Pointer to the next free index in the function array.</symbol>
  75. * <symbol name="YSI_g_sAltCount">The number of commands with altnames.</symbol>
  76. * <symbol name="YSI_g_sCommandFlags">Bit array of command options.</symbol>
  77. * </ul><section>
  78. * Commands
  79. * </section><ul>
  80. * <symbol name="commands">Lists all commands available to you.</symbol>
  81. * </ul><section>Compile options</section><ul>
  82. * <symbol name="COMMAND_SENSITIVE">Make commands case sensitive.</symbol>
  83. * <symbol name="COMMAND_ACCURATE">Can use '@' in command names.</symbol>
  84. * <symbol name="MAX_COMMANDS">The maximum number of commands which can be used.</symbol>
  85. * </ul>
  86. * </library>
  87. *//** *//*
  88. Legal:
  89. Version: MPL 1.1
  90. The contents of this file are subject to the Mozilla Public License Version
  91. 1.1 the "License"; you may not use this file except in compliance with
  92. the License. You may obtain a copy of the License at
  93. http://www.mozilla.org/MPL/
  94. Software distributed under the License is distributed on an "AS IS" basis,
  95. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  96. for the specific language governing rights and limitations under the
  97. License.
  98. The Original Code is the YSI framework.
  99. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  100. Portions created by the Initial Developer are Copyright C 2011
  101. the Initial Developer. All Rights Reserved.
  102. Contributors:
  103. Y_Less
  104. koolk
  105. JoeBullet/Google63
  106. g_aSlice/Slice
  107. Misiur
  108. samphunter
  109. tianmeta
  110. maddinat0r
  111. spacemud
  112. Crayder
  113. Dayvison
  114. Ahmad45123
  115. Zeex
  116. irinel1996
  117. Yiin-
  118. Chaprnks
  119. Konstantinos
  120. Masterchen09
  121. Southclaws
  122. PatchwerkQWER
  123. m0k1
  124. paulommu
  125. udan111
  126. Thanks:
  127. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  128. ZeeX - Very productive conversations.
  129. koolk - IsPlayerinAreaEx code.
  130. TheAlpha - Danish translation.
  131. breadfish - German translation.
  132. Fireburn - Dutch translation.
  133. yom - French translation.
  134. 50p - Polish translation.
  135. Zamaroht - Spanish translation.
  136. Los - Portuguese translation.
  137. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes for
  138. me to strive to better.
  139. Pixels^ - Running XScripters where the idea was born.
  140. Matite - Pestering me to release it and using it.
  141. Very special thanks to:
  142. Thiadmer - PAWN, whose limits continue to amaze me!
  143. Kye/Kalcor - SA:MP.
  144. SA:MP Team past, present and future - SA:MP.
  145. Optional plugins:
  146. Gamer_Z - GPS.
  147. Incognito - Streamer.
  148. Me - sscanf2, fixes2, Whirlpool.
  149. */
  150. #if !defined _INC_y_commands
  151. #tryinclude "y_commands\y_commands_entry"
  152. #endif
  153. #if !defined _INC_y_commands
  154. #tryinclude "YSI_Visual\y_commands\y_commands_entry"
  155. #endif
  156. #if !defined _INC_y_commands
  157. #tryinclude "YSI\YSI_Visual\y_commands\y_commands_entry"
  158. #endif
  159. #if !defined _INC_y_commands
  160. #tryinclude <YSI_Visual\y_commands\y_commands_entry>
  161. #endif
  162. #if !defined _INC_y_commands
  163. #tryinclude <YSI\YSI_Visual\y_commands\y_commands_entry>
  164. #endif
  165. #if !defined _INC_y_commands
  166. #error Could not find y_commands
  167. #endif