Cancel GameEvent

Please post any questions about developing your plugin here. Please use the search function before posting!
necavi
Developer
Posts: 129
Joined: Wed Jan 30, 2013 9:51 pm

Cancel GameEvent

Postby necavi » Sun May 24, 2015 4:15 am

Is there currently a way to cancel/block/stop broadcast on a game event?
necavi
Developer
Posts: 129
Joined: Wed Jan 30, 2013 9:51 pm

Postby necavi » Sun May 24, 2015 7:39 am

Thanks! I can't believe I failed at searching that much.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun May 24, 2015 2:11 pm

I just now realized that those 2 scripts won't fully work with the newest version of SP. There have been some name changes since then. GameEventManager has been changed to game_event_manager. Also, both Argument and Return have been combined into DataType. So, it would now look more like this:

Syntax: Select all

from memory import get_object_pointer
from memory import make_object
from memory import Convention
from memory import DataType
from events import GameEvent
from events.manager import game_event_manager
from memory.hooks import PreHook
from core import PLATFORM

FIRE_EVENT_FUNC = get_object_pointer(
game_event_manager).make_virtual_function(
7 if PLATFORM == 'windows' else 8,
Convention.THISCALL,
(DataType.POINTER, DataType.POINTER, DataType.BOOL),
DataType.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
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: Bing [Bot] and 80 guests