Vice City: Multiplayer

Server Development => Community Plugins => Topic started by: habi on Apr 03, 2023, 04:29 PM

Title: Filterscripts Plugin for Squirrel
Post by: habi on Apr 03, 2023, 04:29 PM
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:-
(https://i.imgur.com/b3HM4XL.png)               

(https://i.imgur.com/r56dFsR.png)

Location of filterscripts folder:-
(https://i.imgur.com/1oHEP4K.png)
(Place your filterscripts in the colored folder)

server.cfg:-
(https://i.imgur.com/LNJGpsn.png)
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 (https://www.mediafire.com/file/n9uj4wy0ggjfu6m/filterscripts-VCMP04-binaries.zip/file)
  contains:
  filterscript04rel  32/64  ( dll, so )

Source
download (https://www.mediafire.com/file/5de3n2bwgo80nny/filterscripts.7z/file) or read (https://github.com/habi498/filterscripts-vcmp/blob/master/filterscripts.cpp) online.

Also read the word document attached below for documentation.
Title: Re: Filterscripts Plugin
Post by: habi on Apr 18, 2023, 04:20 AM
-Fixed bug on onPlayerCommand

(file updated in mediafire)