Search found 47 matches
- Mon Jun 29, 2020 6:23 am
- Forum: General Discussion
- Topic: Small "threaded" function decorator
- Replies: 0
- Views: 1527
Small "threaded" function decorator
from listeners.tick import GameThread def threaded(fn): def wrapper(*args, **kwargs): thread = GameThread(target=fn, args=args, kwargs=kwargs) thread.daemon = True thread.start() return wrapper def load(): do_something_that_blocks() @threaded def do_something_that_blocks(): requests.get("https...
- Mon Jun 29, 2020 2:29 am
- Forum: General Discussion
- Topic: [TF2] Extending the Player class
- Replies: 11
- Views: 1667
Re: [TF2] Extending the Player class
So this is what my ctf player is looking like: CTFPlayer.ini [virtual_function] # _ZN9CTFPlayer10BumpWeaponEP17CBaseCombatWeapon [[bump_weapon]] offset_linux = 401 offset_windows = 400 arguments = POINTER return_type = BOOL [property] ragdoll = m_hRagdoll player_class = m_PlayerClass.m_iClass desire...
- Mon Jun 29, 2020 1:02 am
- Forum: General Discussion
- Topic: [TF2] Extending the Player class
- Replies: 11
- Views: 1667
Re: [TF2] Extending the Player class
So im looking to get uber gun percentage as well So I would need to be able to get the active weapon class that the player has. I see this being under this: CTFPlayer (type DT_TFPlayer) Table: baseclass (offset 0) (type DT_BasePlayer) Table: baseclass (offset 0) (type DT_BaseCombatCharacter) Table: ...
- Sun Jun 28, 2020 11:40 pm
- Forum: General Discussion
- Topic: [TF2] Extending the Player class
- Replies: 11
- Views: 1667
Re: [TF2] Extending the Player class
So I'm not seeing any data with a class name to id mapping; i assume i should add it? Since it's very specfic to TF2, im not sure where to put it. Bascially would want this: [classes] scout = 1 sniper = 2 soldier = 3 demoman = 4 medic = 5 heavy = 6 pyro = 7 spy = 8 engineer = 9
- Sat Jun 27, 2020 10:55 pm
- Forum: General Discussion
- Topic: [TF2] Extending the Player class
- Replies: 11
- Views: 1667
Re: [TF2] Extending the Player class
Similar to the Player classes for CSGO and CSS , you can create one for Team Fortress 2 ( source-python/packages/source-python/players/orangebox/tf.py ). As for enums, there's already data for teams , you can use that as a template for creating one for classes. The class properties you're using are...
- Sat Jun 27, 2020 5:18 am
- Forum: Plugin Development Support
- Topic: [TF2] Hooking Server Log
- Replies: 5
- Views: 1314
Re: [TF2] Hooking Server Log
This works! Thanks for all the help guys!
- Sat Jun 27, 2020 4:55 am
- Forum: General Discussion
- Topic: [TF2] Extending the Player class
- Replies: 11
- Views: 1667
[TF2] Extending the Player class
Hello! There are some convenience methods that would be very helpful for me to have on the player class from TF2. I'm currently monkey patching the Player module to add them, but wondering what I could do to make this part of SP directly. It would add methods to this class here: http://wiki.sourcepy...
- Fri Jun 26, 2020 7:09 pm
- Forum: Plugin Development Support
- Topic: [TF2] Hooking Server Log
- Replies: 5
- Views: 1314
Re: [TF2] Hooking Server Log
If you want to to hook the complete server output, you can use the OnServerOutput listener: http://wiki.sourcepython.com/developing/module_tutorials/listeners.html#onserveroutput If you want to get the server output at a specific time (e. g. when executing a command), you can use context manager se...
- Fri Jun 26, 2020 6:29 am
- Forum: Plugin Development Support
- Topic: [TF2] Hooking Server Log
- Replies: 5
- Views: 1314
[TF2] Hooking Server Log
Basically I need the SP equivalent of this: https://sm.alliedmods.net/new-api/logging/AddGameLogHook This allows me to take the log output from the server console (via the log cvar) and pipe it into a file which I will later need to upload somewhere when the match ends. Example log line: L 06/26/202...
- Sat Jun 20, 2020 8:49 pm
- Forum: Plugin Development Support
- Topic: [TF2] Suppress mp_tournament_whitelist output
- Replies: 2
- Views: 1349
[TF2] Suppress mp_tournament_whitelist output
Basically every time the server changes level or does mp_tournament_restart it will spit out a giant list of allowing and denying items in both console and in in-game chat Heres a snippet of what it looks like: ... -> Removing 'Taunt: The Russian Arms Race' -> Removing 'Taunt: The Soviet Strongarm' ...
- Sat Jun 20, 2020 8:45 am
- Forum: Plugin Releases
- Topic: [ANY] SP Exec
- Replies: 0
- Views: 1959
[ANY] SP Exec
Okay so this is a long story as to why i decided i needed to do this; but short version is: srcds is unable to correctly read the file size from cfg files inside a mounted NFS volume. This means I can't use an AWS EFS volume to store cfg and other files to share between my servers. So my solution fo...
- Mon Dec 30, 2019 11:38 pm
- Forum: Plugin Development Support
- Topic: [ANY] Prevent user name changes
- Replies: 10
- Views: 6592
[ANY] Prevent user name changes
I'm creating an plugin to integrate my discord with my TF2 servers; and want to force names to be sync'd. I need to be able to prevent players from changing their name. This code does not seem to work: @PreEvent('player_changename') def on_changename(event): return EventAction.BLOCK Am I missing som...
- Mon Dec 30, 2019 10:47 pm
- Forum: Plugin Development Support
- Topic: [TF2] Force start round in mp_tournament
- Replies: 2
- Views: 2422
Re: [TF2] Force start round in mp_tournament
I know this is a very late response; but this is the only thing I could get to work: https://github.com/servers-tf/sourcepython-plugins/blob/master/admin/admin.py#L111-L120 If I remember correctly; there were entities i could send inputs to but they just ignored it. The behavior of the mp_tournament...
- Thu Mar 21, 2019 6:33 pm
- Forum: Plugin Development Support
- Topic: [TF2] Force start round in mp_tournament
- Replies: 2
- Views: 2422
[TF2] Force start round in mp_tournament
Hello! I'm trying to work on some plugins for competitive TF2, one thing that would be really nice is having a bit more control over the mp_tournament stuff. Basically TF2 has a mode than can be enabled called "mp tournament" which allows community organized competitive matches to occur. I...
- Sat Sep 08, 2018 2:26 am
- Forum: Plugin Development Support
- Topic: Server Monitoring Plugin
- Replies: 0
- Views: 3793
Server Monitoring Plugin
Hey all! So I'm a system administrator by day; ive recently started using some new monitoring software and I wanna use it with my TF2 servers. Basically I want to write a plugin that outside processes can hit an endpoint and ask for information from the srcds process. Thinking I would just stand up ...
- Tue Sep 04, 2018 4:59 pm
- Forum: Plugin Development Support
- Topic: TF2 - Getting weapon names from event byte
- Replies: 10
- Views: 4471
Re: TF2 - Getting weapon names from event byte
I suppose that works. I would've liked to see that be a bit more dynamic than that but if that's what sourcemod is doing then thats prob fine. Is there a clean namespace we could use to integrate this directly into the SourcePython? Theres a handful of other TF2 related data that would be helpful t...
- Tue Sep 04, 2018 3:33 pm
- Forum: Plugin Development Support
- Topic: TF2 - Getting weapon names from event byte
- Replies: 10
- Views: 4471
Re: TF2 - Getting weapon names from event byte
Seems like this is the enumerated type (untested): # ============================================================================ # >> IMPORTS # ============================================================================ # Python from enum import IntEnum # Source.Python Imports from events import ...
- Tue Sep 04, 2018 12:44 am
- Forum: Plugin Development Support
- Topic: TF2 - Getting weapon names from event byte
- Replies: 10
- Views: 4471
Re: TF2 - Getting weapon names from event byte
Yeah im not sure why player shoot does not trigger. I was gonna ask about that lol. Im assuming there is just some offset not set right? This is the code im currently testing with from entities.entity import Entity from weapons.entity import Weapon @Event("player_hurt") def damage(event): ...
- Mon Sep 03, 2018 6:43 pm
- Forum: Plugin Development Support
- Topic: TF2 - Getting weapon names from event byte
- Replies: 10
- Views: 4471
Re: TF2 - Getting weapon names from event byte
The byte is probably the index of the entity: weapon = Weapon(ev['weapon']) Ah yeah that was a good thought as well; but did not work. It looks like it's refering to this here: https://wiki.alliedmods.net/Team_Fortress_2_Item_Definition_Indexes It doesnt appear to be an entity index...
- Sun Sep 02, 2018 9:40 pm
- Forum: Plugin Development Support
- Topic: TF2 - Getting weapon names from event byte
- Replies: 10
- Views: 4471
Re: TF2 - Getting weapon names from event byte
Hmm that is a good thought! however it wouldn't be entirely accurate to do it that way unfortunately Some classes like demo can det his stickies with any weapon equipped. Or projectile weapons can kill while the equipped weapon is switched off before it hits. Not to mention sentry guns, bleed, jarat...