NoSteamPlayerCount: initial release
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
#include <sourcemod>
|
||||
#include <SteamWorks>
|
||||
#include <connect>
|
||||
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
bool g_bConnected[MAXPLAYERS + 1] = {false,...};
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "NoSteamPlayerCount",
|
||||
author = "Neon",
|
||||
description = "",
|
||||
version = "1.0",
|
||||
url = "https://steamcommunity.com/id/n3ontm"
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnGameFrame()
|
||||
{
|
||||
//SteamWorks_SetMapName("ze_FFVII_Mako_Reactor_v5_3");
|
||||
SteamWorks_SetMaxPlayers(65);
|
||||
}
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
RegAdminCmd("sm_addfake", Command_addfake, ADMFLAG_ROOT, "");
|
||||
RegAdminCmd("sm_removefake", Command_removefake, ADMFLAG_ROOT, "");
|
||||
RegAdminCmd("sm_countfakes", Command_countfakes, ADMFLAG_BAN, "");
|
||||
}
|
||||
|
||||
public Action Command_addfake(int client, int argc)
|
||||
{
|
||||
SteamWorks_CreateFake("Kaitou Sinbad");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_removefake(int client, int argc)
|
||||
{
|
||||
SteamWorks_KickFake();
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_countfakes(int client, int argc)
|
||||
{
|
||||
int iFakes = SteamWorks_CountFakes();
|
||||
ReplyToCommand(client, "There are currently %d Fake Clients active.", iFakes);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public void OnClientPostAdminCheck(int client)
|
||||
{
|
||||
char sSteamID[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
char sName[128];
|
||||
GetClientName(client, sName, sizeof(sName));
|
||||
|
||||
if(!SteamClientAuthenticated(sSteamID))
|
||||
{
|
||||
int iFakeID = SteamWorks_CreateFake(sName);
|
||||
g_bConnected[client] = true;
|
||||
LogMessage("\"%L\" connected as NoSteam. Fake Client with ID: \"%d\" got created.", client, iFakeID);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
if (!g_bConnected[client])
|
||||
return;
|
||||
|
||||
char sSteamID[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
|
||||
if(!SteamClientAuthenticated(sSteamID))
|
||||
{
|
||||
SteamWorks_KickFake();
|
||||
g_bConnected[client] = false;
|
||||
LogMessage("\"%L\" left as NoSteam. Fake Client got removed.", client);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user