Pawn.CMD.inc 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * The MIT License (MIT)
  3. *
  4. * Copyright (c) 2016 urShadow
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in all
  14. * copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  22. * SOFTWARE.
  23. */
  24. #if !defined PAWNCMD_INC_
  25. #define PAWNCMD_INC_
  26. #define PAWNCMD_INCLUDE_VERSION 314
  27. #if !defined __cplusplus
  28. public _pawncmd_version = PAWNCMD_INCLUDE_VERSION;
  29. #pragma unused _pawncmd_version
  30. public bool:_pawncmd_is_gamemode = !defined FILTERSCRIPT;
  31. #pragma unused _pawncmd_is_gamemode
  32. native PC_RegAlias(const cmd[], const alias[], ...);
  33. native PC_SetFlags(const cmd[], flags);
  34. native PC_GetFlags(const cmd[]);
  35. native PC_EmulateCommand(playerid, const cmdtext[]);
  36. native PC_RenameCommand(const cmd[], const newname[]);
  37. native PC_CommandExists(const cmd[]);
  38. native PC_DeleteCommand(const cmd[]);
  39. native CmdArray:PC_GetCommandArray();
  40. native CmdArray:PC_GetAliasArray(const cmd[]);
  41. native PC_GetArraySize(CmdArray:arr);
  42. native PC_FreeArray(&CmdArray:arr);
  43. native PC_GetCommandName(CmdArray:arr, index, dest[], size = sizeof dest);
  44. #if defined PC_OnInit
  45. forward PC_OnInit();
  46. #endif
  47. #if defined OnPlayerCommandReceived
  48. forward OnPlayerCommandReceived(playerid, cmd[], params[], flags);
  49. #endif
  50. #if defined OnPlayerCommandPerformed
  51. forward OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags);
  52. #endif
  53. #define cmd:%0(%1) \
  54. forward pc_cmd_%0(%1); \
  55. public pc_cmd_%0(%1)
  56. #define alias:%0(%1); \
  57. forward pc_alias_%0(); \
  58. public pc_alias_%0() \
  59. PC_RegAlias(#%0, %1);
  60. #define flags:%0(%1); \
  61. forward pc_flags_%0(); \
  62. public pc_flags_%0() \
  63. PC_SetFlags(#%0, %1);
  64. #define CMD cmd
  65. #define COMMAND cmd
  66. #define callcmd::%0(%1) \
  67. pc_cmd_%0(%1)
  68. #define PC_HasFlag(%0,%1) \
  69. (PC_GetFlags(%0) & %1)
  70. #if !defined isnull
  71. #define isnull(%0) \
  72. ((!(%0[0])) || (((%0[0]) == '\1') && (!(%0[1]))))
  73. #endif
  74. #endif
  75. #endif // PAWNCMD_INC_