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)
334 /* On a listen server, sometimes the server host's client index can be set as 0.
335 * So index 1 is passed to the command callback to correct this potential problem.
337 if (m_CmdClient == 0 && !engine->IsDedicatedServer())
339 pHook->pf->PushCell(1);
341 pHook->pf->PushCell(m_CmdClient);
344 pHook->pf->PushCell(args);
345 if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
347 if (tempres > result)
351 if (result == Pl_Stop)
359 if (result >= Pl_Handled)
361 if (!pInfo->sourceMod)
363 RETURN_META(MRES_SUPERCEDE);
369 bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin)
371 FlagBits cmdflags = pAdmin->eflags;
377 /* If running listen server, then client 1 is the server host and should have 'root' access */
378 if (client == 1 && !engine->IsDedicatedServer())
383 CPlayer *player = g_Players.GetPlayerByIndex(client);
389 AdminId adm = player->GetAdminId();
390 if (adm != INVALID_ADMIN_ID)
392 FlagBits bits = g_Admins.GetAdminFlags(adm, Access_Effective);
394 /* root knows all, WHOA */
395 if ((bits & ADMFLAG_ROOT) == ADMFLAG_ROOT)
400 /* See if our other flags match */
401 if ((bits & cmdflags) == cmdflags)
406 /* Check for overrides */
407 unsigned int groups = g_Admins.GetAdminGroupCount(adm);
410 bool override = false;
411 for (unsigned int i=0; i<groups; i++)
413 gid = g_Admins.GetAdminGroup(adm, i, NULL);
414 /* First get group-level override */
415 override = g_Admins.GetGroupCommandOverride(gid, cmd, Override_CommandGroup, &rule);
416 /* Now get the specific command override */
417 if (g_Admins.GetGroupCommandOverride(gid, cmd, Override_Command, &rule))
423 if (rule == Command_Allow)
426 } else if (rule == Command_Deny) {
433 if (player->IsFakeClient()
434 || player->GetEdict() == NULL)
439 /* If we got here, the command failed... */
441 if (g_Translator.CoreTrans(client, buffer, sizeof(buffer), "No Access", NULL, NULL)
444 snprintf(buffer, sizeof(buffer), "You do not have access to this command");
447 char fullbuffer[192];
448 snprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.\n", buffer);
450 engine->ClientPrintf(player->GetEdict(), fullbuffer);
455 bool ConCmdManager::AddConsoleCommand(IPluginFunction *pFunction,
457 const char *description,
460 ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
467 CmdHook *pHook = new CmdHook();
469 pHook->pf = pFunction;
470 if (description && description[0])
472 pHook->helptext.assign(description);
474 pInfo->conhooks.push_back(pHook);
476 /* Add to the plugin */
478 IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
479 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
481 pList = new CmdList();
482 pPlugin->SetProperty("CommandList", pList);
486 info.type = Cmd_Console;
488 AddToPlCmdList(pList, info);
493 bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
497 const char *description,
500 ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
507 CmdHook *pHook = new CmdHook();
508 AdminCmdInfo *pAdmin = new AdminCmdInfo();
510 pHook->pf = pFunction;
511 if (description && description[0])
513 pHook->helptext.assign(description);
515 pHook->pAdmin = pAdmin;
519 if (!sm_trie_retrieve(m_pCmdGrps, group, (void **)&object))
521 grpid = m_Strings.AddString(group);
522 sm_trie_insert(m_pCmdGrps, group, (void *)grpid);
527 pAdmin->cmdGrpId = grpid;
528 pAdmin->flags = adminflags;
530 /* First get the command group override, if any */
531 bool override = g_Admins.GetCommandOverride(group,
532 Override_CommandGroup,
535 /* Next get the command override, if any */
536 if (g_Admins.GetCommandOverride(name,
543 /* Assign normal flags if there were no overrides */
546 pAdmin->eflags = pAdmin->flags;
549 /* Finally, add the hook */
550 pInfo->conhooks.push_back(pHook);
552 /* Now add to the plugin */
554 IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
555 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
557 pList = new CmdList();
558 pPlugin->SetProperty("CommandList", pList);
562 info.type = Cmd_Admin;
564 AddToPlCmdList(pList, info);
569 bool ConCmdManager::AddServerCommand(IPluginFunction *pFunction,
571 const char *description,
575 ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
582 CmdHook *pHook = new CmdHook();
584 pHook->pf = pFunction;
585 if (description && description[0])
587 pHook->helptext.assign(description);
590 pInfo->srvhooks.push_back(pHook);
592 /* Add to the plugin */
594 IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
595 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
597 pList = new CmdList();
598 pPlugin->SetProperty("CommandList", pList);
602 info.type = Cmd_Server;
604 AddToPlCmdList(pList, info);
609 void AddToPlCmdList(CmdList *pList, const PlCmdInfo &info)
611 CmdList::iterator iter = pList->begin();
612 bool inserted = false;
613 const char *orig = NULL;
615 orig = info.pInfo->pCmd->GetName();
617 /* Insert this into the help list, SORTED alphabetically. */
618 while (iter != pList->end())
620 PlCmdInfo &obj = (*iter);
621 const char *cmd = obj.pInfo->pCmd->GetName();
622 if (strcmp(orig, cmd) < 0)
624 pList->insert(iter, info);
633 pList->push_back(info);
637 void ConCmdManager::AddToCmdList(ConCmdInfo *info)
639 List<ConCmdInfo *>::iterator iter = m_CmdList.begin();
641 bool inserted = false;
642 const char *orig = NULL;
644 orig = info->pCmd->GetName();
646 /* Insert this into the help list, SORTED alphabetically. */
647 while (iter != m_CmdList.end())
649 const char *cmd = NULL;
651 cmd = pInfo->pCmd->GetName();
652 if (strcmp(orig, cmd) < 0)
654 m_CmdList.insert(iter, info);
663 m_CmdList.push_back(info);
667 void ConCmdManager::UpdateAdminCmdFlags(const char *cmd, OverrideType type, FlagBits bits)
671 if (type == Override_Command)
673 if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
678 List<CmdHook *>::iterator iter;
681 for (iter=pInfo->conhooks.begin(); iter!=pInfo->conhooks.end(); iter++)
688 pHook->pAdmin->eflags = bits;
690 pHook->pAdmin->eflags = pHook->pAdmin->flags;
694 } else if (type == Override_CommandGroup) {
696 if (!sm_trie_retrieve(m_pCmdGrps, cmd, &object))
700 int grpid = (int)object;
702 /* This is bad :( loop through all commands */
703 List<ConCmdInfo *>::iterator iter;
705 for (iter=m_CmdList.begin(); iter!=m_CmdList.end(); iter++)
708 for (List<CmdHook *>::iterator citer=pInfo->conhooks.begin();
709 citer!=pInfo->conhooks.end();
713 if (pHook->pAdmin && pHook->pAdmin->cmdGrpId == grpid)
717 pHook->pAdmin->eflags = bits;
719 pHook->pAdmin->eflags = pHook->pAdmin->flags;
727 void ConCmdManager::RemoveConCmd(ConCmdInfo *info)
729 /* Remove console-specific information
730 * This should always be true as of right now
734 /* Remove from the trie */
735 sm_trie_delete(m_pCmds, info->pCmd->GetName());
739 /* Unlink from SourceMM */
740 g_SMAPI->UnregisterConCmdBase(g_PLAPI, info->pCmd);
741 /* Delete the command's memory */
742 char *new_help = const_cast<char *>(info->pCmd->GetHelpText());
743 char *new_name = const_cast<char *>(info->pCmd->GetName());
748 /* Remove the external hook */
749 SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, info->pCmd, CommandCallback, false);
753 /* Remove from list */
754 m_CmdList.remove(info);
759 ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *description, int flags)
762 if (!sm_trie_retrieve(m_pCmds, name, (void **)&pInfo))
764 pInfo = new ConCmdInfo();
765 /* Find the commandopan */
766 ConCommandBase *pBase = icvar->GetCommands();
767 ConCommand *pCmd = NULL;
770 if (strcmp(pBase->GetName(), name) == 0)
772 /* Don't want to return convar with same name */
773 if (!pBase->IsCommand())
778 pCmd = (ConCommand *)pBase;
781 pBase = const_cast<ConCommandBase *>(pBase->GetNext());
786 /* Note that we have to duplicate because the source might not be
787 * a static string, and these expect static memory.
793 char *new_name = sm_strdup(name);
794 char *new_help = sm_strdup(description);
795 pCmd = new ConCommand(new_name, CommandCallback, new_help, flags);
796 pInfo->sourceMod = true;
798 SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CommandCallback, false);
803 sm_trie_insert(m_pCmds, name, pInfo);
810 void ConCmdManager::OnRootConsoleCommand(const char *command, unsigned int argcount)
814 const char *text = engine->Cmd_Argv(2);
816 if (strcmp(text, "internal") == 0)
818 const char *num = engine->Cmd_Argv(3);
821 NotifyExecDone(NULL);
827 CPlugin *pPlugin = g_PluginSys.GetPluginByOrder(id);
831 g_RootMenu.ConsolePrint("[SM] Plugin index %d not found.", id);
835 const sm_plugininfo_t *plinfo = pPlugin->GetPublicInfo();
836 const char *plname = IS_STR_FILLED(plinfo->name) ? plinfo->name : pPlugin->GetFilename();
839 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
841 g_RootMenu.ConsolePrint("[SM] No commands found for: %s", plname);
846 g_RootMenu.ConsolePrint("[SM] No commands found for: %s", plname);
850 CmdList::iterator iter;
851 const char *type = NULL;
854 g_RootMenu.ConsolePrint("[SM] Listing %d commands for: %s", pList->size(), plname);
855 g_RootMenu.ConsolePrint(" %-17.16s %-8.7s %s", "[Name]", "[Type]", "[Help]");
856 for (iter=pList->begin();
860 PlCmdInfo &cmd = (*iter);
861 if (cmd.type == Cmd_Server)
864 } else if (cmd.type == Cmd_Console) {
866 } else if (cmd.type == Cmd_Admin) {
869 name = cmd.pInfo->pCmd->GetName();
870 if (cmd.pHook->helptext.size())
872 help = cmd.pHook->helptext.c_str();
874 help = cmd.pInfo->pCmd->GetHelpText();
876 g_RootMenu.ConsolePrint(" %-17.16s %-12.11s %s", name, type, help);
882 g_RootMenu.ConsolePrint("[SM] Usage: sm cmds <plugin #>");
885 static int g_yam_state = 0;
886 void _YamState(int state)
890 g_RootMenu.ConsolePrint("Welcome to the SourceMod Text Adventure.");
891 g_RootMenu.ConsolePrint("Type sm_text to see the last message.");
892 g_RootMenu.ConsolePrint("Type sm_text <word> to follow a capital word.");
893 g_RootMenu.ConsolePrint("-------------------------------");
894 g_RootMenu.ConsolePrint("You are at VALVE HEADQUARTERS.");
895 g_RootMenu.ConsolePrint("To your LEFT is BAILOPAN, rearranging the letters to spell");
896 g_RootMenu.ConsolePrint("\"A HARD VEAL QUEST\". FORWARD is the entrance to the building.");
897 g_RootMenu.ConsolePrint("To your RIGHT is your last chance to flee in terror.");
898 } else if (state == 1) {
899 g_RootMenu.ConsolePrint("BAILOPAN tells you that his name his pronounced");
900 g_RootMenu.ConsolePrint("\"bye low pahn,\" not \"bay low pan.\" Do you ");
901 g_RootMenu.ConsolePrint("MOCK him, or NOD quietly?");
902 } else if (state == 2) {
903 g_RootMenu.ConsolePrint("You enter the Valve building. You hear screams coming from within.");
904 g_RootMenu.ConsolePrint("A grotesque figure lumbers up to greet you; it is Gabe Newell.");
905 g_RootMenu.ConsolePrint("\"Welcome,\" he belches, \"to my lair.\"");
906 g_RootMenu.ConsolePrint("Do you SHAKE Gaben's hand, WALK past him, or OFFER a donut?");
907 } else if (state == 3) {
908 g_RootMenu.ConsolePrint("You walk into the break room. Alfred \"Adolf\" Reynolds and");
909 g_RootMenu.ConsolePrint("Yahn \"Yeti\" Bernier are discussing something (you overhear ");
910 g_RootMenu.ConsolePrint("the phrase \"and next Steam update, here's what we should break\").");
911 g_RootMenu.ConsolePrint("Should you DIE in a fire, REPORT a bug, REQUEST a feature, or ");
912 g_RootMenu.ConsolePrint("SPRAY them with butter?");
917 void _IntExt_CallYams()
919 const char *arg = engine->Cmd_Argv(1);
921 /* should be impossible */
922 if (!arg || arg[0] == '\0')
924 _YamState(g_yam_state);
927 if (g_yam_state == 1)
929 if (strcasecmp(arg, "mock") == 0)
931 g_RootMenu.ConsolePrint("You mock BAILOPAN's pronunciation. In a fit of rage, ");
932 g_RootMenu.ConsolePrint("he sticks an INT 3 call into your chest, rendering you broken.");
933 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
935 } else if (strcasecmp(arg, "nod") == 0) {
936 g_RootMenu.ConsolePrint("You nod quietly, and then slowly back away into the Valve headquarters.");
939 g_RootMenu.ConsolePrint("Commands are MOCK and NOD.");
941 } else if (g_yam_state == 3) {
942 if (strcasecmp(arg, "report") == 0)
944 g_RootMenu.ConsolePrint("You report a bug to Alfred and Yeti. Immediately, both fall asleep.");
945 g_RootMenu.ConsolePrint("You decay in the break room for two years while they sleep.");
946 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
948 } else if (strcasecmp(arg, "request") == 0) {
949 g_RootMenu.ConsolePrint("You request a feature to Alfred and Yeti. They both mutter something");
950 g_RootMenu.ConsolePrint("about it being implemented \"soon.\" Then, by accident, someone sends");
951 g_RootMenu.ConsolePrint("a message over \"Friends.\" The entire building catches fire.");
952 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
954 } else if (strcasecmp(arg, "die") == 0) {
955 g_RootMenu.ConsolePrint("For no reason, you suddenly catch fire. Alfred and Yeti find this");
956 g_RootMenu.ConsolePrint("deeply disturbing, and cover your flaming corpse with Episode 2");
957 g_RootMenu.ConsolePrint("advertisements. Coming soon, with Team Fortress 2, and Portal!");
958 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
960 } else if (strcasecmp(arg, "spray") == 0) {
961 g_RootMenu.ConsolePrint("You spray Alfred and Yeti with butter. Like Jack Thompson to an");
962 g_RootMenu.ConsolePrint("ambulance, Gabe Newell instantly appears and devours them both.");
963 g_RootMenu.ConsolePrint("You run away, just in time, as Gabe Newell explodes, registering ");
964 g_RootMenu.ConsolePrint("a 5.6 earthquake. Outside, world peace is achieved.");
965 g_RootMenu.ConsolePrint("YOU HAVE WON.");
968 } else if (g_yam_state == 2) {
969 if (strcasecmp(arg, "shake") == 0)
971 g_RootMenu.ConsolePrint("You shake Gaben's hand. It is a terrifying and disgusting experience.");
972 g_RootMenu.ConsolePrint("However, you survive, and continue on.");
974 } else if (strcasecmp(arg, "offer") == 0) {
975 g_RootMenu.ConsolePrint("You offer Gabe Newell one (1) donut. With a gleam in his eyes, ");
976 g_RootMenu.ConsolePrint("he picks you up and devours you whole.");
977 g_RootMenu.ConsolePrint("YOU HAVE DIED. GAME OVER.");
979 } else if (strcasecmp(arg, "walk") == 0) {
980 g_RootMenu.ConsolePrint("You walk past Gabe Newell. He can't keep up with your pace!");
983 g_RootMenu.ConsolePrint("Commands are SHAKE, OFFER, and WALK.");
985 } else if (g_yam_state == 0) {
986 if (strcasecmp(arg, "left") == 0)
989 } else if (strcasecmp(arg, "right") == 0) {
990 g_RootMenu.ConsolePrint("You run away from the Valve headquarters in sheer terror.");
991 g_RootMenu.ConsolePrint("While running, you smash into an unknown person, who turns out to be your soul mate.");
992 g_RootMenu.ConsolePrint("You marry and raise a family of 3 kids.");
993 g_RootMenu.ConsolePrint("Many years later, you look back, and realize this was your best choice.");
994 g_RootMenu.ConsolePrint("YOU HAVE WON.");
996 } else if (strcasecmp(arg, "forward") == 0) {
998 } else if (arg[0] != '\0') {
999 g_RootMenu.ConsolePrint("Commands are FORWARD, LEFT, and RIGHT.");
1004 void _IntExt_EnableYams()
1006 static ConCommand *pCmd = NULL;
1009 pCmd = new ConCommand("sm_text", _IntExt_CallYams, "Fountain of Yams Adventure Game", FCVAR_GAMEDLL);
1010 g_RootMenu.ConsolePrint("Something is now enabled...");
1012 g_RootMenu.ConsolePrint("Something is already enabled...");