Skip to content
This repository was archived by the owner on Mar 22, 2021. It is now read-only.

Creating new modules

Nexd edited this page Oct 12, 2019 · 2 revisions
#include <sourcemod>
#include <nexd> //required.
#include <caseopening> //required.

#define PLUGIN_NEV	"Caseopening system new module template"
#define PLUGIN_LERIAS	"Template for a new module"
#define PLUGIN_AUTHOR	"Nexd"
#define PLUGIN_VERSION	"1.0"
#define PLUGIN_URL	"https://github.com/KillStr3aK"
#pragma tabsize 0

public Plugin myinfo = 
{
	name = PLUGIN_NEV,
	author = PLUGIN_AUTHOR,
	description = PLUGIN_LERIAS,
	version = PLUGIN_VERSION,
	url = PLUGIN_URL
};

public void OnPluginStart()
{
	Case_RegisterModule("module.type", true, OnTypeOpened); //char[] type, bool valuetype, void Function
//char[] type - module.type = The TYPE_HANDLER_NAME, what you'll use in your 'case_items' table as "type"
//You can use any name, the reason why I'm using something.something is just to category them somehow, you're not forced to follow this way.

//bool valuetype - false = Depends on your module value. If its an integer, you have to use "true", if its a string, you have to use "false" 

//void Function - OnTypeOpened(Jatekos jatekos, char[] value) (if valuetype = false)
//void Function - OnTypeOpened(Jatekos jatekos, int value) (if valuetype = true)
//You can use any name instead of OnTypeOpened
//You only have to create 1 function, depends on your valuetpye.

//In this function, you have to code the main part of your module
//Like in the store modules, if an item get opened with the module type, it will insert that item for the player to the store_items table

//If its not clear enough, just check out the core included store modules
}

public void OnTypeOpened(Jatekos jatekos, int value)
{
//In this part you can do what you want with the value, e.g.:
	tVip_GrantVip(jatekos.index, view_as<Jatekos>(0), value); //native void tVip_GrantVip(int client, int admin, int duration, int format = 1); requires tvip include.
}

Clone this wiki locally