Police Tools Lite – an open-source key binder for SA:MP

A lightweight open-source version of Police Tools: a mimgui window and binds with their own commands and tags.

Author: Project: 2020Updated: 1 min read

In November 2020 I released Police Tools Lite, a lightweight version of Police Tools with its source code open under GPL v3. Of the big script, it keeps the main tool a police player on an RP server needs: the binder.

How it works

The /plite command opens an 800×500 window built with mimgui: dark theme, a blue "POLICE TOOLS" header and a custom font. The window holds a list of binds. Each one has a name, its own chat command and multi-line text; a bind can be saved, deleted or copied.

When you type a bind's command, each line of its text goes to chat as a separate message. By default there's a one-second pause between lines, and you can change it with a tag.

Tags

Tag What it inserts
$ID$ your ID
$NAME$, $SURNAME$ first and last name from a Firstname_Lastname nick
$PHONE$, $WORK$, $RANG$ phone number, workplace and rank from the settings panel
$ARGS$ the arguments the command was called with
$SLEEP:ms$ a pause before the line, 1000 ms by default
$NOSEND$ a line that only you can see

To give you something to start from, the package includes a "tutorial bind" with the /demo_cmd command.

Under the hood

  • Lua for MoonLoader, the interface is mimgui via LuaJIT FFI, CP1251 encoding.
  • Binds are stored in config/PToolsLite.list, settings in config/PToolsLite.cfg.
  • The script keeps running while the game is paused.

The Lite code is small enough to read in one go, unlike the full Police Tools with its 10,000 lines, so it works well as an example of a mimgui script to study.

Frequently asked questions

How is Police Tools Lite different from Police Tools?

Lite is just the binder: binds with their own commands and tags in a mimgui window. The code is open under GPL v3. The full Police Tools also had a police database, an internal chat, automatic weapon RP actions and HTTP features.

What tags does Police Tools Lite support?

$ID$, $NAME$ and $SURNAME$ come from a Firstname_Lastname nick, $PHONE$, $WORK$ and $RANG$ come from the settings, $ARGS$ holds the command arguments, $SLEEP:ms$ sets a pause, and $NOSEND$ shows a line only to you.

Can I modify and publish the Police Tools Lite code?

Yes, under the terms of GPL v3. The header of the source file also says it can be published with a credit to the author.