Skip to content

Instantly share code, notes, and snippets.

View Jackzmc's full-sized avatar

Jackz Jackzmc

View GitHub Profile

Notes

  • client: the game server
  • server: the admin panel
  • All integers are little-endian, all strings are null-terminated
  • Enums are shown in light blue, responses are in light pink, records are in light purple
  • Fields with asterik* are always present, if not present, it may not be sent

Connection Flow

export default class BufferReader {
#buffer: Buffer
#offset: number
#length = 0
/// Yields BufferReaders, splitting when it hits newline
static *getPackets(data: Buffer) {
let reader = new BufferReader(data)
yield reader
// while(reader.nextBuffer != null) {
@Jackzmc
Jackzmc / tokio_timer.rs
Last active June 24, 2023 14:56
Macros to easily create interval timers
#[macro_export]
/// Runs your code after Duration has passed
/// # Examples
/// ```
/// timeout!(Duration::from_seconds(15), {
/// println!("Shutting down now...")
/// });
/// ```
///
public static void DrawBoundingBoxFromCenter(Vector3 center, Vector3 size, Color color)
{
Vector3 cornerA = new Vector3(center.X - size.X, center.Y - size.Y, center.Z + size.Z);
Vector3 cornerB = new Vector3(center.X + size.X, center.Y - size.Y, center.Z + size.Z);
Vector3 cornerC = new Vector3(center.X + size.X, center.Y + size.Y, center.Z + size.Z);
Vector3 cornerD = new Vector3(center.X - size.X, center.Y + size.Y, center.Z + size.Z);
DrawLine(cornerA, cornerB, color);
DrawLine(cornerB, cornerC, color);
DrawLine(cornerC, cornerD, color);
DrawLine(cornerD, cornerA, color);
{
// The format version. Script only checks the last piece (the 1.3.1)
"version": "Jackz Custom Vehicle 1.3.1",
"created": 1661726534, // Unix timestamp when the vehicle was created. Optional
"name": "MyVehicle", // A name for the vehicle, used for when importing into the editor. Optional
"author": null, // An author name credited for making vehicle. Optional
"blipIcon": 252, // The blip id to show. See https://docs.fivem.net/docs/game-references/blips/
"spawnLocation": { x = 0, y = 0, z = 0 }, // The spawn location of the vehicle. Optional, null will disable
"allowPlayerSpawning": false // Default is false, allows other players to use 'spawnbuild name' command
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
// #include <l4d2_behavior>
#include <actions>
Handle g_hWitchAttack;
@Jackzmc
Jackzmc / convert-vue2-vue3-comp.js
Last active May 11, 2022 02:18
converts from vue2 options syntax to vue3 composition format
const header = [
`import SectionNode from '@/components/sections/SectionNode.vue'`
]
const exported = {
name: "SectionNode",
props: {
node: Object
},
methods: {
gotoHeader() {
"EntityConfig"
{
"c8m3_sewers"
{
"ents"
{
"A"
{
"origin" "13265.965820 8547.057617 -250.7"
"type" "env_physics_blocker"
local function GetEndCoord(deg, start, range)
local rad_x = deg['x'] * 0.0174532924
local rad_z = deg['z'] * 0.0174532924
return {
x = range * (-math.sin(rad_z) * math.cos(rad_x)) + start.x,
y = range * (math.cos(rad_z) * math.cos(rad_x)) + start.y,
z = range * math.sin(rad_x) + start.z
}
end
use mlua::prelude::*;
use std::fs::File;
use std::io::BufReader;
use rodio::{Decoder, OutputStream, Sink};
use std::time::Duration;
use futures_timer::Delay;
async fn play_local_file(lua: &Lua, (filepath, volume, duration): (String, f32, u64)) -> LuaResult<()> {
let (_stream, stream_handle) = OutputStream::try_default().unwrap();
let sink = Sink::try_new(&stream_handle).unwrap();