Skip to content

Commit

Permalink
增加大量插件的i18n翻译
Browse files Browse the repository at this point in the history
感谢原作者@lechuga16 的大量插件i18n的支持,和es的翻译
我新增了对应插件的简体中文翻译
增加狡猾tank,text插件适配新版infected_control

- 删除传送最小距离Convar,传送最小距离和生成最小距离一样,为了增加传送进程的特感生成速度,把特感传送当前距离改为每tick增加20距离快速找位置(生成为每tick增加5距离)
- 增加一个Native(float GetNextSpawnTime()),提供下一次特感生成时间,方便其他插件调用
- 修复1vht和witchparty模式可能少特的问题

- 适配新版infected_control插件,增加狡猾tank的开启关闭显示

- 增加踢出家庭共享账户的功能,需要SteamWorks拓展
- 增加大厅自动删除的Convar

- 修改旁观插件的分数插件依赖处理不正确的问题

- 修改jocker2的一些设置,减低向后跳概率,增加高跳概率

- 修复9特以上无法投票的功能

修复infected_control addchangehook错误
  • Loading branch information
fantasylidong committed Dec 8, 2022
1 parent fa23aec commit ef66c73
Show file tree
Hide file tree
Showing 66 changed files with 3,442 additions and 2,127 deletions.
3 changes: 3 additions & 0 deletions Update_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,6 @@ PS:这种处理方式相比原来的换成写实处理有以下几点好处
#### l4d_boss_vote插件
- 修复9特以上无法投票的功能

#### 其他
增加大量对抗插件的i18n翻译

Binary file modified addons/sourcemod/plugins/optional/AnneHappy/infected_control.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/autopause.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/checkpoint-rage-control.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/coinflip.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/current.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_stats.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d_tank_control_eq.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d_tank_damage_announce.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/nodeathcamskip.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/pause.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/readyup.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/survivor_mvp.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/teamflip.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/weapon_loadout_vote.smx
Binary file not shown.
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/AnneHappy/infected_control.sp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void OnPluginStart()
g_hSpawnDistanceMin.AddChangeHook(ConVarChanged_Cvars);
g_hTeleportSi.AddChangeHook(ConVarChanged_Cvars);
g_hTeleportCheckTime.AddChangeHook(ConVarChanged_Cvars);
g_hTeleportDistance.AddChangeHook(ConVarChanged_Cvars);
//g_hTeleportDistance.AddChangeHook(ConVarChanged_Cvars);
g_hSiInterval.AddChangeHook(ConVarChanged_Cvars);
g_hIgnoreIncappedSurvivorSight.AddChangeHook(ConVarChanged_Cvars);
g_hEnableSIoption.AddChangeHook(ConVarChanged_Cvars);
Expand Down
305 changes: 161 additions & 144 deletions addons/sourcemod/scripting/autopause.sp
Original file line number Diff line number Diff line change
@@ -1,173 +1,190 @@
/*
SourcePawn is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved.
SourceMod is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved.
Pawn and SMALL are Copyright (C) 1997-2015 ITB CompuPhase.
Source is Copyright (C) Valve Corporation.
All trademarks are property of their respective owners.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
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/>.
SourcePawn is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved.
SourceMod is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved.
Pawn and SMALL are Copyright (C) 1997-2015 ITB CompuPhase.
Source is Copyright (C) Valve Corporation.
All trademarks are property of their respective owners.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
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/>.
*/
#include <sourcemod>
#include <left4dhooks>
#pragma semicolon 1
#pragma newdecls required

#include <colors>
#include <left4dhooks>
#include <sourcemod>

#undef REQUIRE_PLUGIN
#include "readyup"

public Plugin:myinfo =
public Plugin myinfo =
{
name = "L4D2 Auto-pause",
author = "Darkid, Griffin",
description = "When a player disconnects due to crash, automatically pause the game. When they rejoin, give them a correct spawn timer.",
version = "2.0",
url = "https://github.com/jbzdarkid/AutoPause"
name = "L4D2 Auto-pause",
author = "Darkid, Griffin",
description = "When a player disconnects due to crash, automatically pause the game. When they rejoin, give them a correct spawn timer.",
version = "2.1",
url = "https://github.com/jbzdarkid/AutoPause"
}

new Handle:g_hCvarEnabled;
new Handle:g_hCvarForce;
new Handle:g_hCvarApdebug;

new Handle:crashedPlayers;
new Handle:infectedPlayers;
new Handle:survivorPlayers;
new bool:readyUpIsAvailable;
new bool:RoundEnd;

