3 * ================================================================
5 * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
6 * ================================================================
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License,
10 * version 3.0, as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to
21 * link the code of this program (as well as its derivative works) to
22 * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any
23 * Game MODs that run on software by the Valve Corporation. You must
24 * obey the GNU General Public License in all respects for all other
25 * code used. Additionally, AlliedModders LLC grants this exception
26 * to all derivative works. AlliedModders LLC defines further
27 * exceptions, found in LICENSE.txt (as of this writing, version
28 * JULY-31-2007), or <http://www.sourcemod.net/license.php>.
33 #include "ConCmdManager.h"
34 #include "sm_srvcmds.h"
35 #include "AdminCache.h"
36 #include "sm_stringutil.h"
37 #include "PlayerManager.h"
38 #include "Translator.h"
39 #include "HalfLife2.h"
40 #include "ChatTriggers.h"
42 ConCmdManager g_ConCmds;
44 SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
45 SH_DECL_HOOK1_void(IServerGameClients, SetCommandClient, SH_NOATTRIB, false, int);
53 typedef List<PlCmdInfo> CmdList;
55 void AddToPlCmdList(CmdList *pList, const PlCmdInfo &info);
57 ConCmdManager::ConCmdManager() : m_Strings(1024)
59 m_pCmds = sm_trie_create();
60 m_pCmdGrps = sm_trie_create();
64 ConCmdManager::~ConCmdManager()
66 sm_trie_destroy(m_pCmds);
67 sm_trie_destroy(m_pCmdGrps);
70 void ConCmdManager::OnSourceModAllInitialized()
72 g_PluginSys.AddPluginsListener(this);
73 g_RootMenu.AddRootConsoleCommand("cmds", "List console commands", this);
74 SH_ADD_HOOK_MEMFUNC(IServerGameClients, SetCommandClient, serverClients, this, &ConCmdManager::SetCommandClient, false);
77 void ConCmdManager::OnSourceModShutdown()
79 /* All commands should already be removed by the time we're done */
80 SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, SetCommandClient, serverClients, this, &ConCmdManager::SetCommandClient, false);
81 g_RootMenu.RemoveRootConsoleCommand("cmds", this);
84 void ConCmdManager::RemoveConCmds(List<CmdHook *> &cmdlist, IPluginContext *pContext)
86 List<CmdHook *>::iterator iter = cmdlist.begin();
89 while (iter != cmdlist.end())
92 if (pHook->pf->GetParentContext() == pContext)
96 iter = cmdlist.erase(iter);
103 void ConCmdManager::OnPluginDestroyed(IPlugin *plugin)
106 List<ConCmdInfo *> removed;
107 if (plugin->GetProperty("CommandList", (void **)&pList, true))
109 IPluginContext *pContext = plugin->GetBaseContext();
110 CmdList::iterator iter;
112 * Only bother if there's an actual command list on this plugin...
114 for (iter=pList->begin();
118 PlCmdInfo &cmd = (*iter);
119 ConCmdInfo *pInfo = cmd.pInfo;
121 /* Has this chain already been fully cleaned/removed? */
122 if (removed.find(pInfo) != removed.end())
127 /* Remove any hooks from us on this command */
128 RemoveConCmds(pInfo->conhooks, pContext);
129 RemoveConCmds(pInfo->srvhooks, pContext);
131 /* See if there are still hooks */
132 if (pInfo->srvhooks.size())
136 if (pInfo->conhooks.size())
141 /* Remove the command, it should be safe now */
143 removed.push_back(pInfo);
149 void CommandCallback()
151 g_ConCmds.InternalDispatch();
154 void ConCmdManager::SetCommandClient(int client)
156 m_CmdClient = client + 1;
159 ResultType ConCmdManager::DispatchClientCommand(int client, ResultType type)
161 const char *cmd = engine->Cmd_Argv(0);
162 int args = engine->Cmd_Argc() - 1;
165 if (sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
167 cell_t result = type;
168 cell_t tempres = result;
169 List<CmdHook *>::iterator iter;
171 for (iter=pInfo->conhooks.begin();
172 iter!=pInfo->conhooks.end();
176 if (!pHook->pf->IsRunnable())
180 if (pHook->pAdmin && !CheckAccess(client, cmd, pHook->pAdmin))
182 if (result < Pl_Handled)
188 pHook->pf->PushCell(client);
189 pHook->pf->PushCell(args);
190 if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
192 if (tempres > result)
196 if (result == Pl_Stop)
202 type = (ResultType)result;
208 void ConCmdManager::InternalDispatch()
211 * Note: Console commands will EITHER go through IServerGameDLL::ClientCommand,
212 * OR this dispatch. They will NEVER go through both.
214 * Whether or not it goes through the callback is determined by FCVAR_GAMEDLL
217 const char *cmd = engine->Cmd_Argv(0);
219 if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
224 cell_t result = Pl_Continue;
225 int args = engine->Cmd_Argc() - 1;
227 List<CmdHook *>::iterator iter;
230 /* Execute server-only commands if viable */
231 if (m_CmdClient == 0 && pInfo->srvhooks.size())
233 cell_t tempres = result;
234 for (iter=pInfo->srvhooks.begin();
235 iter!=pInfo->srvhooks.end();
239 if (!pHook->pf->IsRunnable())
243 pHook->pf->PushCell(args);
244 if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
246 if (tempres > result)
250 if (result == Pl_Stop)
257 /* Check if there's an early stop */
258 if (result >= Pl_Stop)
260 if (!pInfo->sourceMod)
262 RETURN_META(MRES_SUPERCEDE);
268 /* Execute console commands */
269 if (pInfo->conhooks.size())
271 cell_t tempres = result;
272 for (iter=pInfo->conhooks.begin();
273 iter!=pInfo->conhooks.end();
277 if (!pHook->pf->IsRunnable())
283 && !CheckAccess(m_CmdClient, cmd, pHook->pAdmin))
285 if (result < Pl_Handled)
292 /* On a listen server, sometimes the server host's client index can be set as 0.
293 * So index 1 is passed to the command callback to correct this potential problem.
295 if (m_CmdClient == 0 && !engine->IsDedicatedServer())
297 pHook->pf->PushCell(1);
299 pHook->pf->PushCell(m_CmdClient);
302 pHook->pf->PushCell(args);
303 if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
305 if (tempres > result)
309 if (result == Pl_Stop)
317 if (result >= Pl_Handled)
319 if (!pInfo->sourceMod)
321 RETURN_META(MRES_SUPERCEDE);
327 bool ConCmdManager::CheckCommandAccess(int client, const char *cmd, FlagBits cmdflags)
334 /* If running listen server, then client 1 is the server host and should have 'root' access */
335 if (client == 1 && !engine->IsDedicatedServer())
340 CPlayer *player = g_Players.GetPlayerByIndex(client);
342 || player->GetEdict() == NULL
343 || player->IsFakeClient())
348 AdminId adm = player->GetAdminId();
349 if (adm != INVALID_ADMIN_ID)
351 FlagBits bits = g_Admins.GetAdminFlags(adm, Access_Effective);
353 /* root knows all, WHOA */
354 if ((bits & ADMFLAG_ROOT) == ADMFLAG_ROOT)
359 /* See if our other flags match */
360 if ((bits & cmdflags) == cmdflags)
365 /* Check for overrides */
366 unsigned int groups = g_Admins.GetAdminGroupCount(adm);
369 bool override = false;
370 for (unsigned int i=0; i<groups; i++)
372 gid = g_Admins.GetAdminGroup(adm, i, NULL);
373 /* First get group-level override */
374 override = g_Admins.GetGroupCommandOverride(gid, cmd, Override_CommandGroup, &rule);
375 /* Now get the specific command override */
376 if (g_Admins.GetGroupCommandOverride(gid, cmd, Override_Command, &rule))
382 if (rule == Command_Allow)
385 } else if (rule == Command_Deny) {
395 bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin)
397 if (CheckCommandAccess(client, cmd, pAdmin->eflags))
402 edict_t *pEdict = engine->PEntityOfEntIndex(client);
404 /* If we got here, the command failed... */
406 if (g_Translator.CoreTrans(client, buffer, sizeof(buffer), "No Access", NULL, NULL)
409 snprintf(buffer, sizeof(buffer), "You do not have access to this command");
412 unsigned int replyto = g_ChatTriggers.GetReplyTo();
413 if (replyto == SM_REPLY_CONSOLE)
415 char fullbuffer[192];
416 snprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.\n", buffer);
417 engine->ClientPrintf(pEdict, fullbuffer);
418 } else if (replyto == SM_REPLY_CHAT) {
419 char fullbuffer[192];
420 snprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.", buffer);
421 g_HL2.TextMsg(client, HUD_PRINTTALK, fullbuffer);
427 bool ConCmdManager::AddConsoleCommand(IPluginFunction *pFunction,
429 const char *description,
432 ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
439 CmdHook *pHook = new CmdHook();
441 pHook->pf = pFunction;
442 if (description && description[0])
444 pHook->helptext.assign(description);
446 pInfo->conhooks.push_back(pHook);
448 /* Add to the plugin */
450 IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
451 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
453 pList = new CmdList();
454 pPlugin->SetProperty("CommandList", pList);
458 info.type = Cmd_Console;
460 AddToPlCmdList(pList, info);
465 bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
469 const char *description,
472 ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
479 CmdHook *pHook = new CmdHook();
480 AdminCmdInfo *pAdmin = new AdminCmdInfo();
482 pHook->pf = pFunction;
483 if (description && description[0])
485 pHook->helptext.assign(description);
487 pHook->pAdmin = pAdmin;
491 if (!sm_trie_retrieve(m_pCmdGrps, group, (void **)&object))
493 grpid = m_Strings.AddString(group);
494 sm_trie_insert(m_pCmdGrps, group, (void *)grpid);
499 pAdmin->cmdGrpId = grpid;
500 pAdmin->flags = adminflags;
502 /* First get the command group override, if any */
503 bool override = g_Admins.GetCommandOverride(group,
504 Override_CommandGroup,
507 /* Next get the command override, if any */
508 if (g_Admins.GetCommandOverride(name,
515 /* Assign normal flags if there were no overrides */
518 pAdmin->eflags = pAdmin->flags;
521 /* Finally, add the hook */
522 pInfo->conhooks.push_back(pHook);
523 pInfo->admin = *(pHook->pAdmin);
525 /* Now add to the plugin */
527 IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
528 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
530 pList = new CmdList();
531 pPlugin->SetProperty("CommandList", pList);
535 info.type = Cmd_Admin;
537 AddToPlCmdList(pList, info);
542 bool ConCmdManager::AddServerCommand(IPluginFunction *pFunction,
544 const char *description,
548 ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
555 CmdHook *pHook = new CmdHook();
557 pHook->pf = pFunction;
558 if (description && description[0])
560 pHook->helptext.assign(description);
563 pInfo->srvhooks.push_back(pHook);
565 /* Add to the plugin */
567 IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
568 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
570 pList = new CmdList();
571 pPlugin->SetProperty("CommandList", pList);
575 info.type = Cmd_Server;
577 AddToPlCmdList(pList, info);
582 void AddToPlCmdList(CmdList *pList, const PlCmdInfo &info)
584 CmdList::iterator iter = pList->begin();
585 bool inserted = false;
586 const char *orig = NULL;
588 orig = info.pInfo->pCmd->GetName();
590 /* Insert this into the help list, SORTED alphabetically. */
591 while (iter != pList->end())
593 PlCmdInfo &obj = (*iter);
594 const char *cmd = obj.pInfo->pCmd->GetName();
595 if (strcmp(orig, cmd) < 0)
597 pList->insert(iter, info);
606 pList->push_back(info);
610 void ConCmdManager::AddToCmdList(ConCmdInfo *info)
612 List<ConCmdInfo *>::iterator iter = m_CmdList.begin();
614 bool inserted = false;
615 const char *orig = NULL;
617 orig = info->pCmd->GetName();
619 /* Insert this into the help list, SORTED alphabetically. */
620 while (iter != m_CmdList.end())
622 const char *cmd = NULL;
624 cmd = pInfo->pCmd->GetName();
625 if (strcmp(orig, cmd) < 0)
627 m_CmdList.insert(iter, info);
636 m_CmdList.push_back(info);
640 void ConCmdManager::UpdateAdminCmdFlags(const char *cmd, OverrideType type, FlagBits bits)
644 if (type == Override_Command)
646 if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
651 List<CmdHook *>::iterator iter;
654 for (iter=pInfo->conhooks.begin(); iter!=pInfo->conhooks.end(); iter++)
661 pHook->pAdmin->eflags = bits;
663 pHook->pAdmin->eflags = pHook->pAdmin->flags;
665 pInfo->admin = *(pHook->pAdmin);
668 } else if (type == Override_CommandGroup) {
670 if (!sm_trie_retrieve(m_pCmdGrps, cmd, &object))
674 int grpid = (int)object;
676 /* This is bad :( loop through all commands */
677 List<ConCmdInfo *>::iterator iter;
679 for (iter=m_CmdList.begin(); iter!=m_CmdList.end(); iter++)
682 for (List<CmdHook *>::iterator citer=pInfo->conhooks.begin();
683 citer!=pInfo->conhooks.end();
687 if (pHook->pAdmin && pHook->pAdmin->cmdGrpId == grpid)
691 pHook->pAdmin->eflags = bits;
693 pHook->pAdmin->eflags = pHook->pAdmin->flags;
695 pInfo->admin = *(pHook->pAdmin);
702 void ConCmdManager::RemoveConCmd(ConCmdInfo *info)
704 /* Remove console-specific information
705 * This should always be true as of right now
709 /* Remove from the trie */
710 sm_trie_delete(m_pCmds, info->pCmd->GetName());
714 /* Unlink from SourceMM */
715 g_SMAPI->UnregisterConCmdBase(g_PLAPI, info->pCmd);
716 /* Delete the command's memory */
717 char *new_help = const_cast<char *>(info->pCmd->GetHelpText());
718 char *new_name = const_cast<char *>(info->pCmd->GetName());
723 /* Remove the external hook */
724 SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, info->pCmd, CommandCallback, false);
728 /* Remove from list */
729 m_CmdList.remove(info);
734 bool ConCmdManager::LookForSourceModCommand(const char *cmd)
738 if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
743 return pInfo->sourceMod && (pInfo->conhooks.size() > 0);
746 ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *description, int flags)
749 if (!sm_trie_retrieve(m_pCmds, name, (void **)&pInfo))
751 pInfo = new ConCmdInfo();
752 /* Find the commandopan */
753 ConCommandBase *pBase = icvar->GetCommands();
754 ConCommand *pCmd = NULL;
757 if (strcmp(pBase->GetName(), name) == 0)
759 /* Don't want to return convar with same name */
760 if (!pBase->IsCommand())
765 pCmd = (ConCommand *)pBase;
768 pBase = const_cast<ConCommandBase *>(pBase->GetNext());
773 /* Note that we have to duplicate because the source might not be
774 * a static string, and these expect static memory.
780 char *new_name = sm_strdup(name);
781 char *new_help = sm_strdup(description);
782 pCmd = new ConCommand(new_name, CommandCallback, new_help, flags);
783 pInfo->sourceMod = true;
785 SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CommandCallback, false);
790 sm_trie_insert(m_pCmds, name, pInfo);
797 void ConCmdManager::OnRootConsoleCommand(const char *command, unsigned int argcount)
801 const char *text = engine->Cmd_Argv(2);
804 CPlugin *pPlugin = g_PluginSys.GetPluginByOrder(id);
808 g_RootMenu.ConsolePrint("[SM] Plugin index %d not found.", id);
812 const sm_plugininfo_t *plinfo = pPlugin->GetPublicInfo();
813 const char *plname = IS_STR_FILLED(plinfo->name) ? plinfo->name : pPlugin->GetFilename();
816 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
818 g_RootMenu.ConsolePrint("[SM] No commands found for: %s", plname);
823 g_RootMenu.ConsolePrint("[SM] No commands found for: %s", plname);
827 CmdList::iterator iter;
828 const char *type = NULL;
831 g_RootMenu.ConsolePrint("[SM] Listing %d commands for: %s", pList->size(), plname);
832 g_RootMenu.ConsolePrint(" %-17.16s %-8.7s %s", "[Name]", "[Type]", "[Help]");
833 for (iter=pList->begin();
837 PlCmdInfo &cmd = (*iter);
838 if (cmd.type == Cmd_Server)
841 } else if (cmd.type == Cmd_Console) {
843 } else if (cmd.type == Cmd_Admin) {
846 name = cmd.pInfo->pCmd->GetName();
847 if (cmd.pHook->helptext.size())
849 help = cmd.pHook->helptext.c_str();
851 help = cmd.pInfo->pCmd->GetHelpText();
853 g_RootMenu.ConsolePrint(" %-17.16s %-12.11s %s", name, type, help);
859 g_RootMenu.ConsolePrint("[SM] Usage: sm cmds <plugin #>");
862 static int g_yam_state = 0;
863 void _YamState(int state)
867 g_RootMenu.ConsolePrint("Welcome to the SourceMod Text Adventure.");
868 g_RootMenu.ConsolePrint("Type sm_text to see the last message.");
869 g_RootMenu.ConsolePrint("Type sm_text <word> to follow a capital word.");
870 g_RootMenu.ConsolePrint("-------------------------------");
871 g_RootMenu.ConsolePrint("You are at VALVE HEADQUARTERS.");
872 g_RootMenu.ConsolePrint("To your LEFT is BAILOPAN, rearranging the letters to spell");
873 g_RootMenu.ConsolePrint("\"A HARD VEAL QUEST\". FORWARD is the entrance to the building.");
874 g_RootMenu.ConsolePrint("To your RIGHT is your last chance to flee in terror.");
875 } else if (state == 1) {
876 g_RootMenu.ConsolePrint("BAILOPAN tells you that his name his pronounced");
877 g_RootMenu.ConsolePrint("\"bye low pahn,\" not \"bay low pan.\" Do you ");
878 g_RootMenu.ConsolePrint("MOCK him, or NOD quietly?");
879 } else if (state == 2) {
880 g_RootMenu.ConsolePrint("You enter the Valve building. You hear screams coming from within.");
881 g_RootMenu.ConsolePrint("A grotesque figure lumbers up to greet you; it is Gabe Newell.");
882 g_RootMenu.ConsolePrint("\"Welcome,\" he belches, \"to my lair.\"");
883 g_RootMenu.ConsolePrint("Do you SHAKE Gaben's hand, WALK past him, or OFFER a donut?");
884 } else if (state == 3) {
885 g_RootMenu.ConsolePrint("You walk into the break room. Alfred \"Alf is from Melmac\" Reynolds and");
886 g_RootMenu.ConsolePrint("Yahn \"Yeti\" Bernier are discussing something (you overhear ");
887 g_RootMenu.ConsolePrint("the phrase \"and next Steam update, here's what we should break\").");
888 g_RootMenu.ConsolePrint("Should you DIE in a fire, REPORT a bug, REQUEST a feature, or ");
889 g_RootMenu.ConsolePrint("SPRAY them with butter?");
894 void _IntExt_CallYams()
896 const char *arg = engine->Cmd_Argv(1);
898 /* should be impossible */
899 if (!arg || arg[0] == '\0')
901 _YamState(g_yam_state);
904 if (g_yam_state == 1)
906 if (strcasecmp(arg, "mock") == 0)
908 g_RootMenu.ConsolePrint("You mock BAILOPAN's pronunciation. In a fit of rage, ");
909 g_RootMenu.ConsolePrint("he sticks an INT 3 call into your chest, rendering you broken.");
910 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
912 } else if (strcasecmp(arg, "nod") == 0) {
913 g_RootMenu.ConsolePrint("You nod quietly, and then slowly back away into the Valve headquarters.");
916 g_RootMenu.ConsolePrint("Commands are MOCK and NOD.");
918 } else if (g_yam_state == 3) {
919 if (strcasecmp(arg, "report") == 0)
921 g_RootMenu.ConsolePrint("You report a bug to Alfred and Yeti. Immediately, both fall asleep.");
922 g_RootMenu.ConsolePrint("You decay in the break room for two years while they sleep.");
923 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
925 } else if (strcasecmp(arg, "request") == 0) {
926 g_RootMenu.ConsolePrint("You request a feature to Alfred and Yeti. They both mutter something");
927 g_RootMenu.ConsolePrint("about it being implemented \"soon.\" Then, by accident, someone sends");
928 g_RootMenu.ConsolePrint("a message over \"Friends.\" The entire building catches fire.");
929 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
931 } else if (strcasecmp(arg, "die") == 0) {
932 g_RootMenu.ConsolePrint("For no reason, you suddenly catch fire. Alfred and Yeti find this");
933 g_RootMenu.ConsolePrint("deeply disturbing, and cover your flaming corpse with Episode 2");
934 g_RootMenu.ConsolePrint("advertisements. Coming soon, with Team Fortress 2, and Portal!");
935 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
937 } else if (strcasecmp(arg, "spray") == 0) {
938 g_RootMenu.ConsolePrint("You spray Alfred and Yeti with butter. Like Jack Thompson to an");
939 g_RootMenu.ConsolePrint("ambulance, Gabe Newell instantly appears and devours them both.");
940 g_RootMenu.ConsolePrint("You run away, just in time, as Gabe Newell explodes, registering ");
941 g_RootMenu.ConsolePrint("a 5.6 earthquake. Outside, world peace is achieved.");
942 g_RootMenu.ConsolePrint("YOU HAVE WON.");
945 } else if (g_yam_state == 2) {
946 if (strcasecmp(arg, "shake") == 0)
948 g_RootMenu.ConsolePrint("You shake Gaben's hand. It is a terrifying and disgusting experience.");
949 g_RootMenu.ConsolePrint("However, you survive, and continue on.");
951 } else if (strcasecmp(arg, "offer") == 0) {
952 g_RootMenu.ConsolePrint("You offer Gabe Newell one (1) donut. With a gleam in his eyes, ");
953 g_RootMenu.ConsolePrint("he picks you up and devours you whole.");
954 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
956 } else if (strcasecmp(arg, "walk") == 0) {
957 g_RootMenu.ConsolePrint("You walk past Gabe Newell. He can't keep up with your pace!");
960 g_RootMenu.ConsolePrint("Commands are SHAKE, OFFER, and WALK.");
962 } else if (g_yam_state == 0) {
963 if (strcasecmp(arg, "left") == 0)
966 } else if (strcasecmp(arg, "right") == 0) {
967 g_RootMenu.ConsolePrint("You run away from the Valve headquarters in sheer terror.");
968 g_RootMenu.ConsolePrint("While running, you smash into an unknown person, who turns out to be your soul mate.");
969 g_RootMenu.ConsolePrint("You marry and raise a family of 3 kids.");
970 g_RootMenu.ConsolePrint("Many years later, you look back, and realize this was your best choice.");
971 g_RootMenu.ConsolePrint("YOU HAVE WON.");
973 } else if (strcasecmp(arg, "forward") == 0) {
975 } else if (arg[0] != '\0') {
976 g_RootMenu.ConsolePrint("Commands are FORWARD, LEFT, and RIGHT.");
981 void _IntExt_EnableYams()
983 static ConCommand *pCmd = NULL;
986 pCmd = new ConCommand("sm_text", _IntExt_CallYams, "Fountain of Yams Adventure Game", FCVAR_GAMEDLL);
987 g_RootMenu.ConsolePrint("Something is now enabled...");
989 g_RootMenu.ConsolePrint("Something is already enabled...");