Filterscripts Plugin for Squirrel

Started by habi, Apr 03, 2023, 04:29 PM

Previous topic - Next topic

habi

Introduction
Filterscript gives you the ability to have multiple onPlayerCommand(player, cmd, text) and other events. Each of these have the same name. They are located in each filterscript. You can have a maximum of 16 filterscripts loaded with this plugin.

See multiple onPlayerJoin events:-
               



Location of filterscripts folder:-

(Place your filterscripts in the colored folder)

server.cfg:-

The abcd.nut, efgh.nut and ijkl.nut are scripts like main.nut but instead of 'onScriptLoad' it has 'onFilterScriptLoad'.

How it works?
It first copies all functions( FindPlayer, FindVehicle,.., print, format,...) of roottable and for each filterscript, a table is created which contains these functions.
On event, the corresponding functions are called with the filterscript table as environment.

Return value in events
Return value is not mandatory. If 0 is returned then the event in other filterscripts will not be called.
But in the case of onPlayerCommand, it has the opposite meaning. Returning 1 means the command is processed by the filterscript.

Loading/Unloading at runtime?
Use my plugincommand plugin to load a filterscript located in 'filterscripts' folder at runtime. Send 0x2A1A3C4D with the name of filterscript without extention for loading.
Unload: 0x2A1A3C4E
Reload: 0x2A1A3C4F

Downloads
click here
  contains:
  filterscript04rel  32/64  ( dll, so )

Source
download or read online.

Also read the word document attached below for documentation.

habi

#1
-Fixed bug on onPlayerCommand

(file updated in mediafire)