Status: Remove buffering, done by sourcemod now.
PlayerVisibility: Fix on some maps, thx Shufen. Spectate: Server crash exploit. ExtraCommands: minor change
This commit is contained in:
parent
c37131fcbb
commit
73a725f3b2
ExtraCommands/scripting
PlayerVisibility/scripting
Spectate/scripting
Status/scripting
@ -53,8 +53,7 @@ public void OnPluginStart()
|
||||
RegAdminCmd("sm_setscore", Command_SetScore, ADMFLAG_GENERIC, "sm_setscore <#userid|name> <value>");
|
||||
RegAdminCmd("sm_setteamscore", Command_SetTeamScore, ADMFLAG_GENERIC, "sm_setteamscore <team> <value>");
|
||||
RegAdminCmd("sm_waila", Command_WAILA, ADMFLAG_GENERIC);
|
||||
RegAdminCmd("sm_getinfo", Command_WAILA, ADMFLAG_GENERIC);
|
||||
RegAdminCmd("sm_getmodel", Command_WAILA, ADMFLAG_GENERIC);
|
||||
RegAdminCmd("sm_info", Command_WAILA, ADMFLAG_GENERIC);
|
||||
RegAdminCmd("sm_fcvar", Command_ForceCVar, ADMFLAG_CHEATS, "sm_fcvar <#userid|name> <cvar> <value>");
|
||||
RegAdminCmd("sm_setclantag", Command_SetClanTag, ADMFLAG_CHEATS, "sm_setclantag <#userid|name> [text]");
|
||||
RegAdminCmd("sm_fakecommand", Command_FakeCommand, ADMFLAG_CHEATS, "sm_fakecommand <#userid|name> [command] [args]");
|
||||
@ -997,6 +996,7 @@ public Action Command_WAILA(int client, int argc)
|
||||
char sModelPath[PLATFORM_MAX_PATH];
|
||||
char sClsName[64];
|
||||
char sNetClsName[64];
|
||||
char sTargetname[64];
|
||||
int iEntity;
|
||||
int iEntityModelIdx;
|
||||
|
||||
@ -1014,9 +1014,10 @@ public Action Command_WAILA(int client, int argc)
|
||||
GetEntPropString(iEntity, Prop_Data, "m_ModelName", sModelPath, sizeof(sModelPath));
|
||||
GetEntityClassname(iEntity, sClsName, sizeof(sClsName));
|
||||
GetEntityNetClass(iEntity, sNetClsName, sizeof(sNetClsName));
|
||||
GetEntPropString(iEntity, Prop_Data, "m_iName", sTargetname, sizeof(sTargetname));
|
||||
iEntityModelIdx = GetEntProp(iEntity, Prop_Send, "m_nModelIndex");
|
||||
|
||||
PrintToConsole(client, "Entity Index: %i\nModel Path: %s\nModel Index: %i\nClass Name: %s\nNet Class Name: %s", iEntity, sModelPath, iEntityModelIdx, sClsName, sNetClsName);
|
||||
PrintToConsole(client, "Entity Index: %i\nTarget name: %s\nModel Path: %s\nModel Index: %i\nClass Name: %s\nNet Class Name: %s", iEntity, sTargetname, sModelPath, iEntityModelIdx, sClsName, sNetClsName);
|
||||
|
||||
PrintToChat(client, "[SM] Trace hit something, check your console for more information.");
|
||||
|
||||
|
@ -98,6 +98,7 @@ public void OnPostThinkPost(int client)
|
||||
}
|
||||
|
||||
if(GetEntityRenderMode(client) == RENDER_NONE ||
|
||||
GetEntityRenderMode(client) == RENDER_ENVIRONMENTAL ||
|
||||
GetEntityRenderFx(client) != RENDERFX_NONE)
|
||||
{
|
||||
g_Client_Alpha[client] = 0;
|
||||
|
@ -11,7 +11,7 @@ public Plugin myinfo =
|
||||
name = "Spectate",
|
||||
description = "Adds a command to spectate specific players and removes broken spectate mode.",
|
||||
author = "Obus + BotoX",
|
||||
version = "1.0.1",
|
||||
version = "1.1",
|
||||
url = ""
|
||||
}
|
||||
|
||||
@ -36,6 +36,8 @@ public void OnPluginStart()
|
||||
|
||||
RegConsoleCmd("sm_spectate", Command_Spectate, "Spectate a player.");
|
||||
RegConsoleCmd("sm_spec", Command_Spectate, "Spectate a player.");
|
||||
|
||||
AddCommandListener(Command_GoTo, "spec_goto");
|
||||
}
|
||||
|
||||
public void OnClientSettingsChanged(int client)
|
||||
@ -106,3 +108,25 @@ public Action Command_Spectate(int client, int argc)
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
// Fix spec_goto crash exploit
|
||||
public Action Command_GoTo(int client, const char[] command, int argc)
|
||||
{
|
||||
if(argc == 5)
|
||||
{
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
char sArg[64];
|
||||
GetCmdArg(i, sArg, 64);
|
||||
float fArg = StringToFloat(sArg);
|
||||
|
||||
if(FloatAbs(fArg) > 5000000000.0)
|
||||
{
|
||||
PrintToServer("%d -> %f > %f", i, FloatAbs(fArg), 5000000000.0);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
@ -12,9 +12,6 @@ ConVar g_Cvar_HostPort;
|
||||
ConVar g_Cvar_HostName;
|
||||
ConVar g_Cvar_HostTags;
|
||||
|
||||
Handle g_hPlayerList[MAXPLAYERS + 1] = {INVALID_HANDLE, ...};
|
||||
bool g_bDataAvailable = false;
|
||||
|
||||
#if !defined _serverfps_included
|
||||
int g_iTickRate;
|
||||
#endif
|
||||
@ -43,9 +40,6 @@ public Action Command_Status(int client, const char[] command, int args)
|
||||
if(!client)
|
||||
return Plugin_Continue;
|
||||
|
||||
if(g_hPlayerList[client] != INVALID_HANDLE)
|
||||
return Plugin_Handled;
|
||||
|
||||
static char sServerName[128];
|
||||
static char sServerTags[128];
|
||||
static char sServerAdress[128];
|
||||
@ -88,9 +82,6 @@ public Action Command_Status(int client, const char[] command, int args)
|
||||
}
|
||||
}
|
||||
|
||||
static char sSendBuffer[896];
|
||||
int iBufLength = 0;
|
||||
|
||||
#if defined _serverfps_included
|
||||
float fServerTickRate = 1.0 / GetTickInterval();
|
||||
float fServerFPS = GetServerFPS();
|
||||
@ -103,43 +94,37 @@ public Action Command_Status(int client, const char[] command, int args)
|
||||
iTickRate = iTickRate <= iServerTickRate ? iTickRate : iServerTickRate;
|
||||
#endif
|
||||
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"hostname: %s\n", sServerName);
|
||||
PrintToConsole(client, "hostname: %s",
|
||||
sServerName);
|
||||
|
||||
#if defined _serverfps_included
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"tickrate : %.2f/%.2f (%d%%%%)\n", fServerFPS, fServerTickRate, RoundToNearest((fServerFPS / fServerTickRate) * 100));
|
||||
PrintToConsole(client, "tickrate : %.2f/%.2f (%d%%%%)",
|
||||
fServerFPS, fServerTickRate, RoundToNearest((fServerFPS / fServerTickRate) * 100));
|
||||
#else
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"tickrate : %d/%d (%d%%%%)\n", iTickRate, iServerTickRate, RoundToNearest((float(iTickRate) / float(iServerTickRate)) * 100));
|
||||
PrintToConsole(client, "tickrate : %d/%d (%d%%%%)",
|
||||
iTickRate, iServerTickRate, RoundToNearest((float(iTickRate) / float(iServerTickRate)) * 100));
|
||||
#endif
|
||||
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"udp/ip : %s\n", sServerAdress);
|
||||
PrintToConsole(client, "udp/ip : %s",
|
||||
sServerAdress);
|
||||
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"net I/O : %.2f/%.2f KiB/s (You: %.2f/%.2f KiB/s)\n", fServerDataIn / 1024, fServerDataOut / 1024, fClientDataIn / 1024, fClientDataOut / 1024);
|
||||
PrintToConsole(client, "net I/O : %.2f/%.2f KiB/s (You: %.2f/%.2f KiB/s)",
|
||||
fServerDataIn / 1024, fServerDataOut / 1024, fClientDataIn / 1024, fClientDataOut / 1024);
|
||||
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"map : %s at: %.0f x, %.0f y, %.0f z\n", sMapName, fPosition[0], fPosition[1], fPosition[2]);
|
||||
PrintToConsole(client, "map : %s at: %.0f x, %.0f y, %.0f z",
|
||||
sMapName, fPosition[0], fPosition[1], fPosition[2]);
|
||||
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"tags : %s\n", sServerTags);
|
||||
PrintToConsole(client, "tags : %s",
|
||||
sServerTags);
|
||||
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"edicts : %d/%d/%d (used/max/free)\n", GetEntityCount(), GetMaxEntities(), GetMaxEntities() - GetEntityCount());
|
||||
PrintToConsole(client, "edicts : %d/%d/%d (used/max/free)",
|
||||
GetEntityCount(), GetMaxEntities(), GetMaxEntities() - GetEntityCount());
|
||||
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"players : %d %s | %d %s (%d/%d)\n", iRealClients, Multiple(iRealClients) ? "humans" : "human", iFakeClients, Multiple(iFakeClients) ? "bots" : "bot", iTotalClients, MaxClients);
|
||||
PrintToConsole(client, "players : %d %s | %d %s (%d/%d)",
|
||||
iRealClients, Multiple(iRealClients) ? "humans" : "human", iFakeClients, Multiple(iFakeClients) ? "bots" : "bot", iTotalClients, MaxClients);
|
||||
|
||||
iBufLength += FormatEx(sSendBuffer[iBufLength], sizeof(sSendBuffer) - iBufLength,
|
||||
"# %8s %40s %24s %12s %4s %4s %s %s", "userid", "name", "uniqueid", "connected", "ping", "loss", "state", "addr");
|
||||
|
||||
g_hPlayerList[client] = CreateArray(ByteCountToCells(sizeof(sSendBuffer)));
|
||||
|
||||
PushArrayString(g_hPlayerList[client], sSendBuffer);
|
||||
g_bDataAvailable = true;
|
||||
sSendBuffer[0] = 0;
|
||||
PrintToConsole(client, "# %8s %40s %24s %12s %4s %4s %s %s",
|
||||
"userid", "name", "uniqueid", "connected", "ping", "loss", "state", "addr");
|
||||
|
||||
for(int player = 1; player <= MaxClients; player++)
|
||||
{
|
||||
@ -147,7 +132,7 @@ public Action Command_Status(int client, const char[] command, int args)
|
||||
continue;
|
||||
|
||||
static char sPlayerID[8];
|
||||
static char sPlayerName[MAX_NAME_LENGTH];
|
||||
static char sPlayerName[MAX_NAME_LENGTH + 2];
|
||||
static char sPlayerAuth[24];
|
||||
char sPlayerTime[12];
|
||||
char sPlayerPing[4];
|
||||
@ -181,30 +166,11 @@ public Action Command_Status(int client, const char[] command, int args)
|
||||
else
|
||||
FormatEx(sPlayerState, sizeof(sPlayerState), "spawning");
|
||||
|
||||
if(GetAdminFlag(GetUserAdmin(client), Admin_Ban))
|
||||
if(GetAdminFlag(GetUserAdmin(client), Admin_Custom3))
|
||||
GetClientIP(player, sPlayerAddr, sizeof(sPlayerAddr));
|
||||
|
||||
static char sFormatted[128];
|
||||
FormatEx(sFormatted, sizeof(sFormatted), "# %8s %40s %24s %12s %4s %4s %s %s\n", sPlayerID, sPlayerName, sPlayerAuth, sPlayerTime, sPlayerPing, sPlayerLoss, sPlayerState, sPlayerAddr);
|
||||
|
||||
int iFormattedLength = strlen(sFormatted);
|
||||
|
||||
if(iBufLength + iFormattedLength >= sizeof(sSendBuffer))
|
||||
{
|
||||
sSendBuffer[iBufLength - 1] = 0;
|
||||
PushArrayString(g_hPlayerList[client], sSendBuffer);
|
||||
sSendBuffer[0] = 0;
|
||||
iBufLength = 0;
|
||||
}
|
||||
|
||||
StrCat(sSendBuffer, sizeof(sSendBuffer), sFormatted);
|
||||
iBufLength += iFormattedLength;
|
||||
}
|
||||
|
||||
if(iBufLength)
|
||||
{
|
||||
sSendBuffer[iBufLength - 1] = 0;
|
||||
PushArrayString(g_hPlayerList[client], sSendBuffer);
|
||||
PrintToConsole(client, "# %8s %40s %24s %12s %4s %4s %s %s",
|
||||
sPlayerID, sPlayerName, sPlayerAuth, sPlayerTime, sPlayerPing, sPlayerLoss, sPlayerState, sPlayerAddr);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
@ -226,34 +192,6 @@ public void OnGameFrame()
|
||||
fLastEngineTime = fCurEngineTime;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!g_bDataAvailable)
|
||||
return;
|
||||
|
||||
bool bGotData = false;
|
||||
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if(g_hPlayerList[client] == INVALID_HANDLE)
|
||||
continue;
|
||||
|
||||
if(!IsClientInGame(client) || !GetArraySize(g_hPlayerList[client]))
|
||||
{
|
||||
CloseHandle(g_hPlayerList[client]);
|
||||
g_hPlayerList[client] = INVALID_HANDLE;
|
||||
continue;
|
||||
}
|
||||
|
||||
static char sBuffer[896];
|
||||
GetArrayString(g_hPlayerList[client], 0, sBuffer, sizeof(sBuffer));
|
||||
RemoveFromArray(g_hPlayerList[client], 0);
|
||||
|
||||
PrintToConsole(client, sBuffer);
|
||||
bGotData = true;
|
||||
}
|
||||
|
||||
if(!bGotData)
|
||||
g_bDataAvailable = false;
|
||||
}
|
||||
|
||||
stock bool Multiple(int num)
|
||||
|
Loading…
Reference in New Issue
Block a user