Install with sampctl
sampctl package install Mergevos/samp-pp-specifiers
Run this in your project folder. sampctl downloads the package and what it depends on.
Adds its include files, with the libraries it depends on, to the Pawn compiler in your browser, ready to include in a script.
Depends on 2 packages
- sampctl/samp-stdlibnot in this directory
- illidans4/pawnplusnot in this directory
README.md
samp-pp-specifiers
Make your specifiers with PawnPlus plugin.
Installation
Simply install to your project:
sampctl package install Mergevos/samp-pp-specifiers
Include in your code and begin using the library:
#include <pp-specifiers>
Usage
Register your own specifiers with this function:
stock PP_RegisterSpecifier(specifier, const handler[], bool:is_string=false)
//Example
PP_RegisterSpecifier('g', "SomeCallbackToHandle", false);
print_s(str_format("He is %g connected.", playerid));
forward String: SomeCallbackToHandle(playerid, type, String: format);
public String: SomeCallbackToHandle(playerid, type, String: format)
{
if(!IsPlayerConnected(playerid))
{
return str_new("Not connected");
}
return str_new("Connected");
}
Firstly, we register specifier character with handler function, and our specifier doesn't accept normal strings, so you can't specify NORMAL (not PawnPlus) string instead of playerid. print_s part is pretty straightforward.
public String: SomeCallbackToHandle(playerid, type, String: format) is handler. It is basically a function which handles the specifier. type is character of the specifier, in this case it is g. String: format is pawnplus string of everything you input in front of specifier, eg. %03g, will make format 03.
| New Specifiers | What does it do? |
|---|---|
| %a | Returns modelid from vehicleid. |
| %m | Vehicle name from modelid. |
| %M | Vehicle name from modelid (used in sentence). |
| %w | Weapon name from weaponid. |
| %W | Weapon name from weaponid (used in sentence). |
Testing
To test, simply run the package:
sampctl package run
This page is built from what GitHub publishes about the repository. samp.directory does not host the code. Report a problem with this listing