Плагин★ 10обновлён июнь 2026 г.MITRust
Открыть на GitHubREADME.md
SampCRON
A cron plugin for samp/open.mp in Rust. Made using this library
Installation
- Download suitable binary files from releases for your operating system.
- Add it to your
pluginsfolder - Add
samp_cronto server.cfg (config.json if you're using open.mp) orsamp_cron.so(for linux) - Add samp_cron.inc in includes folder
Building
- Clone the repo
git clone https://github.com/Tiaansu/samp-cron.git
- Install Rust
rustup update stable-i686 --no-self-update && rustup default stable-i686
- Build using
cargo build
cargo build --release
[!IMPORTANT] Here's the scheduling format
You can check this to check for more patterns.
sec min hour day of month month day of week year * * * * * * *
API
-
cron_new(const pattern[], const callback[], const args[] = "", {Float, _}:...)
pattern[]- cron patterncallback[]- callback to execute every callargs[]- custom arguments
Returns
the cron job idExample
new CRON:cron_id = INVALID_CRON_ID; main() { cron_id = cron_new("* * * * * *", "SecondTimer", "i", 5); } forward SecondTimer(); public SecondTimer() { printf("Hi! I am called by cron id: %i and I also have a custom args: %i!", _:cron_id, num); } -
bool:cron_is_valid(CRON:id)
id- id of cron job
Returns
true - valid
false - invalidExample
new CRON:cron_id = INVALID_CRON_ID; main() { printf("Is cron job id %i valid? %i", _:cron_id, cron_is_valid(cron_id)); } -
bool:cron_delete(CRON:id)
id- id of cron job
Returns
true - succeed
false - failedExample
new CRON:cron_id = INVALID_CRON_ID, current = 0; main() { cron_id = cron_new("* * * * * *", "SecondTimer"); } forward SecondTimer(); public SecondTimer() { if (++ current <= 10) { printf("%i/10", current + 1); } else { printf("Is cron job id %i deleted? %i", _:cron_id, cron_delete(cron_id)); } }
[!NOTE]
Most of the part of this README is from/based on samp-bcrypt
I'm open for suggestions and corrections as I'm still learning Rust.
cronompopenmprustrust-langsa-mpsa-mp-developmentsa-mp-pluginsamp
Страница собрана из того, что GitHub публикует о репозитории. samp.directory не хранит этот код. Сообщить о проблеме с этой записью