MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / OnRootConsoleCommand

Method OnRootConsoleCommand

core/logic/ExtensionSys.cpp:900–1244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

898}
899
900void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command)
901{
902 int argcount = command->ArgC();
903 if (argcount >= 3)
904 {
905 const char *cmd = command->Arg(2);
906 if (strcmp(cmd, "list") == 0)
907 {
908 List<CExtension *>::iterator iter;
909 CExtension *pExt;
910 unsigned int num = 1;
911
912 switch (m_Libs.size())
913 {
914 case 1:
915 {
916 rootmenu->ConsolePrint("[SM] Displaying 1 extension:");
917 break;
918 }
919 case 0:
920 {
921 rootmenu->ConsolePrint("[SM] No extensions are loaded.");
922 break;
923 }
924 default:
925 {
926 rootmenu->ConsolePrint("[SM] Displaying %d extensions:", m_Libs.size());
927 break;
928 }
929 }
930 for (iter = m_Libs.begin(); iter != m_Libs.end(); iter++,num++)
931 {
932 pExt = (*iter);
933 if (pExt->IsLoaded())
934 {
935 char error[255];
936 if (!pExt->IsRunning(error, sizeof(error)))
937 {
938 rootmenu->ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), error);
939 }
940 else
941 {
942 IExtensionInterface *pAPI = pExt->GetAPI();
943 const char *name = pAPI->GetExtensionName();
944 const char *version = pAPI->GetExtensionVerString();
945 const char *descr = pAPI->GetExtensionDescription();
946 rootmenu->ConsolePrint("[%02d] %s (%s): %s", num, name, version, descr);
947 }
948 }
949 else if(pExt->IsRequired() || libsys->PathExists(pExt->GetPath()))
950 {
951 rootmenu->ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str());
952 }
953 else
954 {
955 rootmenu->ConsolePrint("[%02d] <OPTIONAL> file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str());
956 }
957 }

Callers

nothing calls this directly

Calls 15

IsLoadedMethod · 0.80
IsRunningMethod · 0.80
GetAPIMethod · 0.80
IsRequiredMethod · 0.80
PathExistsMethod · 0.80
GetPathMethod · 0.80
GetExtensionVersionMethod · 0.80
IsExternalMethod · 0.80
push_backMethod · 0.80
ReloadMethod · 0.80
DrawGenericOptionMethod · 0.80
ArgCMethod · 0.45

Tested by

no test coverage detected