AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2] Custom Class Maker v1.0.0 (https://forums.alliedmods.net/showthread.php?t=251958)

nergal 11-22-2014 21:31

[TF2] Custom Class Maker v1.0.0
 
1 Attachment(s)
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 typeCCMHookCB callback); 
native bool CCM_HookEx(CCMHookType typeCCMHookCB 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 typeCCMHookCB callback); 
native bool CCM_UnhookEx(CCMHookType typeCCMHookCB 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 clientbool 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 clientbool 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 clientint 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 indexbool 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[] cFilechar[] skeychar[] valueboolbPreCacheFileboolbAddFileToDownloadsTable); 
 
    
// CCMHook OnConfiguration_Load_Misc 
    
function void (char[] cFilechar[] skeychar[] 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

ScrapEngineer 12-07-2016 16:36

Re: [TF2] Custom Class Maker [BETA]
 
If I knew anything about Sorcepawn, I'd probably think I'd love this.

zyox123cc 12-08-2016 04:16

Re: [TF2] Custom Class Maker [BETA]
 
maybe can add in !model plugin

nergal 12-12-2016 21:43

Re: [TF2] Custom Class Maker [BETA]
 
Quote:

Originally Posted by ScrapEngineer (Post 2475996)
If I knew anything about Sorcepawn, I'd probably think I'd love this.

If you can learn roblox, this should be easy :)

Also, I updated and improved the entire plugin and subplugin system.

ScrapEngineer 12-24-2016 05:31

Re: [TF2] Custom Class Maker v1.0.0
 
Sounds like Custom Weapons 3 when you give a moron it.


All times are GMT -4. The time now is 22:34.

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