Code: Select all
public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason)
{
return Plugin_Handled;
}
I'm guessing using PreHook but I'm not sure on what entity or if there is an easier way
Code: Select all
public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason)
{
return Plugin_Handled;
}
satoon101 wrote:mp_ignore_round_win_conditions
If you want to stop the rounds from ending, set that to 1.
Syntax: Select all
# ../terminate_round/terminate_round.py
# Source.Python
import core
import memory
from memory import Convention, DataType
from memory.hooks import PreHook
server = memory.find_binary('server', srv_check=False)
if core.PLATFORM == 'windows':
identifier = b'\x55\x8B\xEC\x83\xE4\xF8\x83\xEC\x2A\x53\x8B\xD9\xF3\x0F\x2A\x2A\x2A\x2A\x56\x57\x89\x2A\x2A\x2A\x83\xBB'
else:
identifier = b'\x55\x89\xE5\x57\x56\x53\x81\xEC\xBC\x00\x00\x00\x8B\x7D\x08\x8B\x9F'
terminate_round = server[identifier].make_function(
Convention.THISCALL,
[DataType.POINTER, DataType.INT, DataType.INT, DataType.INT],
DataType.VOID
)
@PreHook(terminate_round)
def pre_terminate_round(stack_data):
return 0
VinciT wrote:I took what Ayuto made earlier, changed the signatures, and I think I got the right arguments? (I took a peek at how the SM guys did it)Syntax: Select all
# ../terminate_round/terminate_round.py
# Source.Python
import core
import memory
from memory import Convention, DataType
from memory.hooks import PreHook
server = memory.find_binary('server')
if core.PLATFORM == 'windows':
identifier = b'\x55\x8B\xEC\x83\xE4\xF8\x83\xEC\x2A\x53\x8B\xD9\xF3\x0F\x2A\x2A\x2A\x2A\x56\x57\x89\x2A\x2A\x2A\x83\xBB'
else:
identifier = b'\x55\x89\xE5\x57\x56\x53\x81\xEC\xBC\x00\x00\x00\x8B\x7D\x08\x8B\x9F'
terminate_round = server[identifier].make_function(
Convention.THISCALL,
[DataType.POINTER, DataType.INT, DataType.INT, DataType.INT],
DataType.VOID
)
@PreHook(terminate_round)
def pre_terminate_round(stack_data):
return 0
Returning 0 seems to be blocking the round from ending (tested on Windows). However, without the return statement the round ends instantly.
There is no delay between rounds. Looking at the SM code, they seem to be using assembly to mess with the delay.
Honestly, I've no idea what I'm doing, so hopefully someone else can figure this out.
Code: Select all
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
plugin = self.manager.load(plugin_name)
File "../addons/source-python/packages/source-python/plugins/manager.py", line 194, in load
plugin._load()
File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
self.module = import_module(self.import_name)
File "../addons/source-python/plugins/roleplay/roleplay.py", line 91, in <module>
server = memory.find_binary('server')
OSError: Unable to find ../bin/server_srv.so
[SP] Plugin 'roleplay' was unable to be loaded.
[SP] Unloading plugin 'roleplay'...
[SP] Unable to unload plugin 'roleplay' as it is not currently loaded.
[SP] Loading plugin 'roleplay'...
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
plugin = self.manager.load(plugin_name)
File "../addons/source-python/packages/source-python/plugins/manager.py", line 194, in load
plugin._load()
File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
self.module = import_module(self.import_name)
File "../addons/source-python/plugins/roleplay/roleplay.py", line 91, in <module>
server = memory.find_binary('server')
OSError: Unable to find ../bin/server_srv.so
[SP] Plugin 'roleplay' was unable to be loaded.
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/commands/typed.py", line 554, in on_command
result = cls.on_clean_command(command_info, command_node, args)
File "../addons/source-python/packages/source-python/commands/typed.py", line 569, in on_clean_command
return command_node.callback(command_info, *cleaned_args)
File "../addons/source-python/plugins/pycmds/pycmds.py", line 288, in command_test
eval(info.command.arg_string, globals(), locals())
File "<string>", line 1, in <module>
NameError: name 'core' is not defined
[SP] Unloading plugin 'roleplay'...
[SP] Unable to unload plugin 'roleplay' as it is not currently loaded.
[SP] Loading plugin 'roleplay'...
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
plugin = self.manager.load(plugin_name)
File "../addons/source-python/packages/source-python/plugins/manager.py", line 194, in load
plugin._load()
File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
self.module = import_module(self.import_name)
File "../addons/source-python/plugins/roleplay/roleplay.py", line 91, in <module>
server = memory.find_binary('server')
OSError: Unable to find ../bin/server_srv.so
[SP] Plugin 'roleplay' was unable to be loaded.
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/commands/typed.py", line 554, in on_command
result = cls.on_clean_command(command_info, command_node, args)
File "../addons/source-python/packages/source-python/commands/typed.py", line 569, in on_clean_command
return command_node.callback(command_info, *cleaned_args)
File "../addons/source-python/plugins/pycmds/pycmds.py", line 288, in command_test
eval(info.command.arg_string, globals(), locals())
File "<string>", line 1, in <module>
NameError: name 'core' is not defined
[SP] Unloading plugin 'roleplay'...
[SP] Unable to unload plugin 'roleplay' as it is not currently loaded.
[SP] Loading plugin 'roleplay'...
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
plugin = self.manager.load(plugin_name)
File "../addons/source-python/packages/source-python/plugins/manager.py", line 194, in load
plugin._load()
File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
self.module = import_module(self.import_name)
File "../addons/source-python/plugins/roleplay/roleplay.py", line 91, in <module>
server = memory.find_binary('server')
OSError: Unable to find ../bin/server_srv.so
[SP] Plugin 'roleplay' was unable to be loaded.
Return to “Plugin Development Support”
Users browsing this forum: No registered users and 79 guests