Raised This Month: $12 Target: $400
 3% 

VSH VSH2-ConfigEvent. Execute function based on event in VSH2.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hoto Cocoa
Senior Member
Join Date: Jun 2018
Location: Somewhere
Old 09-20-2022 , 08:00   VSH2-ConfigEvent. Execute function based on event in VSH2.
Reply With Quote #1

VSH2-ConfigEvent
Execute function based on event in VSH2. Inspired by redsunservers/VSH-Rewrite. Also some codes are from VSH-Rewrite.

Install
Install the dependencies first.
Then compile vsh2-configsys.sp with the compiler.
./spcomp vsh2-configsys.sp

Modules
Check cfg_impl/modules to see existing modules and usage.
There's also a wiki page shows how to configure the modules.

Usage
Check test/vsh2.cfgevent for examples. The config file should be in sourcemod/configs/saxton_hale.

"globals" means function will be executed as the event is called.

"weapons" means function will be executed as the event is called and player's active weapon's index match the one in the weapons section.

<passive> true in the weapon index section means it will bypass the player's active weapon check. As long as player has the weapon in their slot, the function will be executed.

External modules
Without having to modify this plugin's source, now you can easily implement them externally.

Code:
public Action ConfigEvent_ExternalPrint(EventMap args, ConfigEventType_t type)
{
    int text_size = args.GetSize("text");
    if (!text_size)
        return Plugin_Continue;
    
    char[] text = new char[text_size];
    args.Get("text", text, text_size);
    PrintToServer("External plugin: \n\n\n%s\n\n\n", text);

    return Plugin_Continue;
}
Each function must have this type of signature in order to be compatible and visible to ConfigEvent's system.
Code:
"<enum>"
{
    "module"        "external_plugin_test.smx"
    "procedure"	    "ConfigEvent_ExternalPrint"
    "text"          "Hello plugin"
}
To export and use the plugin, add "module" key with the plugin's filename as its value inside the callback config.

Github
__________________

Last edited by Hoto Cocoa; 10-10-2022 at 04:08. Reason: update wiki page link.
Hoto Cocoa is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode