Page 1 of 1

Player_death break before death message?

Posted: Tue May 06, 2014 2:21 pm
by Tuck
Is it possible to catch the player_death and not send the message of who killed who to clients?

Thanks in advance

Edit: Another question i have is would it be possible to access the users ranking stats csgo clients have?

Posted: Tue May 06, 2014 3:44 pm
by satoon101
Much like this post, you can set the bDontBroadcast value to True in player_death:

Syntax: Select all

from memory import get_object_pointer
from memory import make_object
from memory import Convention, Argument, Return
from events import GameEvent
from events.manager import GameEventManager
from memory.hooks import PreHook
from core import PLATFORM

FIRE_EVENT_FUNC = get_object_pointer(
GameEventManager).make_virtual_function(
7 if PLATFORM == 'windows' else 8,
Convention.THISCALL,
(Argument.POINTER, Argument.POINTER, Argument.BOOL),
Return.VOID
)

@PreHook(FIRE_EVENT_FUNC)
def pre_fire_event(arguments):
game_event = make_object(GameEvent, arguments[1])
if game_event.get_name() == 'player_death':
arguments[2] = True

Players still receive money for kills, but the death notices are not displayed. If you just want to do this to specific clients, it will require a different approach.

As for your other question, we don't have that functionality directly built-in to Source.Python, but you might be able to use dynamic/virtual functions to achieve that.

Posted: Mon May 12, 2014 9:09 pm
by Doldol
For Q2, couldn't you use this?

https://developer.valvesoftware.com/wiki/Steam_Web_API
There is a pre-made Python wrapper for it here: https://github.com/smiley/steamapi

Posted: Wed May 14, 2014 10:34 pm
by satoon101
Here's another pre-made Python wrapper for the SteamWebAPI:
https://github.com/michaeljohnbarr/SteamWebAPI-Python

Both should work with Py2 and Py3, since they both require requests.