This commit is contained in:
Robin Appelman 2025-05-04 00:39:32 +02:00
commit ae9fed460b
9 changed files with 220 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

27
.github/workflows/compile.yml vendored Normal file
View 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/who.sp"
target: "./plugin/who.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
View file

@ -0,0 +1,3 @@
.idea
result*
.direnv

25
LICENSE Normal file
View file

@ -0,0 +1,25 @@
Copyright (c) 2025 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
View file

@ -0,0 +1,12 @@
# Who
Who is this server guy anyway?
## Installation
[Download Plugin](https://github.com/spiretf/who/raw/main/plugin/who.smx)
## Usage
- Enable the plugin
- Type `!who` in chat

84
flake.lock generated Normal file
View file

@ -0,0 +1,84 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1746301764,
"narHash": "sha256-5odz+NZszRya//Zd0P8h+sIwOnV35qJi+73f4I+iv1M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "537ee98218704e21ea465251de512ab6bbb9012e",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "release-24.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"spire": "spire",
"utils": "utils"
}
},
"spire": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"utils": [
"utils"
]
},
"locked": {
"lastModified": 1746311811,
"narHash": "sha256-nmoaj+/Y5Z/1x1gxV9MYOhdgEGt9tpCbbuJ9KJVahZA=",
"owner": "spiretf",
"repo": "nix",
"rev": "acb7f7f4f387a6850522b7e6c0ea0bd02b866830",
"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": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

35
flake.nix Normal file
View file

@ -0,0 +1,35 @@
{
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/release-24.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;
};
spEnv = pkgs.sourcepawn.buildEnv (with pkgs.sourcepawn.includes; [sourcemod]);
in {
packages = rec {
inherit spEnv;
sdrconnect = pkgs.buildSourcePawnScript {
name = "who";
src = ./plugin/who.sp;
};
default = sdrconnect;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = [spEnv];
};
});
}

33
plugin/who.sp Normal file
View file

@ -0,0 +1,33 @@
#pragma semicolon 1
#include <sourcemod>
public Plugin:myinfo = {
name = "who",
author = "Icewind",
description = "Who?",
version = "0.1",
url = "https://spire.tf"
};
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs) {
if (strcmp(sArgs, "!who", false) == 0) {
CreateTimer(0.1, HandleWhoCommand, client);
}
if (strcmp(sArgs, "!how", false) == 0) {
CreateTimer(0.1, HandleHowCommand, client);
}
return Plugin_Continue;
}
public Action HandleWhoCommand(Handle Timer, int client) {
PrintToChatAll("\x01[\x03SDR\x01]: They always ask \"Who is server?\". But nobody ever asks \"How is server?\".");
return Plugin_Handled;
}
public Action HandleHowCommand(Handle Timer, int client) {
PrintToChatAll("\x01[\x03SDR\x01]: Doing well, thanks for asking.");
return Plugin_Handled;
}

BIN
who.smx Normal file

Binary file not shown.