mirror of
https://codeberg.org/spire/nochat.git
synced 2026-06-03 09:14:07 +02:00
init
This commit is contained in:
commit
a7dfb120aa
9 changed files with 236 additions and 0 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
27
.github/workflows/compile.yml
vendored
Normal file
27
.github/workflows/compile.yml
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
name: Build sourcepawn and commit
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.sp'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Compile sourcepawn
|
||||
uses: spiretf/spcomp@v0.1
|
||||
with:
|
||||
source: './plugin/nochat.sp'
|
||||
target: './plugin/nochat.smx'
|
||||
|
||||
- name: Commit files
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git commit -m "Compile sourcepawn" -a
|
||||
- name: Push changes
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.idea
|
||||
result*
|
||||
.direnv
|
||||
25
LICENSE
Normal file
25
LICENSE
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
Copyright (c) 2020 Robin Appelman <robin@icewind.nl>
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
12
README.md
Normal file
12
README.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# NoChat
|
||||
|
||||
Stop specific people from talking
|
||||
|
||||
## Installation
|
||||
|
||||
[Download Plugin](https://github.com/spiretf/nochat/raw/master/plugin/nochat.smx)
|
||||
|
||||
## Usage
|
||||
|
||||
- Enable the plugin
|
||||
- Set the users to block: `rcon sm_nochat_blocklist 76561198024494988,76561198076020012`
|
||||
84
flake.lock
generated
Normal file
84
flake.lock
generated
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1709315803,
|
||||
"narHash": "sha256-/hHKlXR/w2Q1CgNfMPlbu68/0kGXG6py08hzhWuA5jI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "01c6ad6d0b29988f30b8526b64775e02aba126d0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "release-23.11",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"spire": "spire",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"spire": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"utils": [
|
||||
"utils"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709332559,
|
||||
"narHash": "sha256-EnXWdOvUSmHWHjFfZBUVZK15o6wjNuTck415KxRrzi0=",
|
||||
"owner": "spiretf",
|
||||
"repo": "nix",
|
||||
"rev": "60cac34d4db8db2c0f832b0aa68916db4838f16a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "spiretf",
|
||||
"repo": "nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709126324,
|
||||
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
35
flake.nix
Normal file
35
flake.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
inputs = {
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "nixpkgs/release-23.11";
|
||||
spire.url = "github:spiretf/nix";
|
||||
spire.inputs.nixpkgs.follows = "nixpkgs";
|
||||
spire.inputs.utils.follows = "utils";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
spire,
|
||||
}:
|
||||
utils.lib.eachSystem spire.systems (system: let
|
||||
overlays = [spire.overlays.default];
|
||||
pkgs = (import nixpkgs) {
|
||||
inherit system overlays;
|
||||
};
|
||||
inherit (pkgs) lib;
|
||||
spEnv = pkgs.sourcepawn.buildEnv (with pkgs.sourcepawn.includes; [sourcemod]);
|
||||
in rec {
|
||||
packages = rec {
|
||||
nochat = pkgs.buildSourcePawnScript {
|
||||
name = "nochat";
|
||||
src = ./plugin/nochat.sp;
|
||||
};
|
||||
default = nochat;
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [spEnv];
|
||||
};
|
||||
});
|
||||
}
|
||||
BIN
plugin/nochat.smx
Normal file
BIN
plugin/nochat.smx
Normal file
Binary file not shown.
49
plugin/nochat.sp
Normal file
49
plugin/nochat.sp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#pragma semicolon 1
|
||||
#include <sourcemod>
|
||||
|
||||
ConVar noChatBlockListHandle;
|
||||
char loadedBlockList[32][32];
|
||||
|
||||
public Plugin:myinfo = {
|
||||
name = "nochat",
|
||||
author = "Icewind",
|
||||
description = "Prevent specific users from chatting",
|
||||
version = "0.1",
|
||||
url = "https://spire.tf"
|
||||
};
|
||||
|
||||
public OnPluginStart() {
|
||||
noChatBlockListHandle = CreateConVar("sm_nochat_blocklist", "", "comma seperated list of steamid64", FCVAR_PROTECTED);
|
||||
if (noChatBlockListHandle != null) {
|
||||
noChatBlockListHandle.AddChangeHook(onBlockList);
|
||||
decl String:blockList[512];
|
||||
GetConVarString(noChatBlockListHandle, blockList, sizeof(blockList));
|
||||
LoadBlockList(blockList);
|
||||
}
|
||||
|
||||
RegConsoleCmd("say", Command_SayChat);
|
||||
}
|
||||
|
||||
public Action:Command_SayChat(client, args) {
|
||||
new String:steam_id[32];
|
||||
GetClientAuthId(client, AuthId_SteamID64, steam_id, sizeof(steam_id));
|
||||
|
||||
for (int x = 0; x < sizeof(loadedBlockList); x++) {
|
||||
if (StrEqual(steam_id, loadedBlockList[x])) {
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public void onBlockList(ConVar convar, const char[] oldValue, const char[] newValue) {
|
||||
LoadBlockList(newValue);
|
||||
}
|
||||
|
||||
public void LoadBlockList(const char[] value) {
|
||||
for (int x = 0; x < sizeof(loadedBlockList); x++) {
|
||||
loadedBlockList[x][0] = EOS;
|
||||
}
|
||||
ExplodeString(value, ",", loadedBlockList, sizeof(loadedBlockList), sizeof(loadedBlockList[]), false);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue