Resolve file using sourcepython
Posted: Tue Mar 31, 2020 2:38 pm
by Tetragromaton
There is an extension that lets you resolve client side file
here it is.
So is there anyway to request file from client using sourcepython plugin ?
Re: Resolve file using sourcepython
Posted: Thu Apr 02, 2020 8:18 am
by Ayuto
Currently, you can only send files, but not request them. And you can listen to file "events" using hooks. But since we have exposed the function info, you can easily create the hooks to listen to those events.
https://github.com/Source-Python-Dev-Te ... p#L73-L106In a few days I can provide an example or even update SP to do that stuff easily.
Re: Resolve file using sourcepython
Posted: Thu Apr 09, 2020 7:53 pm
by Ayuto
Here is the promised example:
Syntax: Select all
from players.entity import Player
from entities.hooks import EntityPreHook
from entities.hooks import EntityCondition
from memory import get_virtual_function
def netchannel_hook(func):
def init_hook(base_entity):
player = Player(base_entity.index)
return get_virtual_function(player.client.net_channel.msg_handler, func)
return init_hook
@EntityPreHook(
EntityCondition.is_human_player,
netchannel_hook('FileRequested'))
def pre_file_requested(args):
print('FileRequested', tuple(args))
@EntityPreHook(
EntityCondition.is_human_player,
netchannel_hook('FileReceived'))
def pre_file_rceived(args):
print('FileReceived', tuple(args))
@EntityPreHook(
EntityCondition.is_human_player,
netchannel_hook('FileDenied'))
def pre_file_denied(args):
print('FileDenied', tuple(args))
@EntityPreHook(
EntityCondition.is_human_player,
netchannel_hook('FileSent'))
def pre_file_sent(args):
print('FileSent', tuple(args))