public OnPluginStart() {
// Suggestion by Nati: Disable for any 1v1
g_hCvarEnabled = CreateConVar("autopause_enable", "1", "Whether or not to automatically pause when a player crashes.");
g_hCvarForce = CreateConVar("autopause_force", "0", "Whether or not to force pause when a player crashes.");
g_hCvarApdebug = CreateConVar("autopause_apdebug", "0", "Whether or not to debug information.");

crashedPlayers = CreateTrie();
infectedPlayers = CreateArray(64);
survivorPlayers = CreateArray(64);

HookEvent("round_start", round_start);
HookEvent("round_end", round_end);
HookEvent("player_team", playerTeam);
HookEvent("player_disconnect", playerDisconnect, EventHookMode_Pre);
ConVar
g_hCvarEnabled,
g_hCvarForce,
g_hCvarApdebug;
Handle
crashedPlayers,
infectedPlayers,
survivorPlayers;
bool
readyUpIsAvailable,
RoundEnd;

public void OnPluginStart()
{
LoadTranslations("autopause.phrases");
// Suggestion by Nati: Disable for any 1v1
g_hCvarEnabled = CreateConVar("autopause_enable", "1", "Whether or not to automatically pause when a player crashes.");
g_hCvarForce = CreateConVar("autopause_force", "0", "Whether or not to force pause when a player crashes.");
g_hCvarApdebug = CreateConVar("autopause_apdebug", "0", "Whether or not to debug information.");

crashedPlayers = CreateTrie();
infectedPlayers = CreateArray(64);
survivorPlayers = CreateArray(64);

HookEvent("round_start", RoundStart_Event);
HookEvent("round_end", RoundEnd_Event);
HookEvent("player_team", PlayerTeam_Event);
HookEvent("player_disconnect", PlayerDisconnect_Event, EventHookMode_Pre);
}

public OnAllPluginsLoaded()
public void OnAllPluginsLoaded()
{
readyUpIsAvailable = LibraryExists("readyup");
readyUpIsAvailable = LibraryExists("readyup");
}

public OnLibraryRemoved(const String:name[])
public void OnLibraryRemoved(const char[] name)
{
if (StrEqual(name, "readyup")) readyUpIsAvailable = false;
if (StrEqual(name, "readyup")) readyUpIsAvailable = false;
}

public OnLibraryAdded(const String:name[])
public void OnLibraryAdded(const char[] name)
{
if (StrEqual(name, "readyup")) readyUpIsAvailable = true;
if (StrEqual(name, "readyup")) readyUpIsAvailable = true;
}

public round_start(Handle:event, const String:name[], bool:dontBroadcast) {
ClearTrie(crashedPlayers);
ClearArray(infectedPlayers);
ClearArray(survivorPlayers);
RoundEnd = false;
public void RoundStart_Event(Handle event, const char[] name, bool dontBroadcast)
{
ClearTrie(crashedPlayers);
ClearArray(infectedPlayers);
ClearArray(survivorPlayers);
RoundEnd = false;
}

public round_end(Handle:event, const String:name[], bool:dontBroadcast) {
RoundEnd = true;
public void RoundEnd_Event(Handle event, const char[] name, bool dontBroadcast)
{
RoundEnd = true;
}

// Handles players leaving and joining the infected team.
public playerTeam(Handle:event, const String:name[], bool:dontBroadcast) {
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client <= 0 || client > MaxClients) return;
decl String:steamId[64];
GetClientAuthId(client, AuthId_Steam2, steamId, sizeof(steamId));
if (strcmp(steamId, "BOT") == 0) return;
new oldTeam = GetEventInt(event, "oldteam");
new newTeam = GetEventInt(event, "team");

new index = FindStringInArray(infectedPlayers, steamId);
new survindex = FindStringInArray(infectedPlayers, steamId);
if (oldTeam == 3) {
if (index != -1) RemoveFromArray(infectedPlayers, index);
if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Removed player %s from infected team.", steamId);
}
else if (oldTeam == 2) {
if (survindex != -1) RemoveFromArray(survivorPlayers, survindex);
if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Removed player %s from survivor team.", steamId);
}
if (newTeam == 3) {
decl Float:spawnTime;
if (GetTrieValue(crashedPlayers, steamId, spawnTime)) {
new CountdownTimer:spawnTimer = L4D2Direct_GetSpawnTimer(client);
CTimer_Start(spawnTimer, spawnTime);
RemoveFromTrie(crashedPlayers, steamId);
LogMessage("[AutoPause] Player %s rejoined, set spawn timer to %f.", steamId, spawnTime);
} else if (index == -1) {
PushArrayString(infectedPlayers, steamId);
if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Added player %s to infected team.", steamId);
}
}
else if (newTeam == 2 && survindex == -1) {
PushArrayString(survivorPlayers, steamId);
if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Added player %s to survivor team.", steamId);
}
public void PlayerTeam_Event(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client <= 0 || client > MaxClients) return;
char steamId[64];
GetClientAuthId(client, AuthId_Steam2, steamId, sizeof(steamId));
if (strcmp(steamId, "BOT") == 0) return;
int oldTeam = GetEventInt(event, "oldteam");
int newTeam = GetEventInt(event, "team");

int index = FindStringInArray(infectedPlayers, steamId);
int survindex = FindStringInArray(infectedPlayers, steamId);
if (oldTeam == 3)
{
if (index != -1) RemoveFromArray(infectedPlayers, index);
if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Removed player %s from infected team.", steamId);
}
else if (oldTeam == 2) {
if (survindex != -1) RemoveFromArray(survivorPlayers, survindex);
if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Removed player %s from survivor team.", steamId);
}
if (newTeam == 3)
{
float spawnTime;
if (GetTrieValue(crashedPlayers, steamId, spawnTime))
{
CountdownTimer spawnTimer = L4D2Direct_GetSpawnTimer(client);
CTimer_Start(spawnTimer, spawnTime);
RemoveFromTrie(crashedPlayers, steamId);
LogMessage("[AutoPause] Player %s rejoined, set spawn timer to %f.", steamId, spawnTime);
}
else if (index == -1) {
PushArrayString(infectedPlayers, steamId);
if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Added player %s to infected team.", steamId);
}
}
else if (newTeam == 2 && survindex == -1) {
PushArrayString(survivorPlayers, steamId);
if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Added player %s to survivor team.", steamId);
}
}

public playerDisconnect(Handle:event, const String:name[], bool:dontBroadcast) {
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client <= 0 || client > MaxClients) return;
decl String:steamId[64];
GetClientAuthId(client, AuthId_Steam2, steamId, sizeof(steamId));
if (strcmp(steamId, "BOT") == 0) return;

// Player wasn't actually a gamer, ignore
if (FindStringInArray(infectedPlayers, steamId) == -1 && FindStringInArray(survivorPlayers, steamId) == -1) return;

decl String:reason[128];
GetEventString(event, "reason", reason, sizeof(reason));
decl String:playerName[128];
GetEventString(event, "name", playerName, sizeof(playerName));
decl String:timedOut[256];
Format(timedOut, sizeof(timedOut), "%s timed out", playerName);

if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Player %s (%s) left the game: %s", playerName, steamId, reason);

// If the leaving player crashed, pause.
if (strcmp(reason, timedOut) == 0 || strcmp(reason, "No Steam logon") == 0)
{
if ((!readyUpIsAvailable || !IsInReady()) && !RoundEnd && GetConVarBool(g_hCvarEnabled))
{
if (GetConVarBool(g_hCvarForce))
{
ServerCommand("sm_forcepause");
}
else
{
FakeClientCommand(client, "sm_pause");
}
CPrintToChatAll("{blue}[{default}AutoPause{blue}] {olive}%s {default}crashed.", playerName);
}
}

// If the leaving player was on infected, save their spawn timer.
if (FindStringInArray(infectedPlayers, steamId) != -1) {
decl Float:timeLeft;
new CountdownTimer:spawnTimer = L4D2Direct_GetSpawnTimer(client);
if (spawnTimer != CTimer_Null) {
timeLeft = CTimer_GetRemainingTime(spawnTimer);
LogMessage("[AutoPause] Player %s left the game with %f time until spawn.", steamId, timeLeft);
SetTrieValue(crashedPlayers, steamId, timeLeft);
}
}
public void PlayerDisconnect_Event(Event hEvent, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
if (client <= 0 || client > MaxClients) return;
char steamId[64];
GetClientAuthId(client, AuthId_Steam2, steamId, sizeof(steamId));
if (strcmp(steamId, "BOT") == 0) return;

// Player wasn't actually a gamer, ignore
if (FindStringInArray(infectedPlayers, steamId) == -1 && FindStringInArray(survivorPlayers, steamId) == -1) return;

char reason[128];
GetEventString(hEvent, "reason", reason, sizeof(reason));
char playerName[128];
GetEventString(hEvent, "name", playerName, sizeof(playerName));
char timedOut[256];
Format(timedOut, sizeof(timedOut), "%s timed out", playerName);

if (GetConVarBool(g_hCvarApdebug)) LogMessage("[AutoPause] Player %s (%s) left the game: %s", playerName, steamId, reason);

// If the leaving player crashed, pause.
if (strcmp(reason, timedOut) == 0 || strcmp(reason, "No Steam logon") == 0)
{
if ((!readyUpIsAvailable || !IsInReady()) && !RoundEnd && GetConVarBool(g_hCvarEnabled))
{
if (GetConVarBool(g_hCvarForce))
{
ServerCommand("sm_forcepause");
}
else
{
FakeClientCommand(client, "sm_pause");
}
CPrintToChatAll("%t %t", "Tag", "crashed", playerName);
}
}

// If the leaving player was on infected, save their spawn timer.
if (FindStringInArray(infectedPlayers, steamId) != -1)
{
float timeLeft;
CountdownTimer spawnTimer = L4D2Direct_GetSpawnTimer(client);
if (spawnTimer != CTimer_Null)
{
timeLeft = CTimer_GetRemainingTime(spawnTimer);
LogMessage("[AutoPause] Player %s left the game with %f time until spawn.", steamId, timeLeft);
SetTrieValue(crashedPlayers, steamId, timeLeft);
}
}
}
Loading

0 comments on commit ef66c73

Please sign in to comment.