samp.directory
← Skripte und Bibliotheken

demian-gg/pawn-humanize

Human-friendly number and color formatting library for Pawn

Bibliothek★ 2aktualisiert Sept. 2026MITPawnsampctl
Auf GitHub öffnen

Mit sampctl installieren

sampctl package install demian-gg/pawn-humanize

Führe das in deinem Projektordner aus. sampctl lädt das Paket und alles herunter, wovon es abhängt.

Im Pawn-Compiler ausprobieren →

Fügt seine Include-Dateien samt der Bibliotheken, von denen es abhängt, dem Pawn-Compiler in deinem Browser hinzu, bereit zum Einbinden in ein Skript.

Hängt von 1 Paket ab

README.md

This utility library, inspired by go-humanize, provides a collection of functions that turn machine-friendly data into formats that are easier for humans to read and understand.

Whether you need to turn color codes into recognizable color names, display numbers with delimiters, convert numbers into words, or format numbers as ordinals, this library handles the little details that make your output feel natural and readable.

Installation

You can install the library either manually or using sampctl, depending on your workflow:

Installing manually

1. Download the includes/humanize.inc file and place it in your server's includes folder.
2. Then include it in your code and start using the library:

#include <humanize>
Installing via sampctl

1. Run the following command to install the library:

sampctl package install demian-gg/pawn-humanize

2. Then include it in your code and start using it:

#include <humanize>

Features

HumanizeColor()
0xA86420FF -> "Chocolate Brown"
0x42F44EFF -> "Lime Green"
0x137A8EFF -> "Teal"
HumanizeColor(color, dest[], maxLength = sizeof dest)
HumanizeNumberDelimited()
0 -> 0
100 -> 100
1000 -> 1,000
1000000 -> 1,000,000
-100000 -> -100,000
HumanizeNumberDelimited(number, dest[], maxLength = sizeof dest, delimiter[] = ",")
HumanizeNumberWords()
1000 -> "one thousand"
1234 -> "one thousand two hundred thirty-four"
-1234 -> "negative one thousand two hundred thirty-four"
HumanizeNumberWords(number, dest[], maxLength = sizeof dest)
HumanizeNumberOrdinal()
0 -> 0th
1 -> 1st
2 -> 2nd
3 -> 3rd
4 -> 4th
etc...
HumanizeNumberOrdinal(number, dest[], maxLength = sizeof dest)

License

This project is licensed under the MIT License. This license reflects our commitment to keeping the software open and accessible, while giving developers maximal freedom in how they use it. The MIT License is a permissive open-source license that allows anyone to use, modify, and distribute the software, including in commercial and closed-source projects, as long as the original copyright notice and license terms are preserved.

For more details, see LICENSE.md.

humanizerlibrarysa-mp

Diese Seite wird aus dem erstellt, was GitHub über das Repository veröffentlicht. samp.directory hostet den Code nicht. Ein Problem mit diesem Eintrag melden