Skip to content

Commit

Permalink
join插件增加踢出共享账户功能
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasylidong committed Dec 5, 2022
1 parent 3f24e2f commit 8589590
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
Binary file modified addons/sourcemod/plugins/extend/join.smx
Binary file not shown.
30 changes: 30 additions & 0 deletions addons/sourcemod/scripting/AnneHappy/join.sp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#undef REQUIRE_PLUGIN
#include <veterans>
#include <updater>
#include <SteamWorks>

#define IsValidClient(%1) (1 <= %1 <= MaxClients && IsClientInGame(%1))
#define IsValidAliveClient(%1) (1 <= %1 <= MaxClients && IsClientInGame(%1) && IsPlayerAlive(%1))
Expand All @@ -53,6 +54,7 @@ ConVar
hCvarMotdUrl,
hCvarEnableAutoupdate,
hCvarEnableInf,
hCvarKickFamilyAccount,
g_cvSvAllowLobbyCo,
hCvarEnableAutoRemoveLobby,
hCvarIPUrl;
Expand All @@ -62,6 +64,7 @@ public void OnPluginStart()
{
hCvarEnableInf = CreateConVar("join_enable_inf", "1", "是否可以开启加入特感", _, true, 0.0, true, 1.0);
hCvarEnableAutoRemoveLobby = CreateConVar("join_enable_autoremovelobby", "0", "大厅满了是否自动删除大厅", _, true, 0.0, true, 1.0);
hCvarKickFamilyAccount = CreateConVar("join_enable_kickfamilyaccount", "1", "是否开启踢出家庭共享账户", _, true, 0.0, true, 1.0);
hCvarEnableAutoupdate = CreateConVar("join_autoupdate", "1", "是否开启AnneHappy核心插件自动更新(不常更新插件包的建议关闭)", _, true, 0.0, true, 3.0);
g_cvSvAllowLobbyCo = FindConVar("sv_allow_lobby_connect_only");
hCvarMotdTitle = CreateConVar("sm_cfgmotd_title", "AnneHappy电信服");
Expand Down Expand Up @@ -138,6 +141,33 @@ public void OnLibraryRemoved(const char[] name)
else if (StrEqual(name, "updater")){ g_bUpdateSystemAvailable = false; }
}

public void SteamWorks_OnValidateClient(int ownerauthid, int authid)
{
if (ownerauthid > 0 && ownerauthid != authid && hCvarKickFamilyAccount.BoolValue)
{
char SteamID[32];
Format(SteamID, 32, "STEAM_1:%d:%d", (authid & 1), (authid >> 1));
int client = GetIndexBySteamID(SteamID);
if (client != -1)
{
KickClient(client, "家庭共享账户无法进入本服务器组");
}
}
}

int GetIndexBySteamID(const char[] SteamID)
{
char AuthStringToCompareWith[32];
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientConnected(i) && GetClientAuthId(i, AuthId_Steam2, AuthStringToCompareWith, sizeof(AuthStringToCompareWith)) && StrEqual(AuthStringToCompareWith, SteamID))
{
return i;
}
}
return -1;
}

public Action RestartMap(int client,int args)
{
CrashMap();
Expand Down
1 change: 1 addition & 0 deletions cfg/cfgogl/allcharger/shared_settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ confogl_addcvar l4d2_MITSR_Amount 2
confogl_addcvar join_enable_inf 0
confogl_addcvar join_autoupdate 1 //是否开启AnneHappy核心插件自动更新(不常更新插件包的建议关闭)
confogl_addcvar join_enable_autoremovelobby 1 //大厅满了是否自动删除大厅
confogl_addcvar join_enable_kickfamilyaccount 1 //是否踢出家庭共享账户

// [slots_vote.smx]
confogl_addcvar slots_max_slots 16 //slots开位允许的最大数值(整数)
Expand Down
1 change: 1 addition & 0 deletions cfg/cfgogl/alone/shared_settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ confogl_addcvar shop_enable 1
confogl_addcvar join_enable_inf 0
confogl_addcvar join_autoupdate 1 //是否开启AnneHappy核心插件自动更新(不常更新插件包的建议关闭)
confogl_addcvar join_enable_autoremovelobby 1 //大厅满了是否自动删除大厅
confogl_addcvar join_enable_kickfamilyaccount 1 //是否踢出家庭共享账户

// [slots_vote.smx]
confogl_addcvar slots_max_slots 16 //slots开位允许的最大数值(整数)
Expand Down
1 change: 1 addition & 0 deletions cfg/cfgogl/annehappy/shared_settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ confogl_addcvar l4d2_spit_godframe_ticks 4
confogl_addcvar join_enable_inf 0
confogl_addcvar join_autoupdate 1 //是否开启AnneHappy核心插件自动更新(不常更新插件包的建议关闭)
confogl_addcvar join_enable_autoremovelobby 1 //大厅满了是否自动删除大厅
confogl_addcvar join_enable_kickfamilyaccount 1 //是否踢出家庭共享账户

// [slots_vote.smx]
confogl_addcvar slots_max_slots 16 //slots开位允许的最大数值(整数)
Expand Down
1 change: 1 addition & 0 deletions cfg/cfgogl/hunters/shared_settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ confogl_addcvar l4d2_MITSR_Amount 2
confogl_addcvar join_enable_inf 0
confogl_addcvar join_autoupdate 1 //是否开启AnneHappy核心插件自动更新(不常更新插件包的建议关闭)
confogl_addcvar join_enable_autoremovelobby 1 //大厅满了是否自动删除大厅
confogl_addcvar join_enable_kickfamilyaccount 1 //是否踢出家庭共享账户

// [slots_vote.smx]
confogl_addcvar slots_max_slots 16 //slots开位允许的最大数值(整数)
Expand Down
1 change: 1 addition & 0 deletions cfg/cfgogl/witchparty/shared_settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ confogl_addcvar l4d2_MITSR_Amount 2
confogl_addcvar join_enable_inf 0
confogl_addcvar join_autoupdate 1 //是否开启AnneHappy核心插件自动更新(不常更新插件包的建议关闭)
confogl_addcvar join_enable_autoremovelobby 1 //大厅满了是否自动删除大厅
confogl_addcvar join_enable_kickfamilyaccount 1 //是否踢出家庭共享账户

// [slots_vote.smx]
confogl_addcvar slots_max_slots 16 //slots开位允许的最大数值(整数)
Expand Down

0 comments on commit 8589590

Please sign in to comment.