Merge branch 'master' of github.com:Jackzmc/sourcemod-plugins

This commit is contained in:
Jackzie 2025-01-07 09:41:32 -06:00
commit f2e2de6ca9
2 changed files with 19 additions and 8 deletions

View file

@ -2,6 +2,8 @@
This is a collection of sourcemod plugins, most are used on my servers. The majority of the plugins are created by me, but some are modifications of other plugins.
Some of the plugins / changes are very specific, but may be useful to someone.
Please note that these plugins are only guaranteed to work on Left 4 Dead **2**.
Not always the latest versions. If you have any interest with a plugin, I can make sure to upload the latest.
Currently plugins are only compiled and tested with SM 1.11-6964
@ -342,7 +344,7 @@ Any survivor that attacks another survivor
3. If neither #1 or #2, both the victim and the attacker take 1/2 the original damage
4. If victim is in a saferoom, no damage is dealt.
See https://admin.jackz.me/docs/plugins#tkstopper for some more implementation information
See https://jackzie.dev/posts/sourcemod/sm-dev#tkstopper for some more implementation information
During any of the above three conditions, if they deal (or attempt to deal) over 75 HP in 15 seconds (configurable) they will be instantly banned for a set period of time (60 minutes). If they are for sure a team killer, it can be extended to a permanent ban.

View file

@ -92,7 +92,7 @@ enum PanelSettings {
Setting_None = 0,
Setting_DisableWithNoViewers = 1
}
GameState g_gameState = State_Hibernating;
GameState g_gameState = State_None;
#define BUFFER_SIZE 2048
Buffer sendBuffer;
Buffer receiveBuffer; // Unfortunately there's no easy way to have this not be the same as BUFFER_SIZE
@ -324,6 +324,11 @@ void OnSocketError(Socket socket, int errorType, int errorNumber, int attempt) {
g_socket.SetArg(attempt + 1);
CreateTimer(nextAttempt, Timer_Reconnect);
}
if(authState == Auth_PendingResponse) {
Debug("Got socket error on auth?, retry");
g_socket.SetArg(attempt + 1);
ConnectSocket(false, attempt);
}
}
bool SendFullSync() {
@ -658,13 +663,14 @@ Action Timer_Reconnect(Handle h, int type) {
}
bool ConnectSocket(bool force = false, int authTry = 0) {
if(g_gameState == State_Hibernating) return false; // ignore when hibernating
if(g_socket == null) {
if(g_gameState == State_Hibernating) {
Debug("ConnectSocket: Server is hibernating, ignoring");
return false;
} else if(g_socket == null) {
LogError("Socket is invalid");
return false;
}
if(g_socket.Connected) {
Debug("Already connected, disconnecting...");
} else if(g_socket.Connected) {
Debug("ConnectSocket: Already connected, disconnecting...");
g_socket.Disconnect();
authState = Auth_Inactive;
}
@ -673,7 +679,10 @@ bool ConnectSocket(bool force = false, int authTry = 0) {
return false;
}
// Do not try to reconnect on auth failure, until token has changed
if(!force && authState == Auth_Fail) return false;
if(!force && authState == Auth_Fail) {
Debug("ConnectSocket: Ignoring request, auth failed");
return false;
}
authState = Auth_Pending;
g_socket.Connect(OnSocketConnect, OnSocketReceive, OnSocketDisconnect, serverIp, serverPort);
CreateTimer(10.0, Timer_ConnectTimeout, authTry);