File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed
srcds/addons/source-python/plugins/admin Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 1010from .core import models
1111from .core .clients import clients
1212from .core .events .storage import admin_resource_list
13+ from .core .helpers import chat_message
1314from .core .listeners import (on_spa_loaded_listener_manager ,
1415 on_spa_unloaded_listener_manager )
1516from .core .frontends .menus import main_menu
3233def load ():
3334 admin_resource_list .load_all_events ()
3435 on_spa_loaded_listener_manager .notify ()
35- clients . broadcast (strings_common ['load' ])
36+ chat_message (strings_common ['load' ])
3637
3738
3839def unload ():
3940 admin_command_manager .unload_all_plugins ()
4041 on_spa_unloaded_listener_manager .notify ()
41- clients . broadcast (strings_common ['unload' ])
42+ chat_message (strings_common ['unload' ])
4243
4344
4445# =============================================================================
Original file line number Diff line number Diff line change @@ -87,13 +87,4 @@ def name(self):
8787 def steamid (self ):
8888 return self .player .steamid
8989
90-
91- class ClientDictionary (PlayerDictionary ):
92- @staticmethod
93- def broadcast (message ):
94- say_text2 = SayText2 (strings_common ['chat_base' ].tokenized (
95- message = message ))
96-
97- say_text2 .send (PlayerIter ('human' ))
98-
99- clients = ClientDictionary (Client )
90+ clients = PlayerDictionary (Client )
Original file line number Diff line number Diff line change 22# >> IMPORTS
33# =============================================================================
44# Source.Python
5- from messages import SayText2
5+ from messages import HudDestination , SayText2 , TextMsg
66from translations .manager import language_manager
77
88# Source.Python Admin
@@ -43,6 +43,16 @@ def format_player_name(player_name):
4343
4444
4545def log_admin_action (message ):
46- SayText2 ( strings_common [ 'chat_base' ]. tokenized ( message = message )). send ( )
46+ chat_message ( message )
4747 admin_performed_actions_logger .log_message (
4848 message .get_string (language_manager .default ))
49+
50+
51+ def chat_message (message , targets = ()):
52+ SayText2 (
53+ strings_common ['chat_base' ].tokenized (message = message )
54+ ).send (* targets )
55+
56+
57+ def console_message (message , targets = ()):
58+ TextMsg (message , HudDestination .CONSOLE ).send (* targets )
You can’t perform that action at this time.
0 commit comments