Player_death break before death message?

Please post any questions about developing your plugin here. Please use the search function before posting!
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

Player_death break before death message?

Postby Tuck » Tue May 06, 2014 2:21 pm

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?
-Tuck
User avatar
satoon101
Project Leader
Posts: 2703
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue May 06, 2014 3:44 pm

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.
User avatar
Doldol
Senior Member
Posts: 201
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Postby Doldol » Mon May 12, 2014 9:09 pm

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
User avatar
satoon101
Project Leader
Posts: 2703
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Wed May 14, 2014 10:34 pm

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 85 guests