Skip to content

Instantly share code, notes, and snippets.

@Cheaterman
Cheaterman / component_data.py
Created February 16, 2022 15:01
component_data.py
from dataclasses import dataclass
component_type_names = [
'Spoiler',
'Hood',
'Roof',
'Sideskirt',
'Lamps',
'Nitro',
@Cheaterman
Cheaterman / vehicle_data.py
Created February 16, 2022 15:00
vehicle_data.py
from dataclasses import dataclass
from typing import Dict, List
from .component_data import Component, components
@dataclass
class Vehicle:
id: int
name: str
@Cheaterman
Cheaterman / pysampcommands.py
Last active May 21, 2022 16:59
pysamp/commands.py
import functools
from dataclasses import dataclass, field
from typing import Any, Callable, Protocol
from samp import SendClientMessage # type: ignore
class CommandHandler(Protocol):
def __call__(self, playerid: int, *args: str) -> None: ...
@Cheaterman
Cheaterman / Dockerfile
Last active April 11, 2022 20:06
Dockerfile
FROM ubuntu:18.04
RUN \
apt-get update && \
apt-get install -y \
gpg \
wget \
&& \
wget -O- https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | \
tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
@Cheaterman
Cheaterman / vehicles.py
Created January 7, 2022 22:25
vehicles.py
import random
from dataclasses import dataclass, field
from typing import ClassVar, Dict, List, Optional, Tuple
from samp import (
PLAYER_STATE_DRIVER,
PLAYER_STATE_ONFOOT,
AddVehicleComponent,
CallRemoteFunction,
ChangeVehicleColor,
@Cheaterman
Cheaterman / __init__.py
Created January 5, 2022 21:20
__init__.py
import importlib
import traceback
from samp import SendClientMessage
from .cmdparser import cmd, handle_command
from .callbacks import names
from .tms import admin_level
@Cheaterman
Cheaterman / gates.py
Created December 1, 2021 16:24
gates.py
from dataclasses import dataclass
from typing import Optional, Tuple
from samp import (
KEY_CROUCH,
GetPlayerFacingAngle,
GetPlayerPos,
IsPlayerInAnyVehicle,
KillTimer,
SendClientMessage,
@Cheaterman
Cheaterman / kulo.py
Last active November 6, 2021 14:09
kulo.py
import functools
from dataclasses import dataclass
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import (
BooleanProperty,
ColorProperty,
ListProperty,
StringProperty,
@Cheaterman
Cheaterman / cpu.pyx
Created October 12, 2021 19:07
cpu.pyx
# cython: language_level=3, boundscheck=False, wraparound=False, cdivision=True
cimport cython
from libc.string cimport strncmp, strncpy
from bus cimport Bus
from cpu_instructions cimport cpu_function_from_name
cdef class CPU:
def __cinit__(self, Bus bus):
@Cheaterman
Cheaterman / elevators.py
Created October 1, 2021 19:41
elevators.py
import math
from dataclasses import dataclass
from typing import Dict, Tuple
from samp import (
DIALOG_STYLE_LIST,
CreateObject,
DestroyObject,
GetPlayerPos,
IsObjectMoving,