3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is not open source and may not be copied without explicit
8 * written permission of AlliedModders LLC. This file may not be redistributed
9 * in whole or significant part.
10 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
15 #include "ConCmdManager.h"
16 #include "sm_srvcmds.h"
17 #include "AdminCache.h"
18 #include "sm_stringutil.h"
19 #include "PlayerManager.h"
20 #include "Translator.h"
22 ConCmdManager g_ConCmds;
24 SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
25 SH_DECL_HOOK1_void(IServerGameClients, SetCommandClient, SH_NOATTRIB, false, int);
33 typedef List<PlCmdInfo> CmdList;
35 void AddToPlCmdList(CmdList *pList, const PlCmdInfo &info);
37 ConCmdManager::ConCmdManager() : m_Strings(1024)
39 m_pCmds = sm_trie_create();
40 m_pCmdGrps = sm_trie_create();
41 m_bServerCfgDone = true;
43 m_pServerCfgFile = NULL;
44 m_pServerCfgFwd = NULL;
48 ConCmdManager::~ConCmdManager()
50 sm_trie_destroy(m_pCmds);
51 sm_trie_destroy(m_pCmdGrps);
54 void ConCmdManager::OnSourceModAllInitialized()
56 g_PluginSys.AddPluginsListener(this);
57 g_RootMenu.AddRootConsoleCommand("cmds", "List console commands", this);
58 SH_ADD_HOOK_MEMFUNC(IServerGameClients, SetCommandClient, serverClients, this, &ConCmdManager::SetCommandClient, false);
60 ConCommandBase *pCmd = icvar->GetCommands();
64 && strcmp(pCmd->GetName(), "exec") == 0)
66 m_pExecCmd = (ConCommand *)pCmd;
69 pCmd = const_cast<ConCommandBase *>(pCmd->GetNext());
74 m_pServerCfgFile = (ConVar *)icvar->FindVar("servercfgfile");
75 SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pExecCmd, this, &ConCmdManager::OnExecCmd, true);
76 m_pServerCfgFwd = g_Forwards.CreateForward("OnServerCfg", ET_Ignore, 0, NULL);
80 void ConCmdManager::OnSourceModShutdown()
84 SH_REMOVE_HOOK_MEMFUNC(ConCommand, Dispatch, m_pExecCmd, this, &ConCmdManager::OnExecCmd, true);
85 g_Forwards.ReleaseForward(m_pServerCfgFwd);
86 m_pServerCfgFwd = NULL;
90 /* All commands should already be removed by the time we're done */
91 SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, SetCommandClient, serverClients, this, &ConCmdManager::SetCommandClient, false);
92 g_RootMenu.RemoveRootConsoleCommand("cmds", this);
95 void ConCmdManager::OnSourceModLevelChange(const char *mapName)
97 m_bServerCfgDone = false;
100 void ConCmdManager::OnExecCmd()
102 const char *arg = engine->Cmd_Argv(1);
103 const char *cfgfile = "server.cfg";
105 if (m_pServerCfgFile)
107 cfgfile = m_pServerCfgFile->GetString();
110 if (strcmp(arg, cfgfile) == 0)
112 engine->ServerCommand("sm cmds internal 1\n");
116 void ConCmdManager::NotifyExecDone(const char *file)
118 if (file == NULL && !m_bServerCfgDone)
120 /* Server-cfg file */
121 m_bServerCfgDone = true;
122 m_pServerCfgFwd->Execute(NULL);
126 void ConCmdManager::RemoveConCmds(List<CmdHook *> &cmdlist, IPluginContext *pContext)
128 List<CmdHook *>::iterator iter = cmdlist.begin();
131 while (iter != cmdlist.end())
134 if (pHook->pf->GetParentContext() == pContext)
136 delete pHook->pAdmin;
138 iter = cmdlist.erase(iter);
145 void ConCmdManager::OnPluginDestroyed(IPlugin *plugin)
148 List<ConCmdInfo *> removed;
149 if (plugin->GetProperty("CommandList", (void **)&pList, true))
151 IPluginContext *pContext = plugin->GetBaseContext();
152 CmdList::iterator iter;
154 * Only bother if there's an actual command list on this plugin...
156 for (iter=pList->begin();
160 PlCmdInfo &cmd = (*iter);
161 ConCmdInfo *pInfo = cmd.pInfo;
163 /* Has this chain already been fully cleaned/removed? */
164 if (removed.find(pInfo) != removed.end())
169 /* Remove any hooks from us on this command */
170 RemoveConCmds(pInfo->conhooks, pContext);
171 RemoveConCmds(pInfo->srvhooks, pContext);
173 /* See if there are still hooks */
174 if (pInfo->srvhooks.size())
178 if (pInfo->conhooks.size())
183 /* Remove the command, it should be safe now */
185 removed.push_back(pInfo);
191 void CommandCallback()
193 g_ConCmds.InternalDispatch();
196 void ConCmdManager::SetCommandClient(int client)
198 m_CmdClient = client + 1;
201 ResultType ConCmdManager::DispatchClientCommand(int client, ResultType type)
203 const char *cmd = engine->Cmd_Argv(0);
204 int args = engine->Cmd_Argc() - 1;
207 if (sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
209 cell_t result = type;
210 cell_t tempres = result;
211 List<CmdHook *>::iterator iter;
213 for (iter=pInfo->conhooks.begin();
214 iter!=pInfo->conhooks.end();
218 if (!pHook->pf->IsRunnable())
222 if (pHook->pAdmin && !CheckAccess(client, cmd, pHook->pAdmin))
224 if (result < Pl_Handled)
230 pHook->pf->PushCell(client);
231 pHook->pf->PushCell(args);
232 if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
234 if (tempres > result)
238 if (result == Pl_Stop)
244 type = (ResultType)result;
250 void ConCmdManager::InternalDispatch()
253 * Note: Console commands will EITHER go through IServerGameDLL::ClientCommand,
254 * OR this dispatch. They will NEVER go through both.
256 * Whether or not it goes through the callback is determined by FCVAR_GAMEDLL
259 const char *cmd = engine->Cmd_Argv(0);
261 if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
266 cell_t result = Pl_Continue;
267 int args = engine->Cmd_Argc() - 1;
269 List<CmdHook *>::iterator iter;
272 /* Execute server-only commands if viable */
273 if (m_CmdClient == 0 && pInfo->srvhooks.size())
275 cell_t tempres = result;
276 for (iter=pInfo->srvhooks.begin();
277 iter!=pInfo->srvhooks.end();
281 if (!pHook->pf->IsRunnable())
285 pHook->pf->PushCell(args);
286 if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
288 if (tempres > result)
292 if (result == Pl_Stop)
299 /* Check if there's an early stop */
300 if (result >= Pl_Stop)
302 if (!pInfo->sourceMod)
304 RETURN_META(MRES_SUPERCEDE);
310 /* Execute console commands */
311 if (pInfo->conhooks.size())
313 cell_t tempres = result;
314 for (iter=pInfo->conhooks.begin();
315 iter!=pInfo->conhooks.end();
319 if (!pHook->pf->IsRunnable())
325 && !CheckAccess(m_CmdClient, cmd, pHook->pAdmin))
327 if (result < Pl_Handled)
333 pHook->pf->PushCell(m_CmdClient);
334 pHook->pf->PushCell(args);
335 if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
337 if (tempres > result)
341 if (result == Pl_Stop)
349 if (result >= Pl_Handled)
351 if (!pInfo->sourceMod)
353 RETURN_META(MRES_SUPERCEDE);
359 bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin)
361 FlagBits cmdflags = pAdmin->eflags;
367 CPlayer *player = g_Players.GetPlayerByIndex(client);
373 AdminId adm = player->GetAdminId();
374 if (adm != INVALID_ADMIN_ID)
376 FlagBits bits = g_Admins.GetAdminFlags(adm, Access_Effective);
378 /* root knows all, WHOA */
379 if ((bits & ADMFLAG_ROOT) == ADMFLAG_ROOT)
384 /* See if our other flags match */
385 if ((bits & cmdflags) == cmdflags)
390 /* Check for overrides */
391 unsigned int groups = g_Admins.GetAdminGroupCount(adm);
394 bool override = false;
395 for (unsigned int i=0; i<groups; i++)
397 gid = g_Admins.GetAdminGroup(adm, i, NULL);
398 /* First get group-level override */
399 override = g_Admins.GetGroupCommandOverride(gid, cmd, Override_CommandGroup, &rule);
400 /* Now get the specific command override */
401 if (g_Admins.GetGroupCommandOverride(gid, cmd, Override_Command, &rule))
407 if (rule == Command_Allow)
410 } else if (rule == Command_Deny) {
417 if (player->IsFakeClient()
418 || player->GetEdict() == NULL)
423 /* If we got here, the command failed... */
425 if (g_Translator.CoreTrans(client, buffer, sizeof(buffer), "No Access", NULL, NULL)
428 snprintf(buffer, sizeof(buffer), "You do not have access to this command");
431 char fullbuffer[192];
432 snprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.\n", buffer);
434 engine->ClientPrintf(player->GetEdict(), fullbuffer);
439 bool ConCmdManager::AddConsoleCommand(IPluginFunction *pFunction,
441 const char *description,
444 ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
451 CmdHook *pHook = new CmdHook();
453 pHook->pf = pFunction;
454 if (description && description[0])
456 pHook->helptext.assign(description);
458 pInfo->conhooks.push_back(pHook);
460 /* Add to the plugin */
462 IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
463 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
465 pList = new CmdList();
466 pPlugin->SetProperty("CommandList", pList);
470 info.type = Cmd_Console;
472 AddToPlCmdList(pList, info);
477 bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
481 const char *description,
484 ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
491 CmdHook *pHook = new CmdHook();
492 AdminCmdInfo *pAdmin = new AdminCmdInfo();
494 pHook->pf = pFunction;
495 if (description && description[0])
497 pHook->helptext.assign(description);
499 pHook->pAdmin = pAdmin;
503 if (!sm_trie_retrieve(m_pCmdGrps, group, (void **)&object))
505 grpid = m_Strings.AddString(group);
506 sm_trie_insert(m_pCmdGrps, group, (void *)grpid);
511 pAdmin->cmdGrpId = grpid;
512 pAdmin->flags = adminflags;
514 /* First get the command group override, if any */
515 bool override = g_Admins.GetCommandOverride(group,
516 Override_CommandGroup,
519 /* Next get the command override, if any */
520 if (g_Admins.GetCommandOverride(name,
527 /* Assign normal flags if there were no overrides */
530 pAdmin->eflags = pAdmin->flags;
533 /* Finally, add the hook */
534 pInfo->conhooks.push_back(pHook);
536 /* Now add to the plugin */
538 IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
539 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
541 pList = new CmdList();
542 pPlugin->SetProperty("CommandList", pList);
546 info.type = Cmd_Admin;
548 AddToPlCmdList(pList, info);
553 bool ConCmdManager::AddServerCommand(IPluginFunction *pFunction,
555 const char *description,
559 ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
566 CmdHook *pHook = new CmdHook();
568 pHook->pf = pFunction;
569 if (description && description[0])
571 pHook->helptext.assign(description);
574 pInfo->srvhooks.push_back(pHook);
576 /* Add to the plugin */
578 IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
579 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
581 pList = new CmdList();
582 pPlugin->SetProperty("CommandList", pList);
586 info.type = Cmd_Server;
588 AddToPlCmdList(pList, info);
593 void AddToPlCmdList(CmdList *pList, const PlCmdInfo &info)
595 CmdList::iterator iter = pList->begin();
596 bool inserted = false;
597 const char *orig = NULL;
599 orig = info.pInfo->pCmd->GetName();
601 /* Insert this into the help list, SORTED alphabetically. */
602 while (iter != pList->end())
604 PlCmdInfo &obj = (*iter);
605 const char *cmd = obj.pInfo->pCmd->GetName();
606 if (strcmp(orig, cmd) < 0)
608 pList->insert(iter, info);
617 pList->push_back(info);
621 void ConCmdManager::AddToCmdList(ConCmdInfo *info)
623 List<ConCmdInfo *>::iterator iter = m_CmdList.begin();
625 bool inserted = false;
626 const char *orig = NULL;
628 orig = info->pCmd->GetName();
630 /* Insert this into the help list, SORTED alphabetically. */
631 while (iter != m_CmdList.end())
633 const char *cmd = NULL;
635 cmd = pInfo->pCmd->GetName();
636 if (strcmp(orig, cmd) < 0)
638 m_CmdList.insert(iter, info);
647 m_CmdList.push_back(info);
651 void ConCmdManager::UpdateAdminCmdFlags(const char *cmd, OverrideType type, FlagBits bits)
655 if (type == Override_Command)
657 if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
662 List<CmdHook *>::iterator iter;
665 for (iter=pInfo->conhooks.begin(); iter!=pInfo->conhooks.end(); iter++)
672 pHook->pAdmin->eflags = bits;
674 pHook->pAdmin->eflags = pHook->pAdmin->flags;
678 } else if (type == Override_CommandGroup) {
680 if (!sm_trie_retrieve(m_pCmdGrps, cmd, &object))
684 int grpid = (int)object;
686 /* This is bad :( loop through all commands */
687 List<ConCmdInfo *>::iterator iter;
689 for (iter=m_CmdList.begin(); iter!=m_CmdList.end(); iter++)
692 for (List<CmdHook *>::iterator citer=pInfo->conhooks.begin();
693 citer!=pInfo->conhooks.end();
697 if (pHook->pAdmin && pHook->pAdmin->cmdGrpId == grpid)
701 pHook->pAdmin->eflags = bits;
703 pHook->pAdmin->eflags = pHook->pAdmin->flags;
711 void ConCmdManager::RemoveConCmd(ConCmdInfo *info)
713 /* Remove console-specific information
714 * This should always be true as of right now
718 /* Remove from the trie */
719 sm_trie_delete(m_pCmds, info->pCmd->GetName());
723 /* Unlink from SourceMM */
724 g_SMAPI->UnregisterConCmdBase(g_PLAPI, info->pCmd);
725 /* Delete the command's memory */
726 char *new_help = const_cast<char *>(info->pCmd->GetHelpText());
727 char *new_name = const_cast<char *>(info->pCmd->GetName());
732 /* Remove the external hook */
733 SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, info->pCmd, CommandCallback, false);
737 /* Remove from list */
738 m_CmdList.remove(info);
743 ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *description, int flags)
746 if (!sm_trie_retrieve(m_pCmds, name, (void **)&pInfo))
748 pInfo = new ConCmdInfo();
749 /* Find the commandopan */
750 ConCommandBase *pBase = icvar->GetCommands();
751 ConCommand *pCmd = NULL;
754 if (strcmp(pBase->GetName(), name) == 0)
756 /* Don't want to return convar with same name */
757 if (!pBase->IsCommand())
762 pCmd = (ConCommand *)pBase;
765 pBase = const_cast<ConCommandBase *>(pBase->GetNext());
770 /* Note that we have to duplicate because the source might not be
771 * a static string, and these expect static memory.
777 char *new_name = sm_strdup(name);
778 char *new_help = sm_strdup(description);
779 pCmd = new ConCommand(new_name, CommandCallback, new_help, flags);
780 pInfo->sourceMod = true;
782 SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CommandCallback, false);
787 sm_trie_insert(m_pCmds, name, pInfo);
794 void ConCmdManager::OnRootConsoleCommand(const char *command, unsigned int argcount)
798 const char *text = engine->Cmd_Argv(2);
800 if (strcmp(text, "internal") == 0)
802 const char *num = engine->Cmd_Argv(3);
805 NotifyExecDone(NULL);
811 CPlugin *pPlugin = g_PluginSys.GetPluginByOrder(id);
815 g_RootMenu.ConsolePrint("[SM] Plugin index %d not found.", id);
819 const sm_plugininfo_t *plinfo = pPlugin->GetPublicInfo();
820 const char *plname = IS_STR_FILLED(plinfo->name) ? plinfo->name : pPlugin->GetFilename();
823 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
825 g_RootMenu.ConsolePrint("[SM] No commands found for: %s", plname);
830 g_RootMenu.ConsolePrint("[SM] No commands found for: %s", plname);
834 CmdList::iterator iter;
835 const char *type = NULL;
838 g_RootMenu.ConsolePrint("[SM] Listing %d commands for: %s", pList->size(), plname);
839 g_RootMenu.ConsolePrint(" %-17.16s %-8.7s %s", "[Name]", "[Type]", "[Help]");
840 for (iter=pList->begin();
844 PlCmdInfo &cmd = (*iter);
845 if (cmd.type == Cmd_Server)
848 } else if (cmd.type == Cmd_Console) {
850 } else if (cmd.type == Cmd_Admin) {
853 name = cmd.pInfo->pCmd->GetName();
854 if (cmd.pHook->helptext.size())
856 help = cmd.pHook->helptext.c_str();
858 help = cmd.pInfo->pCmd->GetHelpText();
860 g_RootMenu.ConsolePrint(" %-17.16s %-12.11s %s", name, type, help);
866 g_RootMenu.ConsolePrint("[SM] Usage: sm cmds <plugin #>");
869 static int g_yam_state = 0;
870 void _YamState(int state)
874 g_RootMenu.ConsolePrint("Welcome to the SourceMod Text Adventure.");
875 g_RootMenu.ConsolePrint("Type sm_text to see the last message.");
876 g_RootMenu.ConsolePrint("Type sm_text <word> to follow a capital word.");
877 g_RootMenu.ConsolePrint("-------------------------------");
878 g_RootMenu.ConsolePrint("You are at VALVE HEADQUARTERS.");
879 g_RootMenu.ConsolePrint("To your LEFT is BAILOPAN, rearranging the letters to spell");
880 g_RootMenu.ConsolePrint("\"A HARD VEAL QUEST\". FORWARD is the entrance to the building.");
881 g_RootMenu.ConsolePrint("To your RIGHT is your last chance to flee in terror.");
882 } else if (state == 1) {
883 g_RootMenu.ConsolePrint("BAILOPAN tells you that his name his pronounced");
884 g_RootMenu.ConsolePrint("\"bye low pahn,\" not \"bay low pan.\" Do you ");
885 g_RootMenu.ConsolePrint("MOCK him, or NOD quietly?");
886 } else if (state == 2) {
887 g_RootMenu.ConsolePrint("You enter the Valve building. You hear screams coming from within.");
888 g_RootMenu.ConsolePrint("A grotesque figure lumbers up to greet you; it is Gabe Newell.");
889 g_RootMenu.ConsolePrint("\"Welcome,\" he belches, \"to my lair.\"");
890 g_RootMenu.ConsolePrint("Do you SHAKE Gaben's hand, WALK past him, or OFFER a donut?");
891 } else if (state == 3) {
892 g_RootMenu.ConsolePrint("You walk into the break room. Alfred \"Adolf\" Reynolds and");
893 g_RootMenu.ConsolePrint("Yahn \"Yeti\" Bernier are discussing something (you overhear ");
894 g_RootMenu.ConsolePrint("the phrase \"and next Steam update, here's what we should break\").");
895 g_RootMenu.ConsolePrint("Should you DIE in a fire, REPORT a bug, REQUEST a feature, or ");
896 g_RootMenu.ConsolePrint("SPRAY them with butter?");
901 void _IntExt_CallYams()
903 const char *arg = engine->Cmd_Argv(1);
905 /* should be impossible */
906 if (!arg || arg[0] == '\0')
908 _YamState(g_yam_state);
911 if (g_yam_state == 1)
913 if (strcasecmp(arg, "mock") == 0)
915 g_RootMenu.ConsolePrint("You mock BAILOPAN's pronunciation. In a fit of rage, ");
916 g_RootMenu.ConsolePrint("he sticks an INT 3 call into your chest, rendering you broken.");
917 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
919 } else if (strcasecmp(arg, "nod") == 0) {
920 g_RootMenu.ConsolePrint("You nod quietly, and then slowly back away into the Valve headquarters.");
923 g_RootMenu.ConsolePrint("Commands are MOCK and NOD.");
925 } else if (g_yam_state == 3) {
926 if (strcasecmp(arg, "report") == 0)
928 g_RootMenu.ConsolePrint("You report a bug to Alfred and Yeti. Immediately, both fall asleep.");
929 g_RootMenu.ConsolePrint("You decay in the break room for two years while they sleep.");
930 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
932 } else if (strcasecmp(arg, "request") == 0) {
933 g_RootMenu.ConsolePrint("You request a feature to Alfred and Yeti. They both mutter something");
934 g_RootMenu.ConsolePrint("about it being implemented \"soon.\" Then, by accident, someone sends");
935 g_RootMenu.ConsolePrint("a message over \"Friends.\" The entire building catches fire.");
936 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
938 } else if (strcasecmp(arg, "die") == 0) {
939 g_RootMenu.ConsolePrint("For no reason, you suddenly catch fire. Alfred and Yeti find this");
940 g_RootMenu.ConsolePrint("deeply disturbing, and cover your flaming corpse with Episode 2");
941 g_RootMenu.ConsolePrint("advertisements. Coming soon, with Team Fortress 2, and Portal!");
942 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
944 } else if (strcasecmp(arg, "spray") == 0) {
945 g_RootMenu.ConsolePrint("You spray Alfred and Yeti with butter. Like Jack Thompson to an");
946 g_RootMenu.ConsolePrint("ambulance, Gabe Newell instantly appears and devours them both.");
947 g_RootMenu.ConsolePrint("You run away, just in time, as Gabe Newell explodes, registering ");
948 g_RootMenu.ConsolePrint("a 5.6 earthquake. Outside, world peace is achieved.");
949 g_RootMenu.ConsolePrint("YOU HAVE WON.");
952 } else if (g_yam_state == 2) {
953 if (strcasecmp(arg, "shake") == 0)
955 g_RootMenu.ConsolePrint("You shake Gaben's hand. It is a terrifying and disgusting experience.");
956 g_RootMenu.ConsolePrint("However, you survive, and continue on.");
958 } else if (strcasecmp(arg, "offer") == 0) {
959 g_RootMenu.ConsolePrint("You offer Gabe Newell one (1) donut. With a gleam in his eyes, ");
960 g_RootMenu.ConsolePrint("he picks you up and devours you whole.");
961 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
963 } else if (strcasecmp(arg, "walk") == 0) {
964 g_RootMenu.ConsolePrint("You walk past Gabe Newell. He can't keep up with your pace!");
967 g_RootMenu.ConsolePrint("Commands are SHAKE, OFFER, and WALK.");
969 } else if (g_yam_state == 0) {
970 if (strcasecmp(arg, "left") == 0)
973 } else if (strcasecmp(arg, "right") == 0) {
974 g_RootMenu.ConsolePrint("You run away from the Valve headquarters in sheer terror.");
975 g_RootMenu.ConsolePrint("While running, you smash into an unknown person, who turns out to be your soul mate.");
976 g_RootMenu.ConsolePrint("You marry and raise a family of 3 kids.");
977 g_RootMenu.ConsolePrint("Many years later, you look back, and realize this was your best choice.");
978 g_RootMenu.ConsolePrint("YOU HAVE WON.");
980 } else if (strcasecmp(arg, "forward") == 0) {
982 } else if (arg[0] != '\0') {
983 g_RootMenu.ConsolePrint("Commands are FORWARD, LEFT, and RIGHT.");
988 void _IntExt_EnableYams()
990 static ConCommand *pCmd = NULL;
993 pCmd = new ConCommand("sm_text", _IntExt_CallYams, "Fountain of Yams Adventure Game", FCVAR_GAMEDLL);
994 g_RootMenu.ConsolePrint("Something is now enabled...");
996 g_RootMenu.ConsolePrint("Something is already enabled...");