Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beta richochet fork #148

Closed
wants to merge 16 commits into from
107 changes: 107 additions & 0 deletions gamedata/sbp.games.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
"Games"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not going to bundle the adminhelp/bara plugins, way too heavy and overintrusive, sorry

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the best way I found to hide certain plugins with my fork of SBP, but there are more simple things you could do, or just not do this at all.

{
"#default"
{
"Keys"
{
"EngineInterface" "VEngineServer021"
}
"Signatures"
{
"CreateInterface"
{
"library" "engine"
"windows" "@CreateInterface"
"linux" "@CreateInterface"
}
}
"Offsets"
{
"ClientPrintf"
{
"windows" "45"
"linux" "45"
}
}
}

"cstrike"
{
"Keys"
{
"EngineInterface" "VEngineServer023"
}
"Offsets"
{
"ClientPrintf"
{
"windows" "45"
"linux" "45"
}
}
}

"tf"
{
"Keys"
{
"EngineInterface" "VEngineServer023"
}
"Offsets"
{
"ClientPrintf"
{
"windows" "45"
"linux" "45"
}
}
}

"csgo"
{
"Keys"
{
"EngineInterface" "VEngineServer023"
}
"Offsets"
{
"ClientPrintf"
{
"windows" "47"
"linux" "47"
}
}
}

"left4dead2"
{
"Keys"
{
"EngineInterface" "VEngineServer022"
}
"Offsets"
{
"ClientPrintf"
{
"windows" "46"
"linux" "46"
}
}
}

"nmrih"
{
"Keys"
{
"EngineInterface" "VEngineServer023"
}
"Offsets"
{
"ClientPrintf"
{
"windows" "45"
"linux" "45"
}
}
}
}
190 changes: 190 additions & 0 deletions scripting/adminhelpstac.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Admin Help Plugin
* Displays and searches SourceMod commands and descriptions.
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/

#pragma semicolon 1

#include <sourcemod>

#pragma newdecls required

#define COMMANDS_PER_PAGE 10

public Plugin myinfo =
{
name = "Admin Help",
author = "AlliedModders LLC",
description = "Display command information",
version = SOURCEMOD_VERSION,
url = "http://www.sourcemod.net/"
};

public void OnPluginStart()
{
LoadTranslations("common.phrases");
LoadTranslations("adminhelp.phrases");
RegConsoleCmd("sm_help", HelpCmd, "Displays SourceMod commands and descriptions");
RegConsoleCmd("sm_searchcmd", HelpCmd, "Searches SourceMod commands");
}

public Action HelpCmd(int client, int args)
{
if (client && !IsClientInGame(client))
{
return Plugin_Handled;
}

char arg[64], cmdName[20];
int pageNum = 1;
bool doSearch;

GetCmdArg(0, cmdName, sizeof(cmdName));

if (args >= 1)
{
GetCmdArg(1, arg, sizeof(arg));
StringToIntEx(arg, pageNum);
pageNum = (pageNum <= 0) ? 1 : pageNum;
}

doSearch = (strcmp("sm_help", cmdName) == 0) ? false : true;

if (GetCmdReplySource() == SM_REPLY_TO_CHAT)
{
ReplyToCommand(client, "[SM] %t", "See console for output");
}

char name[64];
char desc[255];
char noDesc[128];
CommandIterator cmdIter = new CommandIterator();

FormatEx(noDesc, sizeof(noDesc), "%T", "No description available", client);

if (doSearch)
{
int i = 1;
while (cmdIter.Next())
{
cmdIter.GetName(name, sizeof(name));
cmdIter.GetDescription(desc, sizeof(desc));

if (CheckCommandAccess(client, "sm_admin", ADMFLAG_ROOT, true))
{
if ((StrContains(name, arg, false) != -1) && CheckCommandAccess(client, name, cmdIter.Flags))
{
PrintToConsole(client, "[%03d] %s - %s", i++, name, (desc[0] == '\0') ? noDesc : desc);
}
}
else
{
if ((StrContains(name, arg, false) != -1) && (StrContains(name, "stac", false) == -1) && CheckCommandAccess(client, name, cmdIter.Flags))
{
PrintToConsole(client, "[%03d] %s - %s", i++, name, (desc[0] == '\0') ? noDesc : desc);
}
}
}

if (i == 1)
{
PrintToConsole(client, "%t", "No matching results found");
}
} else {
PrintToConsole(client, "%t", "SM help commands");

/* Skip the first N commands if we need to */
if (pageNum > 1)
{
int i;
int endCmd = (pageNum-1) * COMMANDS_PER_PAGE - 1;
for (i=0; cmdIter.Next() && i<endCmd; )
{
cmdIter.GetName(name, sizeof(name));

if (CheckCommandAccess(client, name, cmdIter.Flags))
{
i++;
}
}

if (i == 0)
{
PrintToConsole(client, "%t", "No commands available");
delete cmdIter;
return Plugin_Handled;
}
}

/* Start printing the commands to the client */
int i;
int StartCmd = (pageNum-1) * COMMANDS_PER_PAGE;
for (i=0; cmdIter.Next() && i<COMMANDS_PER_PAGE; )
{
cmdIter.GetName(name, sizeof(name));
cmdIter.GetDescription(desc, sizeof(desc));

if (CheckCommandAccess(client, "sm_admin", ADMFLAG_ROOT, true))
{
if (CheckCommandAccess(client, name, cmdIter.Flags))
{
i++;
PrintToConsole(client, "[%03d] %s - %s", i+StartCmd, name, (desc[0] == '\0') ? noDesc : desc);
}
}
else
{
if ((StrContains(name, "stac", false) == -1) && CheckCommandAccess(client, name, cmdIter.Flags))
{
i++;
PrintToConsole(client, "[%03d] %s - %s", i+StartCmd, name, (desc[0] == '\0') ? noDesc : desc);
}
}
}

if (i == 0)
{
PrintToConsole(client, "%t", "No commands available");
} else {
PrintToConsole(client, "%t", "Entries n - m in page k", StartCmd+1, i+StartCmd, pageNum);
}

/* Test if there are more commands available */
if (cmdIter.Next())
{
PrintToConsole(client, "%t", "Type sm_help to see more", pageNum+1);
}
}

delete cmdIter;

return Plugin_Handled;
}
15 changes: 15 additions & 0 deletions scripting/include/sbpstac.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#if defined _sbpstac_included
#endinput
#endif
#define __sbpstac_included_included

public SharedPlugin __pl_sbpstac =
{
name = "sbpstac",
file = "sbpstac.smx",
#if defined REQUIRE_PLUGIN
required = 1,
#else
required = 0,
#endif
};
Loading