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

[TF2] TF2 Utils


Post New Thread Reply   
 
Thread Tools Display Modes
Author
nosoop
Veteran Member
Join Date: Aug 2014
Plugin ID:
8134
Plugin Version:
1.3.1.1
Plugin Category:
Technical/Development
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
    85 
    Plugin Description:
    Provides common TF2 functionality to other plugins.
    Old 07-25-2022 , 10:10   [TF2] TF2 Utils
    Reply With Quote #1

    Description:
    A plugin library for common TF2 gameplay-related functionality, such as:
    • Equipping wearable items, providing a replacement for TF2 Wearable Tools / plugins that maintain their own EquipWearable SDKCall
    • Getting a player's current healers (dispensers, players)
    • Getting a weapon entity's maximum clip and the owner's maximum ammo.
    • Checking if an entity is in an active respawn room that they own (m_iSpawnRoomTouchCount does not verify the latter, and that's only available to players)
    • Forcing an update to player speed without using player condition-based kludges
    • Getting a weapon entity's ID (TF_WEAPON_* constant value) and weapon slot
    • Overriding a player's respawn time
    • Translating a condition name string to a condition index, plus additional functions to change condition durations / providers
    This library sees extensive use in my TF2 plugins, and I try to add new functionality here as I need it for other projects if I think it fits in.

    Installation:
    Nothing special if you've installed gamedata and plugins before; this plugin only depends on things that come bundled with SourceMod 1.10 or newer. Refer to the installation instructions here.

    For plugin developers:
    Check a look at the include file.

    Important breaking changes / fixes for server operators running older versions:
    • Subscribe to the Atom feed for project releases to be notified of gamedata updates and feature additions.
    • 1.3.2 corrects the behavior or TF2Util_SetPlayerActiveWeapon so that NULL entity references are processed as intended.
    • 1.3.1 corrects the Windows-specific crashes observed when using TF2Util_SetPlayerActiveWeapon, introduced in 1.3.0.
    • 0.19.1 fixes assertion failures being raised on entity references; feature was introduced in 0.14.0.
    Source / Download
    __________________
    I do TF2, TF2 servers, and TF2 plugins.
    I don't do DMs over Discord -- PM me on the forums regarding inquiries.
    AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

    Last edited by nosoop; 04-19-2023 at 08:59.
    nosoop is offline
    Mario96
    Junior Member
    Join Date: Jul 2022
    Old 07-25-2022 , 10:58   Re: [TF2] TF2 Utils
    Reply With Quote #2

    does the condition converter also translate a warpaint high and low seed?
    Mario96 is offline
    PC Gamer
    Veteran Member
    Join Date: Mar 2014
    Old 01-08-2023 , 16:36   Re: [TF2] TF2 Utils
    Reply With Quote #3

    It would be awesome if you'd kindly post a note here whenever a gamedata update is made.
    PC Gamer is offline
    nosoop
    Veteran Member
    Join Date: Aug 2014
    Old 01-09-2023 , 03:41   Re: [TF2] TF2 Utils
    Reply With Quote #4

    Quote:
    Originally Posted by PC Gamer View Post
    It would be awesome if you'd kindly post a note here whenever a gamedata update is made.
    Already got too much to keep track of, sorry.

    Consider subscribing to the Atom feed for project releases with your choice of feed aggregator / reader.
    My reader of choice is Thunderbird, but there are plenty of alternatives available.
    __________________
    I do TF2, TF2 servers, and TF2 plugins.
    I don't do DMs over Discord -- PM me on the forums regarding inquiries.
    AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
    nosoop is offline
    PC Gamer
    Veteran Member
    Join Date: Mar 2014
    Old 01-21-2023 , 18:51   Re: [TF2] TF2 Utils
    Reply With Quote #5

    Can you provide an example of how to use this function?

    PHP Code:
    /**
     * Returns the healer entity index at the given index in the player's healer array.
     * To get the number of healers available, use the m_nNumHealers netprop.
     * 
     * @return    Healer entity index at the given array index, or -1 on invalid healer entity
     *            reference.
     * @error     Index is out of bounds.
     */
    native int TF2Util_GetPlayerHealer(int clientint index); 
    I'm trying to determine who is targeting me with the medigun beam which happens even if I'm currently at full health and not being healed. I thought maybe this function could help with that but I don't understand what index is supposed to be passed to the function.

    Last edited by PC Gamer; 01-21-2023 at 18:51.
    PC Gamer is offline
    nosoop
    Veteran Member
    Join Date: Aug 2014
    Old 01-22-2023 , 08:07   Re: [TF2] TF2 Utils
    Reply With Quote #6

    Quote:
    Originally Posted by PC Gamer View Post
    Can you provide an example of how to use this function?

    PHP Code:
    native int TF2Util_GetPlayerHealer(int clientint index); 
    I'm trying to determine who is targeting me with the medigun beam which happens even if I'm currently at full health and not being healed. I thought maybe this function could help with that but I don't understand what index is supposed to be passed to the function.
    It's an implementation of Pelipoika's GetHealerByIndex, so the usage is similar:

    Code:
    for (int i, n = GetEntProp(client, Prop_Send, "m_nNumHealers"); i < n; i++)
    {
        int iHealerIndex = TF2Util_GetPlayerHealer(client, i);
        bool bIsClient = (iHealerIndex <= MaxClients);
        
        if(bIsClient)
        {
            PrintToServer("\"%N\" <- healed by player \"%N\" [%i]", client, iHealerIndex, iHealerIndex);
        }
        else
        {
            char class[64];
            GetEntityClassname(iHealerIndex, class, sizeof(class));
            
            PrintToServer("\"%N\" <- healed by entity \"%s\" [%i]", client, class, iHealerIndex);
        }
    }
    __________________
    I do TF2, TF2 servers, and TF2 plugins.
    I don't do DMs over Discord -- PM me on the forums regarding inquiries.
    AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
    nosoop is offline
    PC Gamer
    Veteran Member
    Join Date: Mar 2014
    Old 01-22-2023 , 20:39   Re: [TF2] TF2 Utils
    Reply With Quote #7

    That helps. Thanks!
    PC Gamer is offline
    Elite Biker
    Member
    Join Date: Nov 2020
    Location: The 13 Blessings
    Old 09-03-2023 , 07:24   Re: [TF2] TF2 Utils
    Reply With Quote #8

    Code:
    L 09/03/2023 - 14:19:46: [SM] Exception reported: Failed to set up call to CTFPlayerShared::Burn()
    L 09/03/2023 - 14:19:46: [SM] Blaming: tf2utils.smx
    L 09/03/2023 - 14:19:46: [SM] Call stack trace:
    L 09/03/2023 - 14:19:46: [SM]   [0] SetFailState
    L 09/03/2023 - 14:19:46: [SM]   [1] Line 223, scripting/tf2utils.sp::OnPluginStart
    __________________
    *Bop*
    Elite Biker is offline
    Reply



    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 18:31.


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