Custom Class Maker is a plugin that allows you to make custom classes for Team Fortress 2 using a flexible API and Subplugin system (credit to cookies.io).
This plugin and plugin system is scripted in 1.7+ transitional syntax and requires SourceMod 1.8 to configure and run.
the plugin and system also requires SourceMod 1.8 to compile and that knowledge of SourcePawn is required to utilize the API and Subplugin system to create your own custom classes.
Along with the CCM plugin and the necessary .inc file associated with, I have provided a test class subplugin, appropriately called ccm-test, to properly the forwards and natives.
The niche with this plugin is...
~the subplugin system is automatically handled
~the API is simple
~the necessary private forwards can be used or unused in the exact same fashion SDKHook callbacks are done!
For those that do not know how to quite use methodmaps yet, I've created an old form of the natives and typesets while having the methodmap natives and typesets doing the same thing except using CCM's internal methodmap.
Commands
PHP Code:
"sm_ccm" - access the classes list, this sets you to the class when you respawn
"sm_offccm" - stops making you a custom class
"sm_noccm" - same as "sm_offccm"
"sm_offclass" - same as "sm_offccm"
"sm_reloadccm" - reloads the CCM cfg - default Generic admin flag
Natives
PHP Code:
/**
* Registers a custom class module with Custom Class Maker.
*
* @param shortname developer/programming name of module. i.e. "module"
* @param longname official name of module. i.e. "The Module"
* @return Array index number of module if registration is successful.
* @error returns negative one (-1)
*/
native int CCM_RegisterClass(char shortname[16], char longname[32]);
/**
* Loads a custom class module's special files config file.
*
* @param charFile path to the config file. example: CCM_LoadConfig("configs/ccm/module.cfg");
* @return true if loading is successful, false otherwise.
*/
native bool CCM_LoadConfig(char[] charFile);
/**
* Hooks a typeset to a function
*
* @param type type of function to hook
* @param callback hook function to call when hook is called.
* @return true if hooking is successful, false otherwise.
*/
native void CCM_Hook(CCMHookType type, CCMHookCB callback);
native bool CCM_HookEx(CCMHookType type, CCMHookCB callback);
/**
* Unhooks a typeset from a function
*
* @param type type of function to unhook
* @param callback function to unhook.
* @return true if unhooking is successful, false otherwise.
*/
native void CCM_Unhook(CCMHookType type, CCMHookCB callback);
native bool CCM_UnhookEx(CCMHookType type, CCMHookCB callback);
/**
* Check if a player is a custom class
*
* @param client index of a player
* @return true if player is a custom class, false otherwise.
*/
native bool CCM_IsCustomClass(int client);
/**
* set a player to be a custom class or not
*
* @param client index of a player
* @param state set player as custom class or not
* @noreturn
*/
native void CCM_SetIsCustomClass(int client, bool state);
/**
* if a player is set to be a custom class or not
*
* @param client index of a player
* @return true if player is set to be a custom class, false otherwise.
*/
native bool CCM_IsSetCustomClass(int client);
/**
* set to set a player to be a custom class or not
*
* @param client index of a player
* @param bstate set player to be set as custom class or not
* @noreturn
*/
native void CCM_SetIsSetCustomClass(int client, bool bstate);
/**
* Gets the current index of the custom class module the player is using
*
* @param client index of a player
* @return abstract array index of module.
*/
native int CCM_GetPlayerModuleIndex(int client);
/**
* Sets the current index of the custom class module the player is using
* @note: VERY DANGEROUS, USE WITH EXTREME CAUTION.
* @param client index of a player
* @param index integer to set the player's current class module index to
* @noreturn
*/
native void CCM_SetPlayerModuleIndex(int client, int index);
Methodmap Natives
PHP Code:
methodmap CCMClass
{
/** [ C O N S T R U C T O R ]
* Constructs an instance of the CCM internal methodmap
* @param index index or the userid of a player
* @param userid if using userid instead of player index, set this param to true
* @return an instance of the CCMClass methodmap
*/
public native CCMClass(const int index, bool userid=false);
/* **** **** [ P R O P E R T I E S ] **** **** */
/**
* gets the userid of the methodmap instance
* @return the bare integer player userid
*/
property int userid {
public native get(); //{ return view_as<int>(this); }
}
/**
* gets the index of the methodmap instance
* @return the bare integer player index
*/
property int index {
public native get(); //{ return GetClientOfUserId( view_as<int>(this) ); }
}
/**
* get/set if a CCMClass instance is a custom class or not
* @param val set if the instance is a custom class
* @return true if the instance is a custom class, false if not.
*/
property bool bIsCustom
{
public native get(); //{ return CCM_IsCustomClass( this.index ); }
public native set( const bool val ); //{ CCM_SetIsCustomClass(this.index, val); }
}
/**
* get/set if a CCMClass instance is set to become a custom class or not
* @param val set if the instance will become a custom class
* @return true if the instance will become a custom class, false if not.
*/
property bool bSetCustom
{
public native get(); //{ return CCM_IsSetCustomClass(this.index); }
public native set( const bool val ); //{ CCM_SetIsSetCustomClass(this.index, val); }
}
/**
* get/set the index of the Class Module the instance will be using to run code
* @note VERY DANGEROUS, USE WITH EXTREME CAUTION.
* @param val integer to set the player's current class module index to
* @return index of the plugin array the class is using to run its specific code
*/
property int iIndex
{
public native get(); //{ return CCM_GetPlayerModuleIndex(this.index); }
public native set( const int val ); //{ CCM_SetPlayerModuleIndex(this.index, val); }
}
};
Forwards and their Typesets
PHP Code:
Available Forwards
CCMHook_None,
CCMHook_OnClassMenuSelected,
CCMHook_OnClassDeSelected,
CCMHook_OnInitClass,
CCMHook_OnClassEquip,
CCMHook_OnClassAirblasted,
CCMHook_OnClassDoAirblast,
CCMHook_OnClassKillBuilding,
CCMHook_OnClassKill,
CCMHook_OnClassKillDomination,
CCMHook_OnClassKillRevenge,
CCMHook_OnClassKilled,
CCMHook_OnClassKilledDomination,
CCMHook_OnClassKilledRevenge,
CCMHook_OnClassUbered,
CCMHook_OnClassDeployUber,
CCMHook_OnClassKillDeadRinger,
CCMHook_OnClassKillFirstBlood,
CCMHook_OnClassKilledDeadRinger,
CCMHook_OnClassKilledFirstBlood,
CCMHook_OnConfiguration_Load_Sounds,
CCMHook_OnConfiguration_Load_Materials,
CCMHook_OnConfiguration_Load_Models,
CCMHook_OnConfiguration_Load_Misc
Typesets
// CCMHook OnClassMenuSelected
// CCMHook OnClassDeSelected
// CCMHook OnInitClass
// CCMHook OnClassEquip
function void (const int iModuleIndex, const int iUserId);
function void (const int iModuleIndex, const CCMClass Player);
// CCMHook OnClassAirblasted
// CCMHook OnClassDoAirblast
// CCMHook OnClassKill
// CCMHook OnClassKillDomination
// CCMHook OnClassKillRevenge
// CCMHook OnClassKilled
// CCMHook OnClassKilledDomination
// CCMHook OnClassKilledRevenge
// CCMHook OnClassUbered
// CCMHook OnClassDeployUber
// CCMHook OnClassKillDeadRinger,
// CCMHook OnClassKillFirstBlood,
// CCMHook OnClassKilledDeadRinger,
// CCMHook OnClassKilledFirstBlood,
function void (const int iModuleIndex, const int iVictimId, const int iAttackerId);
function void (const int iModuleIndex, const CCMClass Victim, const CCMClass Attacker);
// CCMHook OnClassKillBuilding
function void (const int iModuleIndex, const int iAttackerId, const int iBuildingRef);
function void (const int iModuleIndex, const CCMClass Attacker, const int iBuildingRef);
// CCMHook OnConfiguration_Load_Sounds
// CCMHook OnConfiguration_Load_Materials
// CCMHook OnConfiguration_Load_Models
function void (char[] cFile, char[] skey, char[] value, bool& bPreCacheFile, bool& bAddFileToDownloadsTable);
// CCMHook OnConfiguration_Load_Misc
function void (char[] cFile, char[] skey, char[] value);
ChangeLog
PHP Code:
Version 1.0.0 - 12/12/2016 - Stable Version Release;
Version 1.0 BETA - 11/22/2014 - Release;
Public BitBucket Repository