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

[TF2] tWeaponShootPosition v0.0.1 (2012-03-11)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Thrawn2
Veteran Member
Join Date: Apr 2009
Plugin ID:
2833
Plugin Version:
0.0.1
Plugin Category:
Technical/Development
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Hooks all players Weapon_ShootPosition and provides a global forward for other plugins.
    Old 03-11-2012 , 09:17   [TF2] tWeaponShootPosition v0.0.1 (2012-03-11)
    Reply With Quote #1

    This plugin is using the pre-alpha DHooks extension to hook Weapon_ShootPosition. It is required for runtime and compilation.

    Weapon_ShootPosition get's called everytime a player fires a shot (and has ammo for it etc).
    Since TF2 is missing a proper way to detect firing with TF2_CalcIsCritical requiring tf_weapon_criticals to be 1 and +ATTACK hooks fire even if the player has no weapons and therefore require lots of validity checks, hooking ShootPosition is probably one of the easier ways.

    This plugin simply provides a forward whenever a client shoots a weapon.

    Example Code:
    PHP Code:
    #include <sourcemod>
    #include <tweaponshootposition>

    public OnClientWeaponShootPosition(clientFloat:position[3]) {
        
    PrintToServer("%N is firing his weapon at %.2f %.2f %.2f"clientposition[0], position[1], position[2]);

    Feel free to strip this plugin of it's forwarding stuff and use the code directly in your plugin if you're feeling more comfortable with it.
    Attached Files
    File Type: sp Get Plugin or Get Source (tWeaponShootPosition.sp - 820 views - 1.6 KB)
    File Type: inc tweaponshootposition.inc (162 Bytes, 577 views)
    File Type: txt tweaponshootposition.tf.txt (164 Bytes, 691 views)
    __________________
    einmal mit profis arbeiten. einmal.
    Thrawn2 is offline
    FudgePoly
    Senior Member
    Join Date: Jul 2011
    Old 03-11-2012 , 09:23   Re: [TF2] tWeaponShootPosition v0.0.1 (2012-03-11)
    Reply With Quote #2

    Could you describe, briefly, what this hook could be used for with new plugins? Seems interesting.
    FudgePoly is offline
    Thrawn2
    Veteran Member
    Join Date: Apr 2009
    Old 03-11-2012 , 10:00   Re: [TF2] tWeaponShootPosition v0.0.1 (2012-03-11)
    Reply With Quote #3

    • basically: do sth everytime a player fires a shot, uses his melee weapon etc.
    • stats-tracking.
    • hit-streaks (a la 5 headshots in a row without missing a shot)
    stuff like that
    __________________
    einmal mit profis arbeiten. einmal.
    Thrawn2 is offline
    pheadxdll
    AlliedModders Donor
    Join Date: Jun 2008
    Old 03-11-2012 , 15:47   Re: [TF2] tWeaponShootPosition v0.0.1 (2012-03-11)
    Reply With Quote #4

    this will fire on every frame when the knife is out, even when not attacking
    __________________

    Last edited by pheadxdll; 03-11-2012 at 16:03.
    pheadxdll is offline
    Lange
    Member
    Join Date: Apr 2009
    Old 03-11-2012 , 16:49   Re: [TF2] tWeaponShootPosition v0.0.1 (2012-03-11)
    Reply With Quote #5

    This plugin greatly interests me for use in MGEMod, but having to run both SDKHooks and DHooks seems less than optimal. In addition, would using this mean that people would have to go out and install manual gamedata updates after patches?

    Last edited by Lange; 03-11-2012 at 16:49.
    Lange is offline
    Thrawn2
    Veteran Member
    Join Date: Apr 2009
    Old 03-12-2012 , 05:59   Re: [TF2] tWeaponShootPosition v0.0.1 (2012-03-11)
    Reply With Quote #6

    Quote:
    Originally Posted by pheadxdll View Post
    this will fire on every frame when the knife is out, even when not attacking
    Looks like I have to do some more testing and need to deal with a few exceptions here and there.

    Quote:
    Originally Posted by Lange View Post
    This plugin greatly interests me for use in MGEMod, but having to run both SDKHooks and DHooks seems less than optimal.
    You could request that this hook will be added to SDKHooks.

    Quote:
    Originally Posted by Lange View Post
    In addition, would using this mean that people would have to go out and install manual gamedata updates after patches?
    Currently yes as i have no idea how that auto-gamedata-updating stuff works yet. Got to do some research first.
    __________________
    einmal mit profis arbeiten. einmal.
    Thrawn2 is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 03-12-2012 , 12:54   Re: [TF2] tWeaponShootPosition v0.0.1 (2012-03-11)
    Reply With Quote #7

    Quote:
    Originally Posted by pheadxdll View Post
    this will fire on every frame when the knife is out, even when not attacking
    So that's why rapidfire knives don't miss. Cool.
    __________________
    Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.

    All plugins: Randomizer/GiveWeapon, ModelManager, etc.
    Post in plugin threads with questions.
    Steam is for playing games.
    You will be fed to javalia otherwise.
    Psyduck likes replays.
    FlaminSarge is offline
    Pelipoika
    Veteran Member
    Join Date: May 2012
    Location: Inside
    Old 09-07-2015 , 11:26   Re: [TF2] tWeaponShootPosition v0.0.1 (2012-03-11)
    Reply With Quote #8

    Updated Gamedata

    PHP Code:
    "Games"
    {
        
    "tf"
        
    {
            
    "Offsets"
            
    {
                
    "CBasePlayer::Weapon_ShootPosition()"
                
    {
                    
    "windows"    "258"
                    "linux"        "259"
                    "mac"        "259"
                
    }
            }
        }

    __________________
    Pelipoika 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 10:33.


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