Return the full list of exts/plugins with "sm exts/plugins" client commands (#1862)

This commit is contained in:
zer0.k 2022-11-25 20:00:48 +01:00 committed by GitHub
parent 34c8220e5d
commit 63f8ea89ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -974,8 +974,6 @@ void ClientConsolePrint(edict_t *e, const char *fmt, ...)
void ListExtensionsToClient(CPlayer *player, const CCommand &args) void ListExtensionsToClient(CPlayer *player, const CCommand &args)
{ {
char buffer[256]; char buffer[256];
unsigned int id = 0;
unsigned int start = 0;
AutoExtensionList extensions(extsys); AutoExtensionList extensions(extsys);
if (!extensions->size()) if (!extensions->size())
@ -984,11 +982,6 @@ void ListExtensionsToClient(CPlayer *player, const CCommand &args)
return; return;
} }
if (args.ArgC() > 2)
{
start = atoi(args.Arg(2));
}
size_t i = 0; size_t i = 0;
for (; i < extensions->size(); i++) for (; i < extensions->size(); i++)
{ {
@ -1000,17 +993,6 @@ void ListExtensionsToClient(CPlayer *player, const CCommand &args)
continue; continue;
} }
id++;
if (id < start)
{
continue;
}
if (id - start > 10)
{
break;
}
IExtensionInterface *api = ext->GetAPI(); IExtensionInterface *api = ext->GetAPI();
const char *name = api->GetExtensionName(); const char *name = api->GetExtensionName();
@ -1035,31 +1017,14 @@ void ListExtensionsToClient(CPlayer *player, const CCommand &args)
len += ke::SafeSprintf(&buffer[len], sizeof(buffer)-len, ": %s", description); len += ke::SafeSprintf(&buffer[len], sizeof(buffer)-len, ": %s", description);
} }
ClientConsolePrint(player->GetEdict(), "%s", buffer); ClientConsolePrint(player->GetEdict(), "%s", buffer);
} }
for (; i < extensions->size(); i++)
{
char error[255];
if (extensions->at(i)->IsRunning(error, sizeof(error)))
{
break;
}
}
if (i < extensions->size())
{
ClientConsolePrint(player->GetEdict(), "To see more, type \"sm exts %d\"", id);
}
} }
void ListPluginsToClient(CPlayer *player, const CCommand &args) void ListPluginsToClient(CPlayer *player, const CCommand &args)
{ {
char buffer[256]; char buffer[256];
unsigned int id = 0;
edict_t *e = player->GetEdict(); edict_t *e = player->GetEdict();
unsigned int start = 0;
AutoPluginList plugins(scripts); AutoPluginList plugins(scripts);
if (!plugins->size()) if (!plugins->size())
@ -1068,11 +1033,6 @@ void ListPluginsToClient(CPlayer *player, const CCommand &args)
return; return;
} }
if (args.ArgC() > 2)
{
start = atoi(args.Arg(2));
}
SourceHook::List<SMPlugin *> m_FailList; SourceHook::List<SMPlugin *> m_FailList;
size_t i = 0; size_t i = 0;
@ -1085,18 +1045,6 @@ void ListPluginsToClient(CPlayer *player, const CCommand &args)
continue; continue;
} }
/* Count valid plugins */
id++;
if (id < start)
{
continue;
}
if (id - start > 10)
{
break;
}
size_t len; size_t len;
const sm_plugininfo_t *info = pl->GetPublicInfo(); const sm_plugininfo_t *info = pl->GetPublicInfo();
len = ke::SafeSprintf(buffer, sizeof(buffer), " \"%s\"", (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename()); len = ke::SafeSprintf(buffer, sizeof(buffer), " \"%s\"", (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
@ -1114,21 +1062,6 @@ void ListPluginsToClient(CPlayer *player, const CCommand &args)
} }
ClientConsolePrint(e, "%s", buffer); ClientConsolePrint(e, "%s", buffer);
} }
/* See if we can get more plugins */
for (; i < plugins->size(); i++)
{
if (plugins->at(i)->GetStatus() == Plugin_Running)
{
break;
}
}
/* Do we actually have more plugins? */
if (i < plugins->size())
{
ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id);
}
} }
#if SOURCE_ENGINE >= SE_ORANGEBOX #if SOURCE_ENGINE >= SE_ORANGEBOX