-
Notifications
You must be signed in to change notification settings - Fork 33
Filterscripts
Filterscripts don't have first-class support in sampctl yet (#55) but you can very easily add and build filterscripts as individual packages.
See this repository for a real example of a server package with a filterscript package.
Just like libraries and gamemodes, each filterscript is its own package. This may change when multiple build support is added (#153).
So simply create a directory in ./filterscripts
for your filterscript. Lets
say we have an admin system, called admin-system.pwn
. Create a directory
called admin-system
and move admin-system.pwn
inside it:
.
├── filterscripts
│ ├── admin-system
│ │ ├── admin-system.pwn
...
Then cd
to that directory and run sampctl package init
to bootstrap a new
Pawn Package.
Once you've done the standard dependency setup, you should be able to
sampctl package build
your filterscript. However, there is one last step to
make this whole system work.
Inside your admin-system
directory, there will be a Package Definition File
with an entry
and output
fields that look something like:
{
"user": "Southclaws",
"repo": "admin-system",
"entry": "admin-system.pwn",
"output": "admin-system.amx",
"dependencies": ["sampctl/samp-stdlib"]
}
All you have to do is adjust the output
field to output the .amx
file to the
parent directory, ./filterscripts
:
{
"user": "Southclaws",
"repo": "admin-system",
"entry": "admin-system.pwn",
"output": "../admin-system.amx",
"dependencies": ["sampctl/samp-stdlib"]
}
Notice the ../
that now precedes the .amx
filename.
You can now add admin-system
to the runtime.filterscripts
array inside
pawn.json
:
{
"runtime": {
"rcon_password": "5ecret",
"port": 7777,
"hostname": "ultra GANG GANGWARS [CUSTOM OBJECTS]",
"maxplayers": 32,
"filterscripts": ["admin-system"]
}
}
And that's it! That's how you do filterscripts with sampctl.
This process will get easier in future. Keep your eye out for updates and discussions! If you have ideas for the user-experience or possible commands and tools for filterscripts, let me know!