samp.directory
← Скрипты и библиотеки

bmisiak/samp-precise-timers

A plugin for SA-MP providing precise timers, written in Rust.

Плагин★ 34обновлён авг. 2026 г.LGPL-3.0Rustsampctl
Открыть на GitHub

Установка через sampctl

sampctl package install bmisiak/samp-precise-timers

Выполните в папке проекта. sampctl скачает пакет и его зависимости.

Используется в 2 пакетах

README.md

samp-precise-timers ⌚

Developed for net4game.com (RolePlay), this SA-MP plugin provides precise timers for the server. It is written in Rust, a memory-safe language.

Installation

Simply install to your project:

sampctl package install bmisiak/samp-precise-timers

Include in your code and begin using the library:

#include <samp-precise-timers>

Why rewrite timers?

SA-MP's built-in timers experience progressively worse trigger inconsistency and suffer from poor performance and crashes due to invalid handling of arrays and state invalidation. This is written in Rust, which combines high-level ergonomics with the performance of a low-level language. As a result, the code is much cleaner, easily auditable, and more performant.

Take a look at the source to see the benefits.

Performance

Most other plugins, including the native OpenMP implementation, iterate over all the timers on every server tick. This plugin, instead, keeps track of the next timer to trigger, only checking one memory location on every tick, regardless of how many timers are scheduled.

Notes

  • Creating new timers from callbacks works fine. ✔
  • Supports strings and arrays properly without memory leaks. ✔
  • Deleting/resetting a repeating timer from its callback works fine ✔
  • Deleting/resetting a singular timer form its PAWN callback will gracefully fail. Set a new one instead.

Compiling

Install Rust from rustup.rs. Afterwards, you are two commands away from being able to compile for SA-MP, which is a 32-bit application.

Compile for Linux servers

rustup target add i686-unknown-linux-gnu

Then, enter the project directory and execute:

cargo build --target=i686-unknown-linux-gnu --release

Compile for Windows servers

Note: You might need to install Visual Studio Build Tools.

rustup target add i686-pc-windows-msvc

Then, enter the project directory and execute:

cargo build --target=i686-pc-windows-msvc --release

Integration test

The integration test builds the release plugin for 32-bit Linux, compiles a Pawn gamemode, launches SA-MP, and verifies the native calls and timer callbacks from the server log:

./scripts/test-integration-linux

Contributing

If you like the code and would like to help out, feel free to submit a pull request. Let me know at [email protected] if you would like to join our team. 👋

rustsa-mpsa-mp-plugin

Страница собрана из того, что GitHub публикует о репозитории. samp.directory не хранит этот код. Сообщить о проблеме с этой записью

bmisiak/samp-precise-timers: Плагин для SA-MP | samp.directory