Skip to content

Instantly share code, notes, and snippets.

@Rainyan
Rainyan / .bashrc
Last active August 12, 2025 13:25
NT;RE Linux buildenv alias
# Assuming deps installed as per: https://github.com/NeotokyoRebuild/neo?tab=readme-ov-file#linux-prerequisite---steam-runtime-3-sniper-container
# Assuming pwd of NT;RE code repo root dir.
# Following the "buildenv" command, enter the following commands inside the container:
# cd /root/neo/src
# cmake --preset linux-debug # or linux-release
# cmake --build --preset linux-debug # or linux-release
alias buildenv='sudo docker run -v .:/root/neo/ --rm -it --entrypoint /
│ bin/bash registry.gitlab.steamos.cloud/steamrt/sniper/sdk'
@Rainyan
Rainyan / sm_compile.py
Last active September 1, 2025 12:40
SourceMod batch multicompile Python 3 script for Windows. For Linux, see Bash script: https://gist.github.com/Rainyan/f09aaca597d9197a92fc0342d5d20176
#!/usr/bin/env python3
import os
from pathlib import Path
import subprocess
# Without file extension
PLUGIN = "nt_spec_quicktarget"
# Assuming code lives in ./scripting of this
REPO_NAME = "sourcemod-nt-spec-quicktarget"
@Rainyan
Rainyan / memtools.inc
Last active June 27, 2025 09:31
Call malloc, realloc, free from SourceMod plugins, with optional automatic memory cleanup. Gamedata available only for Neotokyo (2006/ep1 engine, Windows 32bit), but could probably be used for other games too with some modifications. Tested on SM version 1.12. Experimental; use at own risk.
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#pragma newdecls required
// SemVer 2.0.0
#define MEMTOOLS_VERSION_MAJOR 0
#define MEMTOOLS_VERSION_MINOR 1
#define MEMTOOLS_VERSION_PATCH 0
@Rainyan
Rainyan / multicomp.sh
Last active February 3, 2025 01:31
Bash script to compile a SourceMod plugin on Linux for multiple compiler versions. For Windows, see Python script: https://gist.github.com/Rainyan/ce55dec3d07742311bbfdc070e4a5b4f
#!/usr/bin/env bash
# file name without the extension
Plugin=my_plugin
declare -a SmVersions=("1.8" "1.9" "1.10" "1.11" "1.12")
BasePath=~/code/spcomp
ExtraIncludes="${BasePath}/includes"
@Rainyan
Rainyan / nt_hitgroups.sp
Last active December 28, 2024 04:03
Hit groups test for Neotokyo
#include <sourcemod>
#include <sdkhooks>
#pragma semicolon 1
#pragma newdecls required
enum HitGroup {
Generic = 0,
Head,
Chest,
@Rainyan
Rainyan / nt_takedmginfo.sp
Last active December 19, 2024 01:19
CTakeDamageInfo example with OnTakeDamage hook for Neotokyo. Requires SM 1.12 or newer.
#include <dhooks>
#include <entity>
#pragma semicolon 1
#pragma newdecls required
// Returns n bytes worth of bits.
Address Bytes(any n)
{
any sizeof_ptr = 4;
@Rainyan
Rainyan / nt_ghost_no_alltalk.sp
Last active October 14, 2024 22:39
Experimental plugin for Neotokyo. Forces alltalk off when the ghost is picked up. Untested.
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
ConVar sv_alltalk;
bool alltalkWas;
public Plugin myinfo = {
name = "NT Disable Alltalk When Ghosting",
GALLIUM_HUD="fps+frametime+cpu+GPU-load+memory-clock+VRAM-usage" glxgears
@Rainyan
Rainyan / nt_getbaseentity.inc
Last active November 7, 2024 01:34
Address to index converter for Neotokyo SourceMod plugins.
#if defined _NT_GET_BASE_ENTITY_INC_
#endinput
#endif
#define _NT_GET_BASE_ENTITY_INC_
#include <sdktools>
// For a valid base entity pointer, returns its entity index.
stock int GetBaseEntity(Address self)
{
@Rainyan
Rainyan / launch.vs.json
Last active June 21, 2024 14:14
NT;RE launch.json for Visual Studio 2022. Set the env variables accordingly & restart the IDE to use.
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "dll",
"exe": "${env.SDK2013MP}\\hl2.exe",
"project": "CMakeLists.txt",
"projectTarget": "client.dll (game\\client\\client.dll)",
"name": "client.dll (game\\client\\client.dll)",