PageRenderTime 30ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/mani_admin_plugin/mani_commands.cpp

http://maniadminplugin.googlecode.com/
C++ | 1815 lines | 1375 code | 215 blank | 225 comment | 243 complexity | 4c103dcdf88dba373096c0528612e45e MD5 | raw file
Possible License(s): GPL-3.0
  1. //
  2. // Mani Admin Plugin
  3. //
  4. // Copyright Š 2009-2014 Giles Millward (Mani). All rights reserved.
  5. //
  6. // This file is part of ManiAdminPlugin.
  7. //
  8. // Mani Admin Plugin is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // Mani Admin Plugin is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with Mani Admin Plugin. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. //
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <math.h>
  26. #include <time.h>
  27. #include "interface.h"
  28. #include "filesystem.h"
  29. #include "engine/iserverplugin.h"
  30. #include "iplayerinfo.h"
  31. #include "eiface.h"
  32. #include "igameevents.h"
  33. #include "mrecipientfilter.h"
  34. #include "bitbuf.h"
  35. #include "engine/IEngineSound.h"
  36. #include "inetchannelinfo.h"
  37. #include "ivoiceserver.h"
  38. #include "networkstringtabledefs.h"
  39. #include "mani_main.h"
  40. #include "mani_timers.h"
  41. #include "mani_player.h"
  42. #include "mani_client_flags.h"
  43. #include "mani_language.h"
  44. #include "mani_gametype.h"
  45. #include "mani_memory.h"
  46. #include "mani_parser.h"
  47. #include "mani_convar.h"
  48. #include "mani_client.h"
  49. #include "mani_menu.h"
  50. #include "mani_output.h"
  51. #include "mani_panel.h"
  52. #include "mani_quake.h"
  53. #include "mani_crontab.h"
  54. #include "mani_adverts.h"
  55. #include "mani_maps.h"
  56. #include "mani_stats.h"
  57. #include "mani_replace.h"
  58. #include "mani_effects.h"
  59. #include "mani_sounds.h"
  60. #include "mani_voice.h"
  61. #include "mani_skins.h"
  62. #include "mani_weapon.h"
  63. #include "mani_team.h"
  64. #include "mani_teamkill.h"
  65. #include "mani_ghost.h"
  66. #include "mani_customeffects.h"
  67. #include "mani_mapadverts.h"
  68. #include "mani_downloads.h"
  69. #include "mani_victimstats.h"
  70. #include "mani_database.h"
  71. #include "mani_netidvalid.h"
  72. #include "mani_autokickban.h"
  73. #include "mani_reservedslot.h"
  74. #include "mani_spawnpoints.h"
  75. #include "mani_sprayremove.h"
  76. #include "mani_chattrigger.h"
  77. #include "mani_warmuptimer.h"
  78. #include "mani_log_css_stats.h"
  79. #include "mani_log_dods_stats.h"
  80. #include "mani_mostdestructive.h"
  81. #include "mani_messagemode.h"
  82. #include "mani_trackuser.h"
  83. #include "mani_save_scores.h"
  84. #include "mani_team_join.h"
  85. #include "mani_afk.h"
  86. #include "mani_ping.h"
  87. #include "mani_mysql.h"
  88. #include "mani_vote.h"
  89. #include "mani_observer_track.h"
  90. #include "mani_team.h"
  91. #include "mani_file.h"
  92. #include "mani_vfuncs.h"
  93. #include "mani_help.h"
  94. #include "mani_mainclass.h"
  95. #include "mani_callback_sourcemm.h"
  96. #include "mani_callback_valve.h"
  97. #include "mani_commands.h"
  98. #include "mani_sigscan.h"
  99. #include "mani_globals.h"
  100. #include "mani_commands.h"
  101. #include "shareddefs.h"
  102. #include "mani_command_control.h"
  103. extern IVEngineServer *engine;
  104. extern IPlayerInfoManager *playerinfomanager;
  105. extern int max_players;
  106. extern CGlobalVars *gpGlobals;
  107. extern bool war_mode;
  108. extern int con_command_index;
  109. static int sort_by_cmd_name ( const void *m1, const void *m2);
  110. static int sort_by_cmd_name ( const void *m1, const void *m2)
  111. {
  112. struct cmd_t *mi1 = (struct cmd_t *) m1;
  113. struct cmd_t *mi2 = (struct cmd_t *) m2;
  114. return stricmp(mi1->cmd_name, mi2->cmd_name);
  115. }
  116. ConVar mani_say_command_prefix ("mani_say_command_prefix", "@", 0, "Prefix to use for chat commands, default = @");
  117. inline bool FStruEq(const char *sz1, const char *sz2)
  118. {
  119. return(Q_strcmp(sz1, sz2) == 0);
  120. }
  121. static char *cmd_null_string = "";
  122. ManiCommands g_Cmd;
  123. ManiCommands *gpCmd;
  124. ManiCommands::ManiCommands()
  125. {
  126. // Init
  127. cmd_list = NULL;
  128. cmd_list_size = 0;
  129. gpCmd = this;
  130. }
  131. ManiCommands::~ManiCommands()
  132. {
  133. // Cleanup
  134. this->CleanUp();
  135. }
  136. //---------------------------------------------------------------------------------
  137. // Purpose: Clean our list
  138. //---------------------------------------------------------------------------------
  139. void ManiCommands::CleanUp(void)
  140. {
  141. for (int i = 0; i < cmd_list_size; i ++)
  142. {
  143. free(cmd_list[i].cmd_name);
  144. }
  145. FreeList((void **) &cmd_list, &cmd_list_size);
  146. }
  147. //---------------------------------------------------------------------------------
  148. // Purpose: Init stuff for plugin load
  149. //---------------------------------------------------------------------------------
  150. void ManiCommands::Load(void)
  151. {
  152. // Register the commands that can be used in the plugin
  153. this->CleanUp();
  154. this->RegisterCommand("ma_say", 2005, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSay);
  155. this->RegisterCommand("ma_msay", 2007, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaMSay);
  156. this->RegisterCommand("ma_psay", 2009, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaPSay);
  157. this->RegisterCommand("ma_pmess", 2233, /*admin?*/ true, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaPMess);
  158. this->RegisterCommand("ma_exit", 2235, /*admin?*/ true, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaExit);
  159. this->RegisterCommand("ma_chat", 2011, /*admin?*/ false, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaChat);
  160. this->RegisterCommand("ma_csay", 2013, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaCSay);
  161. this->RegisterCommand("ma_session", 2015, /*admin?*/ false, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSession);
  162. this->RegisterCommand("ma_statsme", 2017, /*admin?*/ false, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaStatsMe);
  163. this->RegisterCommand("ma_rcon", 2019, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaRCon);
  164. this->RegisterCommand("ma_browse", 2021, /*admin?*/ false, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaBrowse);
  165. this->RegisterCommand("ma_cexec", 2023, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaCExec);
  166. this->RegisterCommand("ma_cexec_t", 0, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaCExecT);
  167. this->RegisterCommand("ma_cexec_ct", 0, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaCExecCT);
  168. this->RegisterCommand("ma_cexec_all", 0, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaCExecAll);
  169. this->RegisterCommand("ma_cexec_spec", 0, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaCExecSpec);
  170. this->RegisterCommand("ma_slap", 2025, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSlap);
  171. this->RegisterCommand("ma_setflag", 0, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSetFlag);
  172. this->RegisterCommand("ma_setskin", 2027, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSetSkin);
  173. this->RegisterCommand("ma_setcash", 2029, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSetCash);
  174. this->RegisterCommand("ma_givecash", 2031, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaGiveCash);
  175. this->RegisterCommand("ma_givecashp", 2033, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaGiveCashP);
  176. this->RegisterCommand("ma_takecash", 2035, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaTakeCash);
  177. this->RegisterCommand("ma_takecashp", 2037, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaTakeCashP);
  178. this->RegisterCommand("ma_sethealth", 2039, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSetHealth);
  179. this->RegisterCommand("ma_givehealth", 2041, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaGiveHealth);
  180. this->RegisterCommand("ma_givehealthp", 2043, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaGiveHealthP);
  181. this->RegisterCommand("ma_takehealth", 2045, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaTakeHealth);
  182. this->RegisterCommand("ma_takehealthp", 2047, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaTakeHealthP);
  183. this->RegisterCommand("ma_blind", 2049, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaBlind);
  184. this->RegisterCommand("ma_freeze", 2051, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaFreeze);
  185. this->RegisterCommand("ma_noclip", 2053, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaNoClip);
  186. this->RegisterCommand("ma_burn", 2055, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaBurn);
  187. this->RegisterCommand("ma_gravity", 2057, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaGravity);
  188. this->RegisterCommand("ma_colour", 2059, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaColour);
  189. this->RegisterCommand("ma_color", 2061, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaColour);
  190. this->RegisterCommand("ma_colour_weapon", 2063, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaColourWeapon);
  191. this->RegisterCommand("ma_color_weapon", 2065, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaColourWeapon);
  192. this->RegisterCommand("ma_render_mode", 2067, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaRenderMode);
  193. this->RegisterCommand("ma_render_fx", 2069, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaRenderFX);
  194. this->RegisterCommand("ma_give", 2071, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaGive);
  195. this->RegisterCommand("ma_give_ammo", 2073, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaGiveAmmo);
  196. this->RegisterCommand("ma_giveammo", 2073, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaGiveAmmo);
  197. this->RegisterCommand("ma_drug", 2075, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaDrug);
  198. this->RegisterCommand("ma_decal", 2077, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaDecal);
  199. this->RegisterCommand("ma_timebomb", 2081, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaTimeBomb);
  200. this->RegisterCommand("ma_freezebomb", 2083, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaFreezeBomb);
  201. this->RegisterCommand("ma_firebomb", 2085, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaFireBomb);
  202. this->RegisterCommand("ma_beacon", 2087, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaBeacon);
  203. this->RegisterCommand("ma_mute", 2089, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaMute);
  204. this->RegisterCommand("ma_teleport", 2091, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaTeleport);
  205. this->RegisterCommand("ma_position", 2093, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaPosition);
  206. this->RegisterCommand("ma_swapteam", 2095, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSwapTeam);
  207. this->RegisterCommand("ma_swapteam_d", 2237, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSwapTeamD);
  208. this->RegisterCommand("ma_spec", 2097, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSpec);
  209. this->RegisterCommand("ma_balance", 2099, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaBalance);
  210. this->RegisterCommand("ma_dropc4", 2101, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaDropC4);
  211. this->RegisterCommand("ma_saveloc", 2103, /*admin?*/ true, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSaveLoc);
  212. this->RegisterCommand("ma_resetrank", 2105, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaResetRank);
  213. this->RegisterCommand("ma_map", 2107, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaMap);
  214. this->RegisterCommand("ma_skipmap", 2109, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSkipMap);
  215. this->RegisterCommand("ma_nextmap", 2111, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaNextMap);
  216. this->RegisterCommand("ma_listmaps", 2113, /*admin?*/ false, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaListMaps);
  217. this->RegisterCommand("ma_maplist", 2115, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaMapList);
  218. this->RegisterCommand("ma_maphistory", 2227, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaMapHistory);
  219. this->RegisterCommand("ma_mapcycle", 2117, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaMapCycle);
  220. this->RegisterCommand("ma_votemaplist", 2119, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaVoteMapList);
  221. this->RegisterCommand("ma_war", 2121, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaWar);
  222. this->RegisterCommand("ma_setnextmap", 2123, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSetNextMap);
  223. this->RegisterCommand("ma_voterandom", 2125, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaVoteRandom);
  224. this->RegisterCommand("ma_voteextend", 2127, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaVoteExtend);
  225. this->RegisterCommand("ma_votercon", 2129, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaVoteRCon);
  226. this->RegisterCommand("ma_vote", 2131, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaVote);
  227. this->RegisterCommand("ma_votequestion", 2133, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaVoteQuestion);
  228. this->RegisterCommand("ma_votecancel", 2135, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaVoteCancel);
  229. this->RegisterCommand("ma_play", 2137, /*admin?*/ false, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaPlaySound);
  230. this->RegisterCommand("ma_showrestrict", 2139, /*admin?*/ false, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaShowRestrict);
  231. this->RegisterCommand("ma_restrict", 2141, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaRestrict);
  232. this->RegisterCommand("ma_knives", 2143, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaKnives);
  233. this->RegisterCommand("ma_pistols", 2145, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaPistols);
  234. this->RegisterCommand("ma_shotguns", 2147, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaShotguns);
  235. this->RegisterCommand("ma_nosnipers", 2149, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaNoSnipers);
  236. this->RegisterCommand("ma_unrestrict", 2151, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaUnRestrict);
  237. this->RegisterCommand("ma_unrestrictall", 2153, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaUnRestrictAll);
  238. this->RegisterCommand("ma_restrictall", 2225, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaRestrictAll);
  239. this->RegisterCommand("ma_tklist", 2155, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaTKList);
  240. this->RegisterCommand("ma_kick", 2157, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaKick);
  241. this->RegisterCommand("ma_chattriggers", 2159, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaChatTriggers);
  242. this->RegisterCommand("ma_spray", 2161, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSpray);
  243. this->RegisterCommand("ma_slay", 2163, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaSlay);
  244. this->RegisterCommand("ma_offset", 0, /*admin?*/ true, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaOffset);
  245. this->RegisterCommand("ma_offsetscan", 0, /*admin?*/ true, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaOffsetScan);
  246. this->RegisterCommand("ma_offsetscanf", 0, /*admin?*/ true, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaOffsetScanF);
  247. this->RegisterCommand("ma_teamindex", 2165, /*admin?*/ true, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaTeamIndex);
  248. this->RegisterCommand("ma_client", 2221, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaClient);
  249. this->RegisterCommand("ma_clientgroup", 2223, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaClientGroup);
  250. this->RegisterCommand("ma_reloadclients", 2167, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaReloadClients);
  251. this->RegisterCommand("ma_ban", 2169, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaBan);
  252. this->RegisterCommand("ma_banip", 2171, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaBanIP);
  253. this->RegisterCommand("ma_unban", 2173, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaUnBan);
  254. this->RegisterCommand("ma_favourites", 2175, /*admin?*/ false, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaFavourites);
  255. this->RegisterCommand("ma_rates", 2177, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaRates);
  256. this->RegisterCommand("ma_users", 2179, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaUsers);
  257. this->RegisterCommand("ma_showsounds", 2181, /*admin?*/ false, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaShowSounds);
  258. this->RegisterCommand("ma_config", 2183, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaConfig);
  259. this->RegisterCommand("ma_timeleft", 2185, /*admin?*/ false, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaTimeLeft);
  260. this->RegisterCommand("ma_aban_name", 2187, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoBanName);
  261. this->RegisterCommand("ma_aban_pname", 2189, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoBanPName);
  262. this->RegisterCommand("ma_akick_name", 2191, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoKickName);
  263. this->RegisterCommand("ma_akick_pname", 2193, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoKickPName);
  264. this->RegisterCommand("ma_akick_steam", 2195, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoKickSteam);
  265. this->RegisterCommand("ma_akick_ip", 2197, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoKickIP);
  266. this->RegisterCommand("ma_unauto_name", 2199, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaUnAutoName);
  267. this->RegisterCommand("ma_unauto_pname", 2201, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaUnAutoPName);
  268. this->RegisterCommand("ma_unauto_steam", 2203, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaUnAutoSteam);
  269. this->RegisterCommand("ma_unauto_ip", 2205, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaUnAutoIP);
  270. this->RegisterCommand("ma_ashow_name", 2207, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoShowName);
  271. this->RegisterCommand("ma_ashow_pname", 2209, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoShowPName);
  272. this->RegisterCommand("ma_ashow_steam", 2211, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoShowSteam);
  273. this->RegisterCommand("ma_ashow_ip", 2213, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAutoShowIP);
  274. this->RegisterCommand("ma_ranks", 2215, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaRanks);
  275. this->RegisterCommand("ma_plranks", 2217, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaPLRanks);
  276. this->RegisterCommand("ma_help", 2219, /*admin?*/ false, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaHelp);
  277. this->RegisterCommand("ma_effect", 0, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ false, /*tsay ?*/ false, /*say ?*/ false, &ManiCommands::MaEffect);
  278. this->RegisterCommand("ma_restrictratio", 2229, /*admin?*/ true, /*war ?*/ false, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaRestrictRatio);
  279. this->RegisterCommand("ma_admins", 2231, /*admin?*/ true, /*war ?*/ true, /*server ?*/ true, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaAdmins);
  280. this->RegisterCommand("ma_observe", 2239, /*admin?*/ true, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaObserve);
  281. this->RegisterCommand("ma_endobserve", 2241, /*admin?*/ true, /*war ?*/ false, /*server ?*/ false, /*client con ?*/ true, /*tsay ?*/ true, /*say ?*/ true, &ManiCommands::MaEndObserve);
  282. // Register Menu commands triggered via client console
  283. //this->RegisterCommand("mam_plranks", /*war ?*/ false, &ManiCommands::MaPLRanks);
  284. // Sort so we can use a bsearch on the commands, maybe use hash index for them in the future ?
  285. qsort(cmd_list, cmd_list_size, sizeof(cmd_t), sort_by_cmd_name);
  286. this->WriteHelpHTML();
  287. // Do some tests
  288. //float curtime = gpGlobals->curtime;
  289. //int max_tests = 1000000;
  290. //char found_print[256];
  291. //cmd_t cmd_key;
  292. //cmd_t *found_cmd;
  293. //srand(0);
  294. //for (int i = 0;i < max_tests; i ++)
  295. //{
  296. // int fetch = rand() % cmd_list_size;
  297. // Q_strcpy(cmd_key.cmd_name, cmd_list[fetch].cmd_name);
  298. // // Do BSearch for function name
  299. // found_cmd = (cmd_t *) bsearch
  300. // (
  301. // &cmd_key,
  302. // cmd_list,
  303. // cmd_list_size,
  304. // sizeof(cmd_t),
  305. // sort_by_cmd_name
  306. // );
  307. // if (found_cmd)
  308. // {
  309. // // function found
  310. // Q_strcpy(found_print, found_cmd->cmd_name);
  311. // }
  312. //}
  313. //Msg("Time taken %f, %s\n", gpGlobals->curtime - curtime, found_print);
  314. //srand(0);
  315. //for (int i = 0;i < max_tests; i ++)
  316. //{
  317. // int fetch = rand() % cmd_list_size;
  318. // Q_strcpy(cmd_key.cmd_name, cmd_list[fetch].cmd_name);
  319. // for (int j = 0; j < cmd_list_size; j++)
  320. // {
  321. // if (FStrEq(cmd_key.cmd_name, cmd_list[j].cmd_name))
  322. // {
  323. // // function found
  324. // Q_strcpy(found_print, found_cmd->cmd_name);
  325. // break;
  326. // }
  327. // }
  328. //}
  329. //Msg("Time taken %f, %s\n", gpGlobals->curtime - curtime, found_print);
  330. //while(1)
  331. //{
  332. // Sleep(1);
  333. //}
  334. }
  335. //---------------------------------------------------------------------------------
  336. // Purpose: Plugin is unloaded
  337. //---------------------------------------------------------------------------------
  338. void ManiCommands::Unload(void)
  339. {
  340. this->CleanUp();
  341. }
  342. //---------------------------------------------------------------------------------
  343. // Purpose: Get command index
  344. //---------------------------------------------------------------------------------
  345. int ManiCommands::GetCmdIndexForHelpID
  346. (
  347. const int help_id
  348. )
  349. {
  350. for (int i = 0; i < cmd_list_size; i ++)
  351. {
  352. if (help_id == cmd_list[i].help_id)
  353. {
  354. return i;
  355. }
  356. }
  357. return -1;
  358. }
  359. //---------------------------------------------------------------------------------
  360. // Purpose: Show all the help commands
  361. //---------------------------------------------------------------------------------
  362. void ManiCommands::ShowAllCommands
  363. (
  364. player_t *player_ptr,
  365. bool admin_flag
  366. )
  367. {
  368. if (player_ptr)
  369. {
  370. SayToPlayer(GREEN_CHAT, player_ptr, "Check console for output");
  371. }
  372. for (int i = 0; i < cmd_list_size; i ++)
  373. {
  374. // Don't show admin commands to regular players
  375. if (cmd_list[i].admin_required && !admin_flag) continue;
  376. if (!player_ptr && !cmd_list[i].server_command) continue;
  377. OutputToConsole(player_ptr, "%s\n", cmd_list[i].cmd_name);
  378. }
  379. }
  380. //---------------------------------------------------------------------------------
  381. // Purpose: Show all the help commands
  382. //---------------------------------------------------------------------------------
  383. void ManiCommands::SearchCommands
  384. (
  385. player_t *player_ptr,
  386. bool admin_flag,
  387. const char *pattern,
  388. const int command_type
  389. )
  390. {
  391. int cmd_count = 0;
  392. int cmd_index = -1;
  393. for (int i = 0; i < cmd_list_size; i ++)
  394. {
  395. // Don't show admin commands to regular players
  396. if (cmd_list[i].admin_required && !admin_flag) continue;
  397. if (!player_ptr && !cmd_list[i].server_command) continue;
  398. if (war_mode && !cmd_list[i].war_mode_allowed) continue;
  399. if (Q_stristr(cmd_list[i].cmd_name, pattern) != NULL)
  400. {
  401. if (FStrEq(cmd_list[i].cmd_name, pattern))
  402. {
  403. cmd_index = i;
  404. cmd_count = 1;
  405. break;
  406. }
  407. cmd_index = i;
  408. cmd_count ++;
  409. }
  410. }
  411. if (cmd_count == 0)
  412. {
  413. OutputHelpText(GREEN_CHAT, player_ptr, "No match found");
  414. return;
  415. }
  416. if (player_ptr && cmd_count > 1)
  417. {
  418. SayToPlayer(GREEN_CHAT, player_ptr, "Check console for output");
  419. }
  420. if (cmd_count > 20)
  421. {
  422. for (int i = 0; i < cmd_list_size; i ++)
  423. {
  424. // Don't show admin commands to regular players
  425. if (cmd_list[i].admin_required && !admin_flag) continue;
  426. if (!player_ptr && !cmd_list[i].server_command) continue;
  427. if (war_mode && !cmd_list[i].war_mode_allowed) continue;
  428. if (Q_stristr(cmd_list[i].cmd_name, pattern) != NULL)
  429. {
  430. OutputToConsole(player_ptr, "%s\n", cmd_list[i].cmd_name);
  431. }
  432. }
  433. }
  434. else if (cmd_count > 1)
  435. {
  436. for (int i = 0; i < cmd_list_size; i ++)
  437. {
  438. // Don't show admin commands to regular players
  439. if (cmd_list[i].admin_required && !admin_flag) continue;
  440. if (!player_ptr && !cmd_list[i].server_command) continue;
  441. if (war_mode && !cmd_list[i].war_mode_allowed) continue;
  442. if (Q_stristr(cmd_list[i].cmd_name, pattern) != NULL)
  443. {
  444. OutputToConsole(player_ptr, "%s : %s\n", cmd_list[i].cmd_name, Translate(player_ptr, cmd_list[i].help_id));
  445. }
  446. }
  447. }
  448. else
  449. {
  450. DumpHelp(player_ptr, cmd_index, command_type);
  451. }
  452. return;
  453. }
  454. //---------------------------------------------------------------------------------
  455. // Purpose: Output Help in various formats for say/console/server console format
  456. //---------------------------------------------------------------------------------
  457. void ManiCommands::DumpHelp
  458. (
  459. player_t *player_ptr,
  460. int cmd_index,
  461. const int command_type
  462. )
  463. {
  464. int help_id = cmd_list[cmd_index].help_id;
  465. bool server_console = cmd_list[cmd_index].server_command;
  466. bool client_console = cmd_list[cmd_index].client_command;
  467. bool client_chat = cmd_list[cmd_index].say_command | cmd_list[cmd_index].tsay_command;
  468. bool war_allowed = cmd_list[cmd_index].war_mode_allowed;
  469. // Show command name
  470. OutputHelpText(GREEN_CHAT, player_ptr, "%s", Translate(player_ptr, 2000, "%s", cmd_list[cmd_index].cmd_name));
  471. // Show types of operation
  472. OutputHelpText(GREEN_CHAT, player_ptr, "%s", Translate(player_ptr, 2001, "%s%s%s%s",
  473. (server_console == true) ? Translate(player_ptr, M_MENU_YES):Translate(player_ptr, M_MENU_NO),
  474. (client_console == true) ? Translate(player_ptr, M_MENU_YES):Translate(player_ptr, M_MENU_NO),
  475. (client_chat == true) ? Translate(player_ptr, M_MENU_YES):Translate(player_ptr, M_MENU_NO),
  476. (war_allowed == true) ? Translate(player_ptr, M_MENU_YES):Translate(player_ptr, M_MENU_NO)));
  477. // Show Parameters
  478. OutputHelpText(GREEN_CHAT, player_ptr, "%s %s", Translate(player_ptr, 2002), Translate(player_ptr, help_id));
  479. // Show Description
  480. if (command_type == M_SAY || command_type == M_TSAY)
  481. {
  482. char help_text[2048];
  483. int length = snprintf(help_text, sizeof(help_text), "%s %s", Translate(player_ptr, 2003), Translate(player_ptr, help_id + 1));
  484. if (length > 254)
  485. {
  486. int start_index = 0;
  487. int end_index = 254;
  488. for(;;)
  489. {
  490. bool found_line;
  491. found_line = false;
  492. for (int i = end_index; i > start_index; i--)
  493. {
  494. if (help_text[i] == 0x0a)
  495. {
  496. // Found line break
  497. found_line = true;
  498. help_text[i] = '\0';
  499. OutputHelpText(GREEN_CHAT, player_ptr, "%s", &(help_text[start_index]));
  500. start_index = i + 1;
  501. end_index = start_index + 254;
  502. if (end_index > length)
  503. {
  504. OutputHelpText(GREEN_CHAT, player_ptr, "%s", &(help_text[start_index]));
  505. return;
  506. }
  507. break;
  508. }
  509. }
  510. if (!found_line)
  511. {
  512. break;
  513. }
  514. }
  515. }
  516. else
  517. {
  518. OutputHelpText(GREEN_CHAT, player_ptr, "%s", help_text);
  519. }
  520. }
  521. else if (command_type == M_CCONSOLE)
  522. {
  523. char help_text[2048];
  524. int length = snprintf(help_text, sizeof(help_text), "%s %s", Translate(player_ptr, 2003), Translate(player_ptr, help_id + 1));
  525. if (length > 700)
  526. {
  527. int start_index = 0;
  528. int end_index = 700;
  529. for(;;)
  530. {
  531. bool found_line;
  532. found_line = false;
  533. for (int i = end_index; i > start_index; i--)
  534. {
  535. if (help_text[i] == 0x0a)
  536. {
  537. // Found line break
  538. found_line = true;
  539. help_text[i] = '\0';
  540. OutputToConsole(player_ptr, "%s\n", &(help_text[start_index]));
  541. start_index = i + 1;
  542. end_index = start_index + 700;
  543. if (end_index > length)
  544. {
  545. OutputToConsole(player_ptr, "%s\n", &(help_text[start_index]));
  546. return;
  547. }
  548. break;
  549. }
  550. }
  551. if (!found_line)
  552. {
  553. break;
  554. }
  555. }
  556. }
  557. else
  558. {
  559. OutputToConsole(player_ptr, "%s\n", help_text);
  560. }
  561. }
  562. else
  563. {
  564. OutputToConsole(player_ptr, "%s %s\n", Translate(player_ptr, 2003), Translate(player_ptr, help_id + 1));
  565. }
  566. }
  567. //---------------------------------------------------------------------------------
  568. // Purpose: Process the the say command strings
  569. //---------------------------------------------------------------------------------
  570. void ManiCommands::ExtractSayCommand(bool team_say, const CCommand &args)
  571. {
  572. char one[8];
  573. char two[8];
  574. char three[8];
  575. this->ParseSayCommand(args);
  576. strcpy(say_argv0, "");
  577. if (cmd_argc != 0)
  578. {
  579. char *argv0 = cmd_argv[0];
  580. strcpy(one, mani_say_command_prefix.GetString());
  581. strcpy(two, one);
  582. strcat(two, mani_say_command_prefix.GetString());
  583. strcpy(three, two);
  584. strcat(three, mani_say_command_prefix.GetString());
  585. if (argv0[0] == one[0])
  586. {
  587. // This is the start of a command as we have the @ symbol
  588. bool copied_command = false;
  589. if (mani_use_ma_in_say_command.GetInt() == 0)
  590. {
  591. // The prefix ma_ is not required so we should add it if
  592. // it does not exist after the @ command
  593. if (Q_strlen(cmd_argv[0]) > 3)
  594. {
  595. // If we don't have ma_ in the command
  596. if (toupper(argv0[1] != 'M') &&
  597. toupper(argv0[2] != 'A') &&
  598. argv0[3] != '_')
  599. {
  600. // Add it in
  601. Q_strcpy(say_argv0, "ma_");
  602. strcat(say_argv0, &(argv0[1]));
  603. copied_command = true;
  604. }
  605. }
  606. }
  607. if (!copied_command)
  608. {
  609. Q_strcpy(say_argv0, &(argv0[1]));
  610. }
  611. if (FStrEq(argv0, one))
  612. {
  613. if (!team_say)
  614. {
  615. strcpy(say_argv0, "ma_say");
  616. }
  617. else
  618. {
  619. strcpy(say_argv0, "ma_chat");
  620. }
  621. }
  622. else if (FStrEq(argv0, two))
  623. {
  624. strcpy(say_argv0, "ma_psay");
  625. }
  626. else if (FStrEq(argv0, three))
  627. {
  628. strcpy(say_argv0, "ma_csay");
  629. }
  630. }
  631. }
  632. this->DumpCommands();
  633. }
  634. //---------------------------------------------------------------------------------
  635. // Purpose: Dump out the contents of the new cmd details
  636. //---------------------------------------------------------------------------------
  637. void ManiCommands::DumpCommands(void)
  638. {
  639. return;
  640. Msg("Argc %i\nArgs [%s]\nArgv-> ", gpCmd->Cmd_Argc(), gpCmd->Cmd_Args());
  641. for (int i = 0; i < gpCmd->Cmd_Argc(); i++)
  642. {
  643. Msg("%i [%s] ", i, gpCmd->Cmd_Argv(i));
  644. }
  645. Msg("\n");
  646. Msg("Args(x)\n");
  647. for (int i = 0; i < gpCmd->Cmd_Argc(); i++)
  648. {
  649. Msg("%i [%s]\n", i, gpCmd->Cmd_Args(i));
  650. }
  651. Msg("say_argv0 [%s]\n", say_argv0);
  652. }
  653. //---------------------------------------------------------------------------------
  654. // Purpose: Process the the say command strings
  655. //---------------------------------------------------------------------------------
  656. void ManiCommands::ParseSayCommand(const CCommand &args)
  657. {
  658. static int i,j;
  659. static char terminate_char;
  660. static bool found_quotes;
  661. static int say_length;
  662. static const char *say_string;
  663. cmd_argc = 0;
  664. for (i = 0; i < 80; i++)
  665. {
  666. // Reset strings for safety
  667. cmd_argv[i] = cmd_null_string;
  668. cmd_argv_cat[i] = cmd_null_string;
  669. }
  670. if (!args.ArgS()) return;
  671. say_string = args.ArgS();
  672. say_length = Q_strlen(say_string);
  673. if (say_length == 0)
  674. {
  675. return;
  676. }
  677. if (say_length == 1)
  678. {
  679. // Only one character in string
  680. Q_strcpy(temp_string1, say_string);
  681. cmd_argc = 1;
  682. cmd_argv[0] = &(temp_string1[0]);
  683. cmd_argv_cat[0] = cmd_argv[0];
  684. cmd_args = cmd_argv[0];
  685. return;
  686. }
  687. // Check if quotes are needed to be removed
  688. if (say_string[0] == '\"' && say_string[say_length - 1] == '\"')
  689. {
  690. strncpy(temp_string1, &(say_string[1]), say_length - 2);
  691. temp_string1[say_length - 2] = '\0';
  692. }
  693. else
  694. {
  695. strcpy(temp_string1, say_string);
  696. }
  697. cmd_args = &(temp_string1[0]);
  698. // Extract tokens
  699. i = 0;
  700. j = 0;
  701. while (cmd_argc != 80)
  702. {
  703. // Find first non white space
  704. while (temp_string1[i] == ' ' && temp_string1[i] != '\0') i++;
  705. if (temp_string1[i] == '\0') return;
  706. cmd_argv_cat[cmd_argc] = &(temp_string1[i]);
  707. cmd_argv[cmd_argc] = &(temp_string2[j]);
  708. if (temp_string1[i] == '\"')
  709. {
  710. // This is a command in quotes
  711. i++;
  712. while (temp_string1[i] != '\"' && temp_string1[i] != '\0')
  713. {
  714. // Copy char
  715. temp_string2[j] = temp_string1[i];
  716. j++;
  717. i++;
  718. }
  719. cmd_argc++;
  720. temp_string2[j++] = '\0';
  721. if (temp_string1[i] == '\0') return;
  722. // Skip end quote char
  723. i++;
  724. }
  725. else
  726. {
  727. // Command is not in quotes
  728. while (temp_string1[i] != ' ' && temp_string1[i] != '\0')
  729. {
  730. temp_string2[j] = temp_string1[i];
  731. j++;
  732. i++;
  733. }
  734. cmd_argc++;
  735. temp_string2[j++] = '\0';
  736. if (temp_string1[i] == '\0') return;
  737. // Skip white space
  738. i++;
  739. }
  740. }
  741. return;
  742. }
  743. //---------------------------------------------------------------------------------
  744. // Purpose: Process the the event say commands
  745. //---------------------------------------------------------------------------------
  746. void ManiCommands::ParseEventSayCommand(const char *player_say)
  747. {
  748. static int i,j;
  749. static char terminate_char;
  750. static bool found_quotes;
  751. static int say_length;
  752. static const char *say_string;
  753. cmd_argc = 0;
  754. for (i = 0; i < 80; i++)
  755. {
  756. // Reset strings for safety
  757. cmd_argv[i] = cmd_null_string;
  758. cmd_argv_cat[i] = cmd_null_string;
  759. }
  760. // if (!engine->Cmd_Args()) return;
  761. say_string = player_say;
  762. say_length = Q_strlen(say_string);
  763. if (say_length == 0)
  764. {
  765. return;
  766. }
  767. if (say_length == 1)
  768. {
  769. // Only one character in string
  770. Q_strcpy(temp_string1, say_string);
  771. cmd_argc = 1;
  772. cmd_argv[0] = &(temp_string1[0]);
  773. cmd_argv_cat[0] = cmd_argv[0];
  774. cmd_args = cmd_argv[0];
  775. return;
  776. }
  777. strcpy(temp_string1, say_string);
  778. cmd_args = &(temp_string1[0]);
  779. // Extract tokens
  780. i = 0;
  781. j = 0;
  782. while (cmd_argc != 80)
  783. {
  784. // Find first non white space
  785. while (temp_string1[i] == ' ' && temp_string1[i] != '\0') i++;
  786. if (temp_string1[i] == '\0') return;
  787. cmd_argv_cat[cmd_argc] = &(temp_string1[i]);
  788. cmd_argv[cmd_argc] = &(temp_string2[j]);
  789. if (temp_string1[i] == '\"')
  790. {
  791. // This is a command in quotes
  792. i++;
  793. while (temp_string1[i] != '\"' && temp_string1[i] != '\0')
  794. {
  795. // Copy char
  796. temp_string2[j] = temp_string1[i];
  797. j++;
  798. i++;
  799. }
  800. cmd_argc++;
  801. temp_string2[j++] = '\0';
  802. if (temp_string1[i] == '\0') return;
  803. // Skip end quote char
  804. i++;
  805. }
  806. else
  807. {
  808. // Command is not in quotes
  809. while (temp_string1[i] != ' ' && temp_string1[i] != '\0')
  810. {
  811. temp_string2[j] = temp_string1[i];
  812. j++;
  813. i++;
  814. }
  815. cmd_argc++;
  816. temp_string2[j++] = '\0';
  817. if (temp_string1[i] == '\0') return;
  818. // Skip white space
  819. i++;
  820. }
  821. }
  822. return;
  823. }
  824. //---------------------------------------------------------------------------------
  825. // Purpose: Process the the Client and Server command strings
  826. //---------------------------------------------------------------------------------
  827. void ManiCommands::ExtractClientAndServerCommand(const CCommand &args)
  828. {
  829. static int i,j;
  830. static char terminate_char;
  831. static bool found_quotes;
  832. static int say_length;
  833. static const char *say_string;
  834. cmd_argc = 1;
  835. for (i = 0; i < 80; i++)
  836. {
  837. // Reset strings for safety
  838. cmd_argv[i] = cmd_null_string;
  839. cmd_argv_cat[i] = cmd_null_string;
  840. }
  841. Q_strcpy(say_argv0, "");
  842. int initial_len = snprintf(temp_string1, sizeof(temp_string1), "%s ", args.Arg(0));
  843. Q_strcpy(temp_string2, args.Arg(0));
  844. say_string = args.ArgS();
  845. if (!say_string)
  846. {
  847. Q_strcpy(temp_string1, args.Arg(0));
  848. cmd_args = &(temp_string1[0]);
  849. cmd_argv_cat[0] = &(temp_string1[0]);
  850. cmd_argv[0] = &(temp_string2[0]);
  851. this->DumpCommands();
  852. return;
  853. }
  854. say_length = Q_strlen(say_string);
  855. // Check if quotes are needed to be removed
  856. /* if (say_string[0] == '\"' && say_string[say_length - 1] == '\"')
  857. {
  858. for (int x = 0; x < say_length - 2; x++)
  859. {
  860. temp_string1[initial_len + x] = say_string[x + 1];
  861. }
  862. temp_string1[initial_len + (say_length - 2)] = '\0';
  863. }
  864. else
  865. {*/
  866. strcat(temp_string1, say_string);
  867. // }
  868. cmd_args = &(temp_string1[0]);
  869. cmd_argv_cat[0] = &(temp_string1[0]);
  870. cmd_argv[0] = &(temp_string2[0]);
  871. // Extract tokens
  872. i = initial_len;
  873. j = strlen(temp_string2) + 1;
  874. while (cmd_argc != 80)
  875. {
  876. // Find first non white space
  877. while (temp_string1[i] == ' ' && temp_string1[i] != '\0') i++;
  878. if (temp_string1[i] == '\0')
  879. {
  880. this->DumpCommands();
  881. return;
  882. }
  883. cmd_argv_cat[cmd_argc] = &(temp_string1[i]);
  884. cmd_argv[cmd_argc] = &(temp_string2[j]);
  885. if (temp_string1[i] == '\"')
  886. {
  887. // This is a command in quotes
  888. i++;
  889. while (temp_string1[i] != '\"' && temp_string1[i] != '\0')
  890. {
  891. // Copy char
  892. temp_string2[j] = temp_string1[i];
  893. j++;
  894. i++;
  895. }
  896. cmd_argc++;
  897. temp_string2[j++] = '\0';
  898. if (temp_string1[i] == '\0')
  899. {
  900. this->DumpCommands();
  901. return;
  902. }
  903. // Skip end quote char
  904. i++;
  905. }
  906. else
  907. {
  908. // Command is not in quotes
  909. while (temp_string1[i] != ' ' && temp_string1[i] != '\0')
  910. {
  911. temp_string2[j] = temp_string1[i];
  912. j++;
  913. i++;
  914. }
  915. cmd_argc++;
  916. temp_string2[j++] = '\0';
  917. if (temp_string1[i] == '\0')
  918. {
  919. this->DumpCommands();
  920. return;
  921. }
  922. // Skip white space
  923. i++;
  924. }
  925. }
  926. this->DumpCommands();
  927. return;
  928. }
  929. //---------------------------------------------------------------------------------
  930. // Purpose: Register a command be it con command, client command or say command
  931. //---------------------------------------------------------------------------------
  932. void ManiCommands::RegisterCommand
  933. (
  934. const char *name,
  935. int help_id,
  936. bool admin_required,
  937. bool war_mode_allowed,
  938. bool server_command,
  939. bool client_command,
  940. bool say_command,
  941. bool tsay_command,
  942. int (ManiCommands::*funcPtr)(player_t *, const char *, int, int, bool)
  943. )
  944. {
  945. AddToList((void **) &cmd_list, sizeof(cmd_t), &cmd_list_size);
  946. int index = cmd_list_size - 1;
  947. cmd_list[index].cmd_name = (char *) malloc((sizeof(char) * strlen(name)) + 1);
  948. strcpy(cmd_list[index].cmd_name, name);
  949. cmd_list[index].help_id = help_id;
  950. cmd_list[index].admin_required = admin_required;
  951. cmd_list[index].server_command = server_command;
  952. cmd_list[index].client_command = client_command;
  953. cmd_list[index].say_command = say_command;
  954. cmd_list[index].tsay_command = tsay_command;
  955. cmd_list[index].funcPtr = funcPtr;
  956. cmd_list[index].war_mode_allowed = war_mode_allowed;
  957. cmd_list[index].menu_command = false;
  958. }
  959. //---------------------------------------------------------------------------------
  960. // Purpose: Register a command for menu use
  961. //---------------------------------------------------------------------------------
  962. void ManiCommands::RegisterCommand
  963. (
  964. const char *name,
  965. bool war_mode_allowed,
  966. int (ManiCommands::*funcPtr)(player_t *, const char *, int, int, bool)
  967. )
  968. {
  969. AddToList((void **) &cmd_list, sizeof(cmd_t), &cmd_list_size);
  970. int index = cmd_list_size - 1;
  971. cmd_list[index].cmd_name = (char *) malloc((sizeof(char) * strlen(name)) + 1);
  972. strcpy(cmd_list[index].cmd_name, name);
  973. cmd_list[index].help_id = 0;
  974. cmd_list[index].menu_command = true;
  975. cmd_list[index].server_command = false;
  976. cmd_list[index].client_command = false;
  977. cmd_list[index].say_command = false;
  978. cmd_list[index].tsay_command = false;
  979. cmd_list[index].funcPtr = funcPtr;
  980. cmd_list[index].war_mode_allowed = war_mode_allowed;
  981. }
  982. //---------------------------------------------------------------------------------
  983. // Purpose: Handle say commands and client console commands
  984. //---------------------------------------------------------------------------------
  985. int ManiCommands::HandleCommand
  986. (
  987. player_t *player_ptr,
  988. int command_type,
  989. const CCommand &args
  990. )
  991. {
  992. cmd_t cmd_key;
  993. cmd_t *found_cmd;
  994. if (ProcessPluginPaused()) return PLUGIN_CONTINUE;
  995. if (command_type == M_SAY || command_type == M_TSAY)
  996. {
  997. // Commands are already extract in the HookSay function
  998. if (strcmp(say_argv0, "") == 0) return true;
  999. cmd_key.cmd_name = (char *) say_argv0;
  1000. }
  1001. else
  1002. {
  1003. if (args.ArgC() == 0) return PLUGIN_CONTINUE;
  1004. cmd_key.cmd_name = (char *) args.Arg(0);
  1005. }
  1006. // Do BSearch for function name
  1007. found_cmd = (cmd_t *) bsearch
  1008. (
  1009. &cmd_key,
  1010. cmd_list,
  1011. cmd_list_size,
  1012. sizeof(cmd_t),
  1013. sort_by_cmd_name
  1014. );
  1015. if (found_cmd == NULL)
  1016. {
  1017. // No function found
  1018. return (int) PLUGIN_CONTINUE;
  1019. }
  1020. if (command_type == M_CCONSOLE)
  1021. {
  1022. if (found_cmd->client_command || found_cmd->menu_command)
  1023. {
  1024. // Client Console command
  1025. return (g_Cmd.*found_cmd->funcPtr) (player_ptr, cmd_key.cmd_name, found_cmd->help_id, command_type, found_cmd->war_mode_allowed);
  1026. }
  1027. return PLUGIN_CONTINUE;
  1028. }
  1029. else if (command_type == M_SAY)
  1030. {
  1031. // Say command
  1032. if (!found_cmd->say_command) return PLUGIN_CONTINUE;
  1033. if (engine->IsDedicatedServer() && con_command_index == -1)
  1034. {
  1035. return PLUGIN_CONTINUE;
  1036. }
  1037. (g_Cmd.*found_cmd->funcPtr) (player_ptr, cmd_key.cmd_name, found_cmd->help_id, command_type, found_cmd->war_mode_allowed);
  1038. return PLUGIN_STOP;
  1039. }
  1040. else if (command_type == M_TSAY)
  1041. {
  1042. // Team Say command
  1043. if (!found_cmd->tsay_command) return PLUGIN_CONTINUE;
  1044. if (engine->IsDedicatedServer() && con_command_index == -1)
  1045. {
  1046. return PLUGIN_CONTINUE;
  1047. }
  1048. (g_Cmd.*found_cmd->funcPtr) (player_ptr, cmd_key.cmd_name, found_cmd->help_id, command_type, found_cmd->war_mode_allowed);
  1049. return PLUGIN_STOP;
  1050. }
  1051. return 0;
  1052. }
  1053. int ManiCommands::Cmd_Argc(void)
  1054. {
  1055. return cmd_argc;
  1056. }
  1057. const char *ManiCommands::Cmd_Argv(int i)
  1058. {
  1059. return cmd_argv[i];
  1060. }
  1061. const char *ManiCommands::Cmd_Args(void)
  1062. {
  1063. return cmd_argv_cat[1];
  1064. }
  1065. const char *ManiCommands::Cmd_Args(int i)
  1066. {
  1067. return cmd_argv_cat[i];
  1068. }
  1069. const char *ManiCommands::Cmd_SayArg0(void)
  1070. {
  1071. return say_argv0;
  1072. }
  1073. //---------------------------------------------------------------------------------
  1074. // Purpose: Initialise a new command
  1075. //---------------------------------------------------------------------------------
  1076. void ManiCommands::NewCmd(void)
  1077. {
  1078. cmd_argc = 0;
  1079. for (int i = 0; i < 80; i++)
  1080. {
  1081. // Reset strings for safety
  1082. cmd_argv[i] = cmd_null_string;
  1083. cmd_argv_cat[i] = cmd_null_string;
  1084. }
  1085. Q_strcpy(temp_string1, "");
  1086. Q_strcpy(temp_string2, "");
  1087. Q_strcpy(say_argv0, "");
  1088. cmd_args = cmd_null_string;
  1089. current_marker1 = 0;
  1090. current_marker2 = 0;
  1091. }
  1092. //---------------------------------------------------------------------------------
  1093. // Purpose: Add a integer number as a parameter
  1094. //---------------------------------------------------------------------------------
  1095. void ManiCommands::AddParam(int number)
  1096. {
  1097. char temp_buffer[32];
  1098. int length;
  1099. length = snprintf(temp_buffer, sizeof(number), "%i", number);
  1100. this->AddStringParam(temp_buffer, length);
  1101. }
  1102. //---------------------------------------------------------------------------------
  1103. // Purpose: Add a float number as a parameter
  1104. //---------------------------------------------------------------------------------
  1105. void ManiCommands::AddParam(float number)
  1106. {
  1107. char temp_buffer[64];
  1108. int length;
  1109. length = snprintf(temp_buffer, sizeof(number), "%f", number);
  1110. this->AddStringParam(temp_buffer, length);
  1111. }
  1112. //---------------------------------------------------------------------------------
  1113. // Purpose: Add a variable string as a parameter
  1114. //---------------------------------------------------------------------------------
  1115. void ManiCommands::AddParam(char *fmt, ...)
  1116. {
  1117. va_list argptr;
  1118. int length;
  1119. char temp_buffer[2048];
  1120. va_start ( argptr, fmt );
  1121. length = vsnprintf( temp_buffer, sizeof(temp_buffer), fmt, argptr );
  1122. va_end ( argptr );
  1123. this->AddStringParam(temp_buffer, length);
  1124. }
  1125. //---------------------------------------------------------------------------------
  1126. // Purpose: Add a integer number as a parameter
  1127. //---------------------------------------------------------------------------------
  1128. void ManiCommands::SetParam(int argno, int number)
  1129. {
  1130. char temp_buffer[32];
  1131. int length;
  1132. length = snprintf(temp_buffer, sizeof(temp_buffer), "%i", number);
  1133. this->SetStringParam(argno, temp_buffer, length);
  1134. }
  1135. //---------------------------------------------------------------------------------
  1136. // Purpose: Add a float number as a parameter
  1137. //---------------------------------------------------------------------------------
  1138. void ManiCommands::SetParam(int argno, float number)
  1139. {
  1140. char temp_buffer[64];
  1141. int length;
  1142. length = snprintf(temp_buffer, sizeof(temp_buffer), "%f", number);
  1143. this->SetStringParam(argno, temp_buffer, length);
  1144. }
  1145. //---------------------------------------------------------------------------------
  1146. // Purpose: Add a variable string as a parameter
  1147. //---------------------------------------------------------------------------------
  1148. void ManiCommands::SetParam(int argno, char *fmt, ...)
  1149. {
  1150. va_list argptr;
  1151. int length;
  1152. char temp_buffer[2048];
  1153. va_start ( argptr, fmt );
  1154. length = vsnprintf( temp_buffer, sizeof(temp_buffer), fmt, argptr );
  1155. va_end ( argptr );
  1156. this->SetStringParam(argno, temp_buffer, length);
  1157. }
  1158. //---------------------------------------------------------------------------------
  1159. // Purpose: Add a string as a parameter
  1160. //---------------------------------------------------------------------------------
  1161. void ManiCommands::AddStringParam(char *string, int length)
  1162. {
  1163. // Nothing to add
  1164. if (string[0] == '\0') return;
  1165. if (cmd_argc == 0)
  1166. {
  1167. // First arguement to add
  1168. Q_strcpy(temp_string1, string);
  1169. Q_strcpy(temp_string2, string);
  1170. cmd_argv[cmd_argc] = &(temp_string1[0]);
  1171. cmd_argv_cat[cmd_argc] = &(temp_string2[0]);
  1172. cmd_args = &(temp_string2[0]);
  1173. }
  1174. else
  1175. {
  1176. // Not the first argument
  1177. Q_strcpy(&(temp_string1[current_marker1]), string);
  1178. strcat(temp_string2, " ");
  1179. strcat(temp_string2, string);
  1180. cmd_argv[cmd_argc] = &(temp_string1[current_marker1]);
  1181. cmd_argv_cat[cmd_argc] = &(temp_string2[current_marker2]);
  1182. }
  1183. current_marker1 += length + 1;
  1184. current_marker2 += length + 1;
  1185. cmd_argc ++;
  1186. }
  1187. //---------------------------------------------------------------------------------
  1188. // Purpose: Add a string as a parameter
  1189. //---------------------------------------------------------------------------------
  1190. void ManiCommands::SetStringParam(int argno, char *string, int length)
  1191. {
  1192. // Nothing to add
  1193. if (string[0] == '\0') return;
  1194. int no_of_cmds = cmd_argc;
  1195. if (no_of_cmds == 0) return;
  1196. memcpy(this->back_up_string, temp_string2, sizeof(temp_string2));
  1197. this->NewCmd();
  1198. const char *prefix = mani_say_command_prefix.GetString();
  1199. if (prefix && string[0] == prefix[0])
  1200. {
  1201. Q_strcpy(this->say_argv0, &(string[1]));
  1202. }
  1203. else
  1204. {
  1205. Q_strcpy(this->say_argv0, string);
  1206. }
  1207. char *str = this->back_up_string;
  1208. for (int i = 0; i < no_of_cmds; i ++)
  1209. {
  1210. if (i == argno)
  1211. {
  1212. gpCmd->AddParam("%s", string);
  1213. while(*str++ != 0);
  1214. }
  1215. else
  1216. {
  1217. gpCmd->AddParam("%s", str);
  1218. while(*str++ != 0);
  1219. }
  1220. }
  1221. }
  1222. int ManiCommands::BadAdmin(int result, player_t *player_ptr, const char *name)
  1223. {
  1224. // RCON command
  1225. if (!player_ptr)
  1226. {
  1227. if (result == PLUGIN_BAD_ADMIN)
  1228. {
  1229. return PLUGIN_STOP;
  1230. }
  1231. return result;
  1232. }
  1233. if (result == PLUGIN_BAD_ADMIN)
  1234. {
  1235. OutputHelpText(GREEN_CHAT, player_ptr, "%s", Translate(player_ptr, 2580, "%s", name));
  1236. return PLUGIN_STOP;
  1237. }
  1238. return result;
  1239. }
  1240. void ManiCommands::WriteHelpHTML(void)
  1241. {
  1242. char filename[512];
  1243. FILE *filehandle = NULL;
  1244. ManiFile *mf = new ManiFile();
  1245. snprintf(filename, sizeof(filename), "./cfg/%s/data/command_help.html", mani_path.GetString());
  1246. filehandle = mf->Open(filename, "wt");
  1247. if (filehandle == NULL)
  1248. {
  1249. delete mf;
  1250. return;
  1251. }
  1252. const char *header_row_bg_colour = "#000080";
  1253. const char *header_row_font_colour = "#ffffff";
  1254. const char *cmd_col_bg_colour = "#4d4d4d";
  1255. const char *cmd_col_font_colour = "#ffffff";
  1256. const char *rest_bg_colour = "#cccccc";
  1257. const char *rest_font_colour = "#000000";
  1258. const char *border_colour = "#000000";
  1259. fprintf(filehandle, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n");
  1260. fprintf(filehandle, "<HTML>\n");
  1261. fprintf(filehandle, "<HEAD>\n");
  1262. fprintf(filehandle, "\t<META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">\n");
  1263. fprintf(filehandle, "\t<TITLE></TITLE>\n");
  1264. fprintf(filehandle, "\t<META NAME=\"GENERATOR\" CONTENT=\"%s\">\n", PLUGIN_VERSION);
  1265. fprintf(filehandle, "\t<META NAME=\"AUTHOR\" CONTENT=\"Mani\">\n");
  1266. fprintf(filehandle, "</HEAD>\n");
  1267. fprintf(filehandle, "<BODY LANG=\"en-GB\" DIR=\"LTR\">\n");
  1268. fprintf(filehandle, "<P ALIGN=CENTER STYLE=\"page-break-before: always\"><FONT SIZE=4 STYLE=\"font-size: 16pt\"><B>Mani Admin Plugin Commands %s</B></FONT></P>\n", PLUGIN_VERSION_ID2);
  1269. fprintf(filehandle, "<TABLE WIDTH=100%% BORDER=1 BORDERCOLOR=\"%s\" CELLPADDING=4 CELLSPACING=0>\n", border_colour);
  1270. fprintf(filehandle, "\t<COL WIDTH=43*>\n");
  1271. fprintf(filehandle, "\t<COL WIDTH=61*>\n");
  1272. fprintf(filehandle, "\t<COL WIDTH=60*>\n");
  1273. fprintf(filehandle, "\t<COL WIDTH=19*>\n");
  1274. fprintf(filehandle, "\t<COL WIDTH=19*>\n");
  1275. fprintf(filehandle, "\t<COL WIDTH=18*>\n");
  1276. fprintf(filehandle, "\t<COL WIDTH=18*>\n");
  1277. fprintf(filehandle, "\t<COL WIDTH=18*>\n");
  1278. fprintf(filehandle, "\t<TR VALIGN=TOP>\n");
  1279. fprintf(filehandle, "\t\t<TH WIDTH=17%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1280. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1281. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML(Translate(NULL, 3065)));
  1282. fprintf(filehandle, "\t\t</TH>\n");
  1283. fprintf(filehandle, "\t\t<TH WIDTH=24%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1284. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1285. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML(Translate(NULL, 3066)));
  1286. fprintf(filehandle, "\t\t</TH>\n");
  1287. fprintf(filehandle, "\t\t\t<TH WIDTH=23%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1288. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1289. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML(Translate(NULL, 3067)));
  1290. fprintf(filehandle, "\t\t</TH>\n");
  1291. fprintf(filehandle, "\t\t<TH WIDTH=8%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1292. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1293. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML(Translate(NULL, 3068)));
  1294. fprintf(filehandle, "\t\t</TH>\n");
  1295. fprintf(filehandle, "\t\t<TH WIDTH=7%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1296. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1297. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML(Translate(NULL, 3069)));
  1298. fprintf(filehandle, "\t\t</TH>\n");
  1299. fprintf(filehandle, "\t\t<TH WIDTH=7%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1300. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1301. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML(Translate(NULL, 3070)));
  1302. fprintf(filehandle, "\t\t</TH>\n");
  1303. fprintf(filehandle, "\t\t<TH WIDTH=7%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1304. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1305. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML(Translate(NULL, 3071)));
  1306. fprintf(filehandle, "\t\t</TH>\n");
  1307. fprintf(filehandle, "\t\t<TH WIDTH=7%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1308. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1309. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML(Translate(NULL, 3072)));
  1310. fprintf(filehandle, "\t\t</TH>\n");
  1311. fprintf(filehandle, "\t</TR>\n");
  1312. for (int i = 0; i < cmd_list_size; i ++)
  1313. {
  1314. fprintf(filehandle, "\t<TR VALIGN=TOP>\n");
  1315. fprintf(filehandle, "\t\t<TD WIDTH=17%% BGCOLOR=\"%s\">\n", cmd_col_bg_colour);
  1316. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1317. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", cmd_col_font_colour, cmd_list[i].cmd_name);
  1318. fprintf(filehandle, "\t\t</TD>\n");
  1319. fprintf(filehandle, "\t\t<TD WIDTH=24%% BGCOLOR=\"%s\">\n", rest_bg_colour);
  1320. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1321. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n",
  1322. rest_font_colour,
  1323. ((cmd_list[i].help_id != 0) ? AsciiToHTML(Translate(NULL, cmd_list[i].help_id + 1)):Translate(NULL, 3073)));
  1324. fprintf(filehandle, "\t\t</TD>\n");
  1325. fprintf(filehandle, "\t\t<TD WIDTH=23%% BGCOLOR=\"%s\">\n", rest_bg_colour);
  1326. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1327. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n",
  1328. rest_font_colour,
  1329. ((cmd_list[i].help_id != 0) ? AsciiToHTML(Translate(NULL, cmd_list[i].help_id)):"-"));
  1330. fprintf(filehandle, "\t\t</TD>\n");
  1331. fprintf(filehandle, "\t\t<TD WIDTH=8%% BGCOLOR=\"%s\">\n", rest_bg_colour);
  1332. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1333. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n",
  1334. rest_font_colour,
  1335. (cmd_list[i].say_command) ? "X":".");
  1336. fprintf(filehandle, "\t\t</TD>\n");
  1337. fprintf(filehandle, "\t\t<TD WIDTH=7%% BGCOLOR=\"%s\">\n", rest_bg_colour);
  1338. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1339. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n",
  1340. rest_font_colour,
  1341. (cmd_list[i].tsay_command) ? "X":".");
  1342. fprintf(filehandle, "\t\t</TD>\n");
  1343. fprintf(filehandle, "\t\t<TD WIDTH=7%% BGCOLOR=\"%s\">\n", rest_bg_colour);
  1344. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1345. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n",
  1346. rest_font_colour,
  1347. (cmd_list[i].client_command) ? "X":".");
  1348. fprintf(filehandle, "\t\t</TD>\n");
  1349. fprintf(filehandle, "\t\t<TD WIDTH=7%% BGCOLOR=\"%s\">\n", rest_bg_colour);
  1350. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1351. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n",
  1352. rest_font_colour,
  1353. (cmd_list[i].server_command) ? "X":".");
  1354. fprintf(filehandle, "\t\t</TD>\n");
  1355. fprintf(filehandle, "\t\t<TD WIDTH=7%% BGCOLOR=\"%s\">\n", rest_bg_colour);
  1356. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1357. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n",
  1358. rest_font_colour,
  1359. (cmd_list[i].war_mode_allowed) ? "X":".");
  1360. fprintf(filehandle, "\t\t</TD>\n");
  1361. fprintf(filehandle, "\t</TR>\n");
  1362. }
  1363. fprintf(filehandle, "</TABLE>\n<P><BR><BR>\n</P>\n</BODY>\n</HTML>");
  1364. mf->Close(filehandle);
  1365. delete mf;
  1366. // Write HTML version of convar help
  1367. filehandle = NULL;
  1368. mf = new ManiFile();
  1369. snprintf(filename, sizeof(filename), "./cfg/%s/data/cvar_help.html", mani_path.GetString());
  1370. filehandle = mf->Open(filename, "wt");
  1371. if (filehandle == NULL)
  1372. {
  1373. delete mf;
  1374. return;
  1375. }
  1376. /* const char *header_row_bg_colour = "#000080";
  1377. const char *header_row_font_colour = "#ffffff";
  1378. const char *cmd_col_bg_colour = "#4d4d4d";
  1379. const char *cmd_col_font_colour = "#ffffff";
  1380. const char *rest_bg_colour = "#cccccc";
  1381. const char *rest_font_colour = "#000000";
  1382. const char *border_colour = "#000000";*/
  1383. fprintf(filehandle, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n");
  1384. fprintf(filehandle, "<HTML>\n");
  1385. fprintf(filehandle, "<HEAD>\n");
  1386. fprintf(filehandle, "\t<META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">\n");
  1387. fprintf(filehandle, "\t<TITLE></TITLE>\n");
  1388. fprintf(filehandle, "\t<META NAME=\"GENERATOR\" CONTENT=\"%s\">\n", PLUGIN_VERSION);
  1389. fprintf(filehandle, "\t<META NAME=\"AUTHOR\" CONTENT=\"Mani\">\n");
  1390. fprintf(filehandle, "</HEAD>\n");
  1391. fprintf(filehandle, "<BODY LANG=\"en-GB\" DIR=\"LTR\">\n");
  1392. fprintf(filehandle, "<P ALIGN=CENTER STYLE=\"page-break-before: always\"><FONT SIZE=4 STYLE=\"font-size: 16pt\"><B>Mani Admin Plugin CVar List %s</B></FONT></P>\n", PLUGIN_VERSION_ID2);
  1393. fprintf(filehandle, "<TABLE WIDTH=100%% BORDER=1 BORDERCOLOR=\"%s\" CELLPADDING=4 CELLSPACING=0>\n", border_colour);
  1394. fprintf(filehandle, "\t<COL WIDTH=43*>\n");
  1395. fprintf(filehandle, "\t<COL WIDTH=61*>\n");
  1396. fprintf(filehandle, "\t<COL WIDTH=60*>\n");
  1397. fprintf(filehandle, "\t<TR VALIGN=TOP>\n");
  1398. fprintf(filehandle, "\t\t<TH WIDTH=17%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1399. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1400. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML("ConVar name"));
  1401. fprintf(filehandle, "\t\t</TH>\n");
  1402. fprintf(filehandle, "\t\t<TH WIDTH=24%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1403. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1404. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML("Description"));
  1405. fprintf(filehandle, "\t\t</TH>\n");
  1406. fprintf(filehandle, "\t\t\t<TH WIDTH=23%% BGCOLOR=\"%s\">\n", header_row_bg_colour);
  1407. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1408. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", header_row_font_colour, AsciiToHTML("Default Value"));
  1409. fprintf(filehandle, "\t\t</TH>\n");
  1410. fprintf(filehandle, "\t</TR>\n");
  1411. ConCommandBase *pPtr = NULL;
  1412. #if defined (GAME_CSGO)
  1413. ICvar::Iterator *iter = new ICvar::Iterator(g_pCVar);
  1414. if (iter)
  1415. {
  1416. iter->SetFirst();
  1417. pPtr = iter->Get();
  1418. }
  1419. #else
  1420. pPtr = g_pCVar->GetCommands();
  1421. #endif
  1422. while (pPtr)
  1423. {
  1424. if (!pPtr->IsCommand())
  1425. {
  1426. const char *name = pPtr->GetName();
  1427. if (NULL != Q_stristr(name, "mani_"))
  1428. {
  1429. // Found mani cvar
  1430. ConVar *mani_var = g_pCVar->FindVar(name);
  1431. fprintf(filehandle, "\t<TR VALIGN=TOP>\n");
  1432. fprintf(filehandle, "\t\t<TD WIDTH=17%% BGCOLOR=\"%s\">\n", cmd_col_bg_colour);
  1433. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1434. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n", cmd_col_font_colour, name);
  1435. fprintf(filehandle, "\t\t</TD>\n");
  1436. fprintf(filehandle, "\t\t<TD WIDTH=24%% BGCOLOR=\"%s\">\n", rest_bg_colour);
  1437. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1438. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n",
  1439. rest_font_colour, AsciiToHTML((char *) mani_var->GetHelpText()));
  1440. fprintf(filehandle, "\t\t</TD>\n");
  1441. fprintf(filehandle, "\t\t<TD WIDTH=23%% BGCOLOR=\"%s\">\n", rest_bg_colour);
  1442. fprintf(filehandle, "\t\t\t<P ALIGN=LEFT STYLE=\"font-style: normal; font-weight: medium; text-decoration: none\">\n");
  1443. fprintf(filehandle, "\t\t\t<FONT COLOR=\"%s\"><FONT FACE=\"Times New Roman, serif\"><FONT SIZE=2>%s</FONT></FONT></FONT></P>\n",
  1444. rest_font_colour, mani_var->GetDefault());
  1445. fprintf(filehandle, "\t\t</TD>\n");
  1446. fprintf(filehandle, "\t</TR>\n");
  1447. }
  1448. }
  1449. #if defined ( GAME_CSGO )
  1450. iter->Next();
  1451. if (!iter->IsValid()) break;
  1452. pPtr = iter->Get();
  1453. #else
  1454. pPtr = const_cast<ConCommandBase*>(pPtr->GetNext());
  1455. #endif
  1456. }
  1457. fprintf(filehandle, "</TABLE>\n<P><BR><BR>\n</P>\n</BODY>\n</HTML>");
  1458. mf->Close(filehandle);
  1459. delete mf;
  1460. }
  1461. // Non-class called version
  1462. #define CON_BODY(_func) \
  1463. int ManiCommands::_func(player_t *player_ptr, const char *name, const int help_id, int command_type, bool war_mode_allowed) \
  1464. { \
  1465. if (war_mode && !war_mode_allowed) return PLUGIN_CONTINUE; \
  1466. return g_Cmd.BadAdmin((int) Process##_func (player_ptr, name, help_id, command_type), player_ptr, name); \
  1467. }
  1468. // Class called version
  1469. #define CON_CBODY(_class, _func) \
  1470. int ManiCommands::_func(player_t *player_ptr, const char *name, const int help_id, int command_type, bool war_mode_allowed) \
  1471. { \
  1472. if (war_mode && !war_mode_allowed) return PLUGIN_CONTINUE; \
  1473. return g_Cmd.BadAdmin(_class->Process##_func (player_ptr, name, help_id, command_type), player_ptr, name); \
  1474. }
  1475. CON_CBODY(gpManiMessageMode, MaSay)
  1476. CON_CBODY(gpManiMessageMode, MaMSay)
  1477. CON_CBODY(gpManiMessageMode, MaPSay)
  1478. CON_CBODY(gpManiMessageMode, MaPMess)
  1479. CON_CBODY(gpManiMessageMode, MaExit)
  1480. CON_CBODY(gpManiMessageMode, MaChat)
  1481. CON_CBODY(gpManiMessageMode, MaCSay)
  1482. CON_CBODY(gpManiStats, MaSession)
  1483. CON_CBODY(gpManiStats, MaStatsMe)
  1484. CON_CBODY(gpManiAdminPlugin, MaRCon)
  1485. CON_CBODY(gpManiAdminPlugin, MaBrowse)
  1486. CON_CBODY(gpManiAdminPlugin, MaCExec)
  1487. CON_CBODY(gpManiAdminPlugin, MaCExecT)
  1488. CON_CBODY(gpManiAdminPlugin, MaCExecCT)
  1489. CON_CBODY(gpManiAdminPlugin, MaCExecAll)
  1490. CON_CBODY(gpManiAdminPlugin, MaCExecSpec)
  1491. CON_CBODY(gpManiAdminPlugin, MaSlap)
  1492. CON_CBODY(gpManiClient, MaSetFlag)
  1493. CON_BODY(MaSetSkin)
  1494. CON_CBODY(gpManiAdminPlugin, MaSetCash)
  1495. CON_CBODY(gpManiAdminPlugin, MaGiveCash)
  1496. CON_CBODY(gpManiAdminPlugin, MaGiveCashP)
  1497. CON_CBODY(gpManiAdminPlugin, MaTakeCash)
  1498. CON_CBODY(gpManiAdminPlugin, MaTakeCashP)
  1499. CON_CBODY(gpManiAdminPlugin, MaSetHealth)
  1500. CON_CBODY(gpManiAdminPlugin, MaGiveHealth)
  1501. CON_CBODY(gpManiAdminPlugin, MaGiveHealthP)
  1502. CON_CBODY(gpManiAdminPlugin, MaTakeHealth)
  1503. CON_CBODY(gpManiAdminPlugin, MaTakeHealthP)
  1504. CON_CBODY(gpManiAdminPlugin, MaBlind)
  1505. CON_CBODY(gpManiAdminPlugin, MaFreeze)
  1506. CON_CBODY(gpManiAdminPlugin, MaNoClip)
  1507. CON_CBODY(gpManiAdminPlugin, MaBurn)
  1508. CON_CBODY(gpManiAdminPlugin, MaGravity)
  1509. CON_CBODY(gpManiAdminPlugin, MaColour)
  1510. CON_CBODY(gpManiAdminPlugin, MaColourWeapon)
  1511. CON_CBODY(gpManiAdminPlugin, MaRenderMode)
  1512. CON_CBODY(gpManiAdminPlugin, MaRenderFX)
  1513. CON_CBODY(gpManiAdminPlugin, MaGive)
  1514. CON_CBODY(gpManiAdminPlugin, MaGiveAmmo)
  1515. CON_CBODY(gpManiAdminPlugin, MaDrug)
  1516. CON_CBODY(gpManiAdminPlugin, MaDecal)
  1517. CON_CBODY(gpManiAdminPlugin, MaTimeBomb)
  1518. CON_CBODY(gpManiAdminPlugin, MaBeacon)
  1519. CON_CBODY(gpManiAdminPlugin, MaFireBomb)
  1520. CON_CBODY(gpManiAdminPlugin, MaFreezeBomb)
  1521. CON_CBODY(gpManiAdminPlugin, MaMute)
  1522. CON_CBODY(gpManiAdminPlugin, MaTeleport)
  1523. CON_CBODY(gpManiAdminPlugin, MaPosition)
  1524. CON_CBODY(gpManiTeam, MaSwapTeam)
  1525. CON_CBODY(gpManiTeam, MaSwapTeamD)
  1526. CON_CBODY(gpManiTeam, MaSpec)
  1527. CON_CBODY(gpManiTeam, MaBalance)
  1528. CON_CBODY(gpManiAdminPlugin, MaDropC4)
  1529. CON_CBODY(gpManiAdminPlugin, MaSaveLoc)
  1530. CON_CBODY(gpManiStats, MaResetRank)
  1531. CON_CBODY(gpManiStats, MaRanks)
  1532. CON_CBODY(gpManiStats, MaPLRanks)
  1533. CON_BODY(MaMap)
  1534. CON_BODY(MaSkipMap)
  1535. CON_BODY(MaNextMap)
  1536. CON_BODY(MaListMaps)
  1537. CON_BODY(MaMapList)
  1538. CON_BODY(MaMapHistory)
  1539. CON_BODY(MaMapCycle)
  1540. CON_BODY(MaVoteMapList)
  1541. CON_CBODY(gpManiAdminPlugin, MaWar)
  1542. CON_BODY(MaSetNextMap)
  1543. CON_CBODY(gpManiVote, MaVoteRandom)
  1544. CON_CBODY(gpManiVote, MaVoteExtend)
  1545. CON_CBODY(gpManiVote, MaVoteRCon)
  1546. CON_CBODY(gpManiVote, MaVote)
  1547. CON_CBODY(gpManiVote, MaVoteQuestion)
  1548. CON_CBODY(gpManiVote, MaVoteCancel)
  1549. CON_BODY(MaPlaySound)
  1550. CON_BODY(MaFavourites)
  1551. CON_CBODY(gpManiWeaponMgr, MaShowRestrict)
  1552. CON_CBODY(gpManiWeaponMgr, MaRestrict)
  1553. CON_CBODY(gpManiWeaponMgr, MaKnives)
  1554. CON_CBODY(gpManiWeaponMgr, MaPistols)
  1555. CON_CBODY(gpManiWeaponMgr, MaShotguns)
  1556. CON_CBODY(gpManiWeaponMgr, MaNoSnipers)
  1557. CON_CBODY(gpManiWeaponMgr, MaUnRestrict)
  1558. CON_CBODY(gpManiWeaponMgr, MaUnRestrictAll)
  1559. CON_CBODY(gpManiWeaponMgr, MaRestrictAll)
  1560. CON_CBODY(gpManiWeaponMgr, MaRestrictRatio)
  1561. CON_BODY(MaTKList)
  1562. CON_CBODY(gpManiAdminPlugin, MaKick)
  1563. CON_CBODY(gpManiChatTriggers, MaChatTriggers)
  1564. CON_CBODY(gpManiSprayRemove, MaSpray)
  1565. CON_CBODY(gpManiAdminPlugin, MaSlay)
  1566. CON_CBODY(gpManiAdminPlugin, MaOffset)
  1567. CON_CBODY(gpManiAdminPlugin, MaOffsetScan)
  1568. CON_CBODY(gpManiAdminPlugin, MaOffsetScanF)
  1569. CON_CBODY(gpManiAdminPlugin, MaTeamIndex)
  1570. CON_CBODY(gpManiClient, MaClient)
  1571. CON_CBODY(gpManiClient, MaClientGroup)
  1572. CON_CBODY(gpManiClient, MaReloadClients)
  1573. CON_CBODY(gpManiAdminPlugin, MaBan)
  1574. CON_CBODY(gpManiAdminPlugin, MaBanIP)
  1575. CON_CBODY(gpManiAdminPlugin, MaUnBan)
  1576. CON_CBODY(gpManiAdminPlugin, MaUsers)
  1577. CON_CBODY(gpManiAdminPlugin, MaAdmins)
  1578. CON_CBODY(gpManiAdminPlugin, MaRates)
  1579. CON_BODY(MaShowSounds)
  1580. CON_CBODY(gpManiAdminPlugin, MaConfig)
  1581. CON_CBODY(gpManiAdminPlugin, MaTimeLeft)
  1582. CON_CBODY(gpManiAutoKickBan, MaAutoBanName)
  1583. CON_CBODY(gpManiAutoKickBan, MaAutoBanPName)
  1584. CON_CBODY(gpManiAutoKickBan, MaAutoKickName)
  1585. CON_CBODY(gpManiAutoKickBan, MaAutoKickPName)
  1586. CON_CBODY(gpManiAutoKickBan, MaAutoKickSteam)
  1587. CON_CBODY(gpManiAutoKickBan, MaAutoKickIP)
  1588. CON_CBODY(gpManiAutoKickBan, MaAutoShowName)
  1589. CON_CBODY(gpManiAutoKickBan, MaAutoShowPName)
  1590. CON_CBODY(gpManiAutoKickBan, MaAutoShowSteam)
  1591. CON_CBODY(gpManiAutoKickBan, MaAutoShowIP)
  1592. CON_CBODY(gpManiAutoKickBan, MaUnAutoName)
  1593. CON_CBODY(gpManiAutoKickBan, MaUnAutoPName)
  1594. CON_CBODY(gpManiAutoKickBan, MaUnAutoSteam)
  1595. CON_CBODY(gpManiAutoKickBan, MaUnAutoIP)
  1596. CON_CBODY(gpManiHelp, MaHelp)
  1597. CON_CBODY(gpManiCustomEffects, MaEffect)
  1598. CON_CBODY(gpManiObserverTrack, MaObserve)
  1599. CON_CBODY(gpManiObserverTrack, MaEndObserve